Remove Nginx/Certbot and expose app container directly via --host-port - #453
Remove Nginx/Certbot and expose app container directly via --host-port#453SaravanakumarR2018 wants to merge 3 commits into
--host-port#453Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f826cd2479
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| get_symlink_color() { | ||
| if [[ -L "${UP_ACTIVE}" ]]; then | ||
| readlink -f "${UP_ACTIVE}" | grep -q "blue" && echo "blue" && return | ||
| readlink -f "${UP_ACTIVE}" | grep -q "green" && echo "green" && return | ||
| fi | ||
| echo "" | ||
| } |
There was a problem hiding this comment.
Persist active color across reboots
get_symlink_color now always returns empty, so whenever /var/run/${APP_NAME}-active-color is absent (which is common after reboot because /var/run is ephemeral), the script defaults ACTIVE_COLOR to green even if app_blue is the live container. In that state HAD_ACTIVE is computed against the wrong container name, and the deploy can delete the actually-running container as the “target” before the new image is proven healthy, which removes rollback safety and can leave no app running if startup fails.
Useful? React with 👍 / 👎.
| step "Enabling & starting Docker" | ||
| systemctl enable docker >/dev/null 2>&1 || true | ||
| systemctl start docker || true | ||
| systemctl enable nginx >/dev/null 2>&1 || true | ||
| service_active nginx || systemctl start nginx | ||
| ok "Services ensured" | ||
| ok "Docker service ensured" |
There was a problem hiding this comment.
Stop legacy nginx before binding direct host port
The new direct-to-server flow starts only Docker here, but does not stop/disable nginx from prior deployments. Because the script now publishes the app directly on ${HOST_PORT} (default 80), hosts upgraded from the previous nginx-based version can fail deployment with a bind error (port is already allocated) when nginx is still listening on 80.
Useful? React with 👍 / 👎.
Motivation
Description
deploy/ebs-staging-prod.shand stopped installing Nginx/certbot packages.--host-portCLI option andHOST_PORTdefault (80) and removed the blue/green host port flags and cert/email requirements;--domainis now optional and only used for EBS environment inference.ACTIVE_FILE, and updatedswitch_traffic,rollback_switch, andverify_domainto operate without a proxy by checkinghttp://127.0.0.1:${HOST_PORT}.-p "${HOST_PORT}:${CONTAINER_PORT}"while preserving the stop-first, health-check, and rollback flow.Testing
bash -n deploy/ebs-staging-prod.sh, which completed successfully.Codex Task