cedarcode / webauthn-rails-demo-app

Rails app demonstrating a WebAuthn password-less login
https://webauthn.cedarcode.com
Apache License 2.0
97 stars 39 forks source link

Deploy using Kamal #145

Open santiagorodriguez96 opened 3 months ago

santiagorodriguez96 commented 3 months ago

Motivation

This PR configures kamal so that we can start using it for deploying to our AWS servers.

Details

You will need an .env file with these secrets SECRET_KEY_BASE 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
  2. Add any authorized keys for people that need to connect with ssh
  3. 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
  4. Enable HTTPS (443) incoming traffic in web instance
  5. Enable ports 5432 for incoming traffic in DB instance
  6. Run kamal setup

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