Skip to content

Add EC2 deployment to CI/CD workflow - #88

Merged
khemssharma merged 1 commit into
mainfrom
khemssharma-patch-1
Aug 25, 2026
Merged

Add EC2 deployment to CI/CD workflow#88
khemssharma merged 1 commit into
mainfrom
khemssharma-patch-1

Conversation

@khemssharma

Copy link
Copy Markdown
Owner

Adds a deploy-ec2 job to the existing CI/CD workflow so every push to main that passes the e2e job also deploys to the EC2 instance (i-0e7228c670843fdc7), in addition to the existing Render deploy.

What it does on the box (ubuntu@65.0.131.22, app cloned at ~/chess):

  • Preserves ui/.env.production (hand-edited on the box to point at the EC2 IP instead of the Render URLs committed in the repo) across the reset
    • git fetch + reset --hard to origin/main
    • Rebuilds and recreates only the backend docker compose service (postgres/redis untouched)
    • Runs npm ci at the repo root on the host, then builds and rsyncs the ui/ frontend to /var/www/chess-frontend (nginx's docroot). The root install is required for ui's tsc build to resolve dotenv/@types/node while type-checking src/tests/runTests.ts.
      Before merging, add these repository secrets (Settings -> Secrets and variables -> Actions -> New repository secret):
  • EC2_HOST = 65.0.131.22
    • EC2_USER = ubuntu
    • EC2_SSH_KEY = the private half of a dedicated ed25519 deploy key (generated on the box; its public half was appended to ~/.ssh/authorized_keys there, nothing else changed)
      I validated the build and frontend-deploy steps directly on the instance (docker image build, root+ui npm ci/build, rsync to /var/www/chess-frontend all succeeded); the actual docker compose up -d backend restart will happen on this workflow's first real run once the secrets are added.

Added EC2 deployment steps to the CI/CD workflow, allowing for deployment to an EC2 instance after successful end-to-end tests.
@khemssharma
khemssharma temporarily deployed to khemssharma-patch-1 - Chess PR #88 August 25, 2026 12:25 — with Render Destroyed

@khemssharma khemssharma left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

ok fine. Let's try it

@khemssharma
khemssharma merged commit f6dfc69 into main Aug 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant