This is the architecture of our small cluster:
It creates two servers: web
where our application lives and accessories
where our dependencies like databases and caches live.
web
exposes ports 80, 22 and 443, while accessories
is not accessible from the outside. Root access is disabled on both machines and only the kamal
user can SSH into them.
Important
If you are copying this workflow, you should change the SSH keys in cloudinit/base.yaml
to your own.
It is defined on ssh_import_id
and imports the SSH keys from your GitHub account.
Both machines are CPX11
: 2 AMD vCPUs, 2 GB of RAM and 40 GB of SSD storage, running Ubuntu 22.04. See variables.tf
for more details and how to change them.
This setup will cost you around 10 EUR/month.
- Clone
- Create a file
terraform.tfvars
with your credentials, it will look like this:
hetzner_api_key = "your-api-key"
- Run
terraform init
- Run
terraform plan
(optional) - Run
terraform apply