Skip to content

Latest commit

 

History

History
59 lines (45 loc) · 1.85 KB

DEPLOYMENT.md

File metadata and controls

59 lines (45 loc) · 1.85 KB

Deployment

Whilst I would have loved to have the complete infrastructure run on Terraform, the Fly provider isn't mature enough to allow that. Actually, I chose not to use it at all.

Hence, there are three parts to this deployment guide: one on Fly, another one on Terraform - for the AWS part - and a last for the communication between the two firsts.

Before getting started, make sure that both flyctl and terraform are installed and working properly.

Create and configure a Fly app

Everything on Fly can be done using the flyctl command. The instructions will be listed, with the corresponding command below each. All instructions can be done through the web interface.

  1. Create a Fly app.
fly apps create <app_name>
  1. Create a PostgreSQL database
fly postgres create <db_name>
  1. Attach the database to the application
fly postgres attach <db_name>
  1. Add a certificate
fly certs add <app_hostname>
  1. Add the IP v4 and v6 of the app and CNAME record to Terraform config. Those can be found on the application dashbaord, on the page of the certificate that was just created. You will need the "CNAME" record name and value, and the A and AAAA records value. Put them in the corresponding variables in a newly created terraform.tfvars file. The name of the variables can be found in variables.tf.

Configure and launch Terraform

TODO Write this part, I can't remember what to do here right now😓

Deploy the application

Before deploying the application for good, the secrets must be set. Use the command fly secrets set <secret_name> <secret_value> to do that. The secrets are environment variables used in config/runtime.exs, check them out there. Note that DATABASE_URL was automatically set when attaching the database.