feat: Deploy HA auto-failover with database promotion

- Enhanced DNS failover monitor on secondary (72.62.39.24)
- Auto-promotes database: pg_ctl promote on failover
- Creates DEMOTED flag on primary via SSH (split-brain protection)
- Telegram notifications with database promotion status
- Startup safety script ready (integration pending)
- 90-second automatic recovery vs 10-30 min manual
- Zero-cost 95% enterprise HA benefit

Status: DEPLOYED and MONITORING (14:52 CET)
Next: Controlled failover test during maintenance
This commit is contained in:
mindesbunister
2025-12-12 15:54:03 +01:00
parent 7ff5c5b3a4
commit d637aac2d7
25 changed files with 1071 additions and 170 deletions

View File

@@ -156,6 +156,10 @@ export async function POST(request: NextRequest): Promise<NextResponse<ScalePosi
const newTP1 = calculatePrice(newAvgEntry, config.takeProfit1Percent, trade.direction)
const newTP2 = calculatePrice(newAvgEntry, config.takeProfit2Percent, trade.direction)
const newSL = calculatePrice(newAvgEntry, config.stopLossPercent, trade.direction)
const effectiveTp2SizePercent =
config.useTp2AsTriggerOnly && (config.takeProfit2SizePercent ?? 0) <= 0
? 0
: (config.takeProfit2SizePercent ?? 0)
console.log(`🎯 New targets:`)
console.log(` TP1: $${newTP1} (${config.takeProfit1Percent}%)`)
@@ -173,7 +177,7 @@ export async function POST(request: NextRequest): Promise<NextResponse<ScalePosi
tp2Price: newTP2,
stopLossPrice: newSL,
tp1SizePercent: config.takeProfit1SizePercent,
tp2SizePercent: config.takeProfit2SizePercent,
tp2SizePercent: effectiveTp2SizePercent,
useDualStops: config.useDualStops,
softStopPrice: config.useDualStops ? calculatePrice(newAvgEntry, config.softStopPercent, trade.direction) : undefined,
softStopBuffer: config.useDualStops ? config.softStopBuffer : undefined,