feat: Added multiple SSH Key uploads
This commit is contained in:
@@ -68,9 +68,9 @@ architecture-beta
|
||||
.
|
||||
├── infra/ # OpenTofu (Terraform-compatible) config — provisions the 3 servers, network, firewalls, volumes
|
||||
│ ├── main.tf # root module: wires network + dev/prod/vpn modules together
|
||||
│ ├── variables.tf # shared inputs (sizes, locations, IP ranges, SSH key name)
|
||||
│ ├── variables.tf # shared inputs (sizes, locations, IP ranges, SSH key names)
|
||||
│ ├── outputs.tf # pass-through outputs from each host module
|
||||
│ ├── ssh.tf # looks up the SSH key already uploaded to Hetzner Cloud
|
||||
│ ├── ssh.tf # looks up each SSH key already uploaded to Hetzner Cloud
|
||||
│ ├── versions.tf # provider requirements
|
||||
│ ├── terraform.tfvars.example
|
||||
│ ├── scripts/
|
||||
@@ -98,7 +98,7 @@ Each of `services/dev`, `services/prod`, `services/vpn` follows the same convent
|
||||
## Prerequisites
|
||||
|
||||
- A [Hetzner Cloud](https://console.hetzner.cloud/) project and API token
|
||||
- An SSH key uploaded to that project (Console → Security → SSH Keys), and the matching private key available locally (OpenTofu uses it once per server to run the post-install bootstrap — see below)
|
||||
- One or more SSH keys uploaded to that project (Console → Security → SSH Keys) - all are installed on every server - plus the private key matching one of them available locally (OpenTofu uses it once per server to run the post-install bootstrap — see below)
|
||||
- [OpenTofu](https://opentofu.org/docs/intro/install/) `>= 1.6.0`
|
||||
- DNS records for the domains in [Service inventory](#service-inventory) pointed at the relevant server's public IP
|
||||
|
||||
@@ -110,7 +110,7 @@ Docker + the Compose plugin no longer need installing by hand — the bootstrap
|
||||
cd infra
|
||||
export HCLOUD_TOKEN=your-hetzner-api-token # never commit this
|
||||
cp terraform.tfvars.example terraform.tfvars
|
||||
$EDITOR terraform.tfvars # set ssh_key_name and ssh_private_key_path at minimum
|
||||
$EDITOR terraform.tfvars # set ssh_key_names and ssh_private_key_path at minimum
|
||||
|
||||
tofu init
|
||||
tofu plan
|
||||
@@ -131,7 +131,7 @@ Useful outputs: `tofu output dev_ipv4`, `tofu output prod_ipv4`, `tofu output vp
|
||||
Immediately after each `hcloud_server` is created, OpenTofu uploads and runs [`infra/scripts/bootstrap.sh.tftpl`](infra/scripts/bootstrap.sh.tftpl) over SSH as `root` (`connection` + `file`/`remote-exec` provisioners in each `modules/<host>/main.tf`). It:
|
||||
|
||||
- installs Docker Engine + the Compose plugin
|
||||
- creates a non-root sudo user (`var.deploy_user`, default `deploy`) with the same SSH key as root, in the `sudo` and `docker` groups
|
||||
- creates a non-root sudo user (`var.deploy_user`, default `deploy`) with the same SSH keys as root, in the `sudo` and `docker` groups
|
||||
- hardens `sshd`: password authentication off, root login restricted to key-only (`PermitRootLogin prohibit-password`)
|
||||
- installs and enables `unattended-upgrades` for automatic security patches
|
||||
|
||||
|
||||
Reference in New Issue
Block a user