Skip to content

Commit 4216061

Browse files
committed
docs: update Debian low-RAM notes and DNS hosts
1 parent 1bd7047 commit 4216061

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

docs/dns.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
## DNS
22

33
Manual for now (TODO: automate via DNS API):
4-
- Prod A records prod node IP (use current IP from Terraform outputs)
5-
- Test A records test node IP (use current IP from Terraform outputs)
4+
- Prod A records -> prod node IP (use current IP from Terraform outputs)
5+
- Test A records -> test node IP (use current IP from Terraform outputs)
66

77
Hosts:
8-
- Prod: `www.devsh.eu`, `blog.devsh.eu`, `kimai2.devsh.eu`, `monitoring.devsh.eu`, `flux-hook.devsh.eu`
9-
- Test: prefixed equivalents (`test.www.devsh.eu`, etc.) update to current test IP
8+
- Prod: `www.devsh.eu`, `blog.devsh.eu`, `kimai2.devsh.eu`, `monitoring.devsh.eu`, `oncall.devsh.eu`, `flux-hook.devsh.eu`, `k8s.devsh.eu`
9+
- Test: prefixed equivalents (`test.www.devsh.eu`, etc.) - update to current test IP
1010

1111
Certs:
12-
- Lets Encrypt HTTP-01 via cert-manager. Ensure DNS points correctly; allow a few minutes for propagation. Kimai cert is subject to LE rate limits if hammered; retry after window if needed. After DNS change you can force re-issue per cert: `k3s kubectl -n <ns> delete order,challenge -l acme.cert-manager.io/certificate-name=<cert_name>`.
12+
- Let's Encrypt HTTP-01 via cert-manager. Ensure DNS points correctly; allow a few minutes for propagation. Kimai cert is subject to LE rate limits if hammered; retry after window if needed. After DNS change you can force re-issue per cert: `k3s kubectl -n <ns> delete order,challenge -l acme.cert-manager.io/certificate-name=<cert_name>`.
1313

1414
Future: automate DNS updates via API (not yet wired).

docs/environments.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Environments & Branches
22

3-
- Branch cluster: `env/prod` prod, `env/test` test.
4-
- Workflow: commit to `env/test` validate in test fast-forward `env/prod` (see `docs/how-to-commit.md`).
3+
- Branch -> cluster: `env/prod` -> prod, `env/test` -> test.
4+
- Workflow: commit to `env/test` -> validate in test -> fast-forward `env/prod` (see `docs/how-to-commit.md`).
55
- WARNING: push to `env/prod` reconciles live prod; push to `env/test` reconciles test.
66

77
### Terraform workspace mapping

docs/getting-started.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Getting Started
22

3-
GitOps-first: manifests live in this repo, Flux syncs per branch (`env/prod`, `env/test`). Terraform only builds the node and bootstraps Flux; day2 is Git-only. (Branch details: `docs/environments.md`. Fast-forward rules: `docs/how-to-commit.md`.)
3+
GitOps-first: manifests live in this repo, Flux syncs per branch (`env/prod`, `env/test`). Terraform only builds the node and bootstraps Flux; day-2 is Git-only. (Branch details: `docs/environments.md`. Fast-forward rules: `docs/how-to-commit.md`.)
44
> Pushing to `env/prod` updates live prod. Pushing to `env/test` updates the test cluster.
55
66
### Prerequisites
@@ -10,15 +10,15 @@ GitOps-first: manifests live in this repo, Flux syncs per branch (`env/prod`, `e
1010
- SSH key (for k3s node)
1111

1212
### Age key
13-
- Private key file (e.g., `terraform/terra.agekey`) keep it securely, never commit.
13+
- Private key file (e.g., `terraform/terra.agekey`) - keep it securely, never commit.
1414
- Set per session:
1515
`cd terraform; $env:SOPS_AGE_KEY = Get-Content terra.agekey -Raw`
1616

1717
### Do not do this
1818
- Never commit private keys, PATs, webhook secrets, state files, `.terraform/`, or `*.agekey`.
1919
- Keep `.env` local only; rotate creds if it ever leaks.
2020
- SOPS-encrypted YAMLs are fine in git; only the public age key sits in `.sops.yaml`.
21-
- Provider test fixtures under `provider/` use dummy keys; scanners may flag themreview before whitelisting.
21+
- Provider test fixtures under `provider/` use dummy keys; scanners may flag them; review before whitelisting.
2222

2323
### Data volume unlock (LUKS)
2424
- Systemd service `ensure-data-mount.service` unlocks and mounts `/mnt/data` on every boot using `LUKS_KEY_URL` or bucket creds from `/etc/default/terra-data`.
@@ -35,7 +35,7 @@ SCW_SECRET_KEY=... # Scaleway secret key
3535
3636
# Terraform inputs
3737
TF_VAR_project_id=... # Scaleway project id
38-
TF_VAR_acme_email=notification@devsh.eu# Email for ACME/Lets Encrypt
38+
TF_VAR_acme_email=notification@devsh.eu# Email for ACME/Let's Encrypt
3939
TF_VAR_config_repo_url=https://github.com/Devsh-Graphics-Programming/TerraInfra # Git repo for manifests
4040
TF_VAR_config_repo_branch=env/prod # Git branch (env/prod or env/test)
4141
TF_VAR_config_repo_path=terraform/k8s # Path in repo with k8s manifests
@@ -50,11 +50,26 @@ TF_VAR_luks_key_secret_key=... # Object Storage secret key for LUKS key
5050
# TF_VAR_prevent_destroy_data_volume=true # Set true to block data volume destroy
5151
# TF_VAR_data_volume_snapshot_id= # Snapshot id to restore data volume
5252
# TF_VAR_sops_age_key= # Age private key (set in session, not in file)
53-
# TF_VAR_instance_image=debian_trixie # Scaleway image name/id (e.g., ubuntu_jammy, debian_trixie)
53+
# TF_VAR_instance_image=debian_trixie # Override instance image (default debian_trixie; e.g., ubuntu_jammy)
5454
# TF_VAR_allow_fresh_bootstrap=true # Allow formatting LUKS on a brand-new volume only
5555
```
5656
Reload per session: `cd terraform; . .\env.ps1`
5757

58+
### Low-RAM tuning (Debian default)
59+
When the instance image is Debian-like, bootstrap applies low-RAM tuning automatically (`LOWRAM_TUNE=auto`):
60+
- journald in memory only (Storage=volatile, RuntimeMaxUse=16M)
61+
- sysctl: swappiness=180 (when zram), vfs_cache_pressure=200, dirty_ratio=5, dirty_background_ratio=3, min_free_kbytes=65536
62+
- disable services: avahi-daemon, ModemManager, bluetooth, cups, packagekit, rsyslog
63+
- mask sleep/suspend targets
64+
- zram swap (zstd, 75% of RAM) + enable systemd-oomd
65+
- docker log driver local (10m x3) and purge snapd
66+
67+
Notes:
68+
- When zram is enabled, swapfile is disabled. To force a classic swapfile, set `LOWRAM_ZRAM_ENABLED=0`.
69+
- Swapfile settings still apply when zram is disabled: `SWAP_FILE`, `SWAP_SIZE_GB`, `SWAP_SWAPPINESS`.
70+
- To override tuning, add env vars in `terraform/cloud-init.yaml` before the bootstrap command:
71+
`LOWRAM_TUNE=0|1|auto`, `LOWRAM_ZRAM_ENABLED=0|1`, `LOWRAM_ZRAM_PERCENT=75`, `LOWRAM_ZRAM_ALGO=zstd`.
72+
5873
### First bootstrap (per environment)
5974
1) Set `.env` (prod) or override env vars (test).
6075
2) Set age key in session:
@@ -73,11 +88,11 @@ Reload per session: `cd terraform; . .\env.ps1`
7388
- `$env:TF_VAR_public_ip_address='<new_ip>'` (preferred)
7489
- or `$env:TF_VAR_public_ip_id='<ip_uuid>'`
7590
- Keep data volume protected (prod): `TF_VAR_prevent_destroy_data_volume=true`.
76-
- `terraform apply` the server stays up; Terraform detaches the old IP and attaches the new one in place.
91+
- `terraform apply` - the server stays up; Terraform detaches the old IP and attaches the new one in place.
7792
- Update DNS to the new IP (manual for now; see `docs/dns.md`), wait for propagation; cert-manager will renew automatically (respect LE rate limits). If you want to force re-issue after DNS cutover: `k3s kubectl -n <ns> delete order,challenge -l acme.cert-manager.io/certificate-name=<cert_name>`.
7893
- After confirming traffic on the new IP, delete the old Flexible IP in Scaleway.
7994

80-
### Certificates (Lets Encrypt)
95+
### Certificates (Let's Encrypt)
8196
- Check status: `k3s kubectl get certificate -A` and `k3s kubectl get orders.acme.cert-manager.io -A`.
8297
- LE rate limits apply to all hosts; if you see `order ... errored ... too many certificates ... retry after ...`, wait until the indicated time; cert-manager will retry automatically.
8398
- Force renew all certs after DNS/IP change (from the node):

0 commit comments

Comments
 (0)