diff --git a/deploy_gb.sh b/deploy_gb.sh index 562eb23..48ef350 100644 --- a/deploy_gb.sh +++ b/deploy_gb.sh @@ -12,32 +12,6 @@ if [ "${TAXBAIK_DEPLOY_FROM_CI:-}" != "1" ]; then exit 1 fi -if [ ! -s "$DEPLOY_HOME/taxbaik_active/appsettings.Production.json" ]; then - echo "❌ Missing production settings: $DEPLOY_HOME/taxbaik_active/appsettings.Production.json" >&2 - exit 1 -fi - -if [ ! -s "$DEPLOY_HOME/taxbaik_active/proxy/TaxBaik.Proxy.dll" ]; then - echo "❌ Missing proxy artifact: $DEPLOY_HOME/taxbaik_active/proxy/TaxBaik.Proxy.dll" >&2 - exit 1 -fi - -# 0. Ensure the local TCP proxy exists and is running. -# Nginx and external traffic always enter through 127.0.0.1:5001. -if ! ss -tln | grep -q ':5001 '; then - if [ -f "$DEPLOY_HOME/taxbaik_active/proxy/TaxBaik.Proxy.dll" ]; then - echo "=== Starting proxy on 127.0.0.1:5001 ===" - cd "$DEPLOY_HOME/taxbaik_active/proxy" - nohup /usr/bin/dotnet TaxBaik.Proxy.dll > "$DEPLOY_HOME/taxbaik_proxy.log" 2>&1 & - sleep 2 - fi -fi - -if ! ss -tln | grep -q ':5001 '; then - echo "❌ Proxy on 127.0.0.1:5001 is not running. Abort deploy." >&2 - exit 1 -fi - # 1. Determine active port ACTIVE_PORT=5003 if [ -f "$PORT_FILE" ]; then @@ -64,6 +38,30 @@ fi echo "Deploy Directory: $DEPLOY_DIR" +if [ ! -s "$DEPLOY_DIR/appsettings.Production.json" ]; then + echo "❌ Missing production settings: $DEPLOY_DIR/appsettings.Production.json" >&2 + exit 1 +fi + +if [ ! -s "$DEPLOY_DIR/proxy/TaxBaik.Proxy.dll" ]; then + echo "❌ Missing proxy artifact: $DEPLOY_DIR/proxy/TaxBaik.Proxy.dll" >&2 + exit 1 +fi + +# 0. Ensure the local TCP proxy exists and is running. +# Nginx and external traffic always enter through 127.0.0.1:5001. +if ! ss -tln | grep -q ':5001 '; then + echo "=== Starting proxy on 127.0.0.1:5001 ===" + cd "$DEPLOY_DIR/proxy" + nohup /usr/bin/dotnet TaxBaik.Proxy.dll > "$DEPLOY_HOME/taxbaik_proxy.log" 2>&1 & + sleep 2 +fi + +if ! ss -tln | grep -q ':5001 '; then + echo "❌ Proxy on 127.0.0.1:5001 is not running. Abort deploy." >&2 + exit 1 +fi + # 4. Start the new app on the target port echo "=== Starting New App on Port $TARGET_PORT ===" cd "$DEPLOY_DIR"