Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to deploy using Kamal #349

Merged
merged 22 commits into from
Nov 3, 2023
Merged

Add support to deploy using Kamal #349

merged 22 commits into from
Nov 3, 2023

Conversation

EmilioCristalli
Copy link
Collaborator

We want to try Kamal to do the deploys using docker and AWS servers.

In this PR we are adding two destinations (staging and production), both sharing the same server, at least for now.
Each destination also has an "accessory" to set up a postgres database in a second server (also shared between both destinations)

You will need an .env.staging and .env.production with these secrets RAILS_MASTER_KEY, DATABASE_URL and POSTGRES_PASSWORD

Steps to set up the servers in AWS:

  1. Run this to install docker
sudo apt update
sudo apt install -y docker.io curl git
sudo usermod -a -G docker ubuntu
  1. Add any authorized keys for people that need to connect with ssh
  2. For the web server run this (needed to auto generate SSL certificates using LetsEncrypt)
mkdir -p /home/ubuntu/letsencrypt && touch /home/ubuntu/letsencrypt/acme.json && chmod 600 /home/ubuntu/letsencrypt/acme.json
  1. Enable HTTPS (443) incoming traffic in web instance
  2. Enable ports 5432 & 5433 for incoming traffic in DB instance
  3. Run kamal setup -d staging (or -d production)

For normal deploys run kamal deploy -d staging.
If env vars change you will have to push them with kamal env push -d staging

hosts:
- 44.196.164.25
labels:
traefik.http.routers.micarrera-web-production.rule: Host(`micarrera.uy`)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we also add fing.micarrera.uy too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added in 803422b

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would honestly remove kamal's .sample files if we are not going to use them 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed in 9138f87

@EmilioCristalli EmilioCristalli merged commit 638dcd1 into master Nov 3, 2023
1 check passed
@EmilioCristalli EmilioCristalli deleted the kamal branch November 3, 2023 15:34
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.

None yet

2 participants