Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luizkowalski/terraform-hetzner
Set up two (or more) servers on Hetzner Cloud
https://github.com/luizkowalski/terraform-hetzner
hetzner-cloud kamal terraform
Last synced: 6 days ago
JSON representation
Set up two (or more) servers on Hetzner Cloud
- Host: GitHub
- URL: https://github.com/luizkowalski/terraform-hetzner
- Owner: luizkowalski
- Created: 2024-01-21T14:29:26.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-09-21T19:08:20.000Z (about 2 months ago)
- Last Synced: 2024-10-23T08:34:03.517Z (15 days ago)
- Topics: hetzner-cloud, kamal, terraform
- Language: HCL
- Homepage: https://www.luizkowalski.net/production-grade-ish-deployment-on-hetzner-with-kamal/
- Size: 186 KB
- Stars: 41
- Watchers: 1
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Production-Grade (ish) server orchestration with Kamal
This is the architecture of our small cluster:
![Architecture](arch.png)
### Architecture
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.You can create more servers by updating `web_servers_count` or `accessories_count` in `variables.tf`. If there is more than one web server, a load balancer will be created and all the web servers will be added to it.
In case multiple servers of different types are created, the naming will be `web-1`, `web-2`, `accessories-1`, and `accessories-2`, as opposed to `web`, `accessories`, the default naming convention.
> [!IMPORTANT]
> If you are copying this workflow, you should change the SSH keys in `cloudinit/base.yml` to your own.
> It is defined on `ssh_import_id` and imports the SSH keys from your GitHub account.### Connecting to the servers
After running `terraform apply`, the script will output an SSH configuration that can be copied to your `~/.ssh/config` file. This is to help you connect to servers since accessory servers are not accessible from the outside, you need to use the web server as a jump host. It looks like this:
```ssh-config
ssh_01_web_config = <