Skip to content

Remove Nginx/Certbot and expose app container directly via --host-port - #453

Open
SaravanakumarR2018 wants to merge 3 commits into
mainfrom
codex/remove-nginx-and-modify-deployment-script
Open

Remove Nginx/Certbot and expose app container directly via --host-port#453
SaravanakumarR2018 wants to merge 3 commits into
mainfrom
codex/remove-nginx-and-modify-deployment-script

Conversation

@SaravanakumarR2018

Copy link
Copy Markdown
Owner

Motivation

  • The deployment flow should serve the application directly from the container on the server (no reverse proxy), so Nginx and Certbot provisioning/traffic switching should be removed.
  • Simplify operations and make the script suitable for direct-to-server deployments by exposing a host port from the container.

Description

  • Removed Nginx/Certbot provisioning, config generation, snippets, timers, and site-management logic from deploy/ebs-staging-prod.sh and stopped installing Nginx/certbot packages.
  • Added a --host-port CLI option and HOST_PORT default (80) and removed the blue/green host port flags and cert/email requirements; --domain is now optional and only used for EBS environment inference.
  • Replaced Nginx upstream switching with a simple active-color marker update written to ACTIVE_FILE, and updated switch_traffic, rollback_switch, and verify_domain to operate without a proxy by checking http://127.0.0.1:${HOST_PORT}.
  • Changed Docker run port mapping to publish the container directly with -p "${HOST_PORT}:${CONTAINER_PORT}" while preserving the stop-first, health-check, and rollback flow.

Testing

  • Ran a shell syntax check with bash -n deploy/ebs-staging-prod.sh, which completed successfully.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines 335 to 337
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 ""
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +310 to +313
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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant