deploy: harden cloud-init with archon user, swap, and fixes#981
Conversation
- Create dedicated 'archon' user (sudo + docker groups, passwordless sudo, locked password) and copy SSH authorized_keys from default cloud user (with root fallback) so login works immediately. - Run docker pulls and the image build as the archon user via sudo -u. - Add 2GB swapfile to prevent OOM during docker build on small VPS (<2GB RAM). - Remove package_upgrade to speed up boot and avoid surprise kernel updates. - Drop redundant systemctl enable/start docker (get.docker.com handles it). - ufw allow 443/tcp for consistency with 22/80. - set -e before clone for fail-fast on network errors. - Update docs link to https://archon.diy/deployment/docker/. - SETUP_COMPLETE now instructs ssh archon@<server-ip>. - Header lists supported providers (incl. Hostinger) and notes the archon user + swap behavior.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded a dedicated Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
deploy/cloud-init.yml (1)
84-85: Consider adding 443/udp for HTTP/3 support.The docker-compose.yml exposes
443:443/udpfor Caddy's HTTP/3 (QUIC) support, but the firewall only allows TCP. Without UDP, HTTP/3 won't work (HTTP/2 over TCP will still function).Proposed fix
- ufw allow 443/tcp + - ufw allow 443/udp - ufw --force enable🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@deploy/cloud-init.yml` around lines 84 - 85, The firewall rules only open TCP port 443 (ufw allow 443/tcp) so QUIC/HTTP3 (which uses UDP) will be blocked; update the cloud-init UFW commands to also allow UDP by adding an explicit "ufw allow 443/udp" (or replace the TCP-only rule with a dual-protocol rule) before the "ufw --force enable" call so the docker-compose mapping 443:443/udp for Caddy can receive UDP traffic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@deploy/cloud-init.yml`:
- Around line 87-92: The current cloud-init runcmd uses a standalone "set -e"
which runs in its own shell and doesn't make the following git clone/cp/chown
commands fail-fast; merge the related commands into a single shell invocation so
"set -e" applies to them—e.g., replace the separate "set -e" plus the individual
commands (git clone, cp /opt/archon/.env.example, cp
/opt/archon/Caddyfile.example, chown -R archon:archon) with one script block or
a single shell command list so failures in git clone or any cp/chown abort the
sequence.
- Around line 40-47: Remove the nonexistent "docker" group from the initial
users block for the "archon" user: edit the users entry that defines name:
archon (the block with gecos: Archon Service User, groups: [...], shell:, sudo:,
lock_passwd:) and delete "docker" from its groups list so the user is created
only with existing groups; leave the subsequent Docker addition via the
usrmomod/usermod -aG docker archon step intact.
---
Nitpick comments:
In `@deploy/cloud-init.yml`:
- Around line 84-85: The firewall rules only open TCP port 443 (ufw allow
443/tcp) so QUIC/HTTP3 (which uses UDP) will be blocked; update the cloud-init
UFW commands to also allow UDP by adding an explicit "ufw allow 443/udp" (or
replace the TCP-only rule with a dual-protocol rule) before the "ufw --force
enable" call so the docker-compose mapping 443:443/udp for Caddy can receive UDP
traffic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
|
Thanks for this — the swap file fix is a real catch, that 1. 2. Removing 3. Verification? The test plan has 7 unchecked boxes. For a cloud-init that runs directly on strangers' production VPS instances, I'd feel much better merging after one real end-to-end boot on one real provider (Hetzner $5/mo instance is ~20 minutes of effort). If you've already tested and just didn't check the boxes, please confirm — that's fine too. Everything else — swap file, SSH key copy, |
- Fix set -e regression: merge clone/cp/chown into single shell block so fail-fast actually applies (CodeRabbit). - Drop passwordless sudo from archon user — docker group only. Removes trivial privilege escalation path (Wirasm). - Remove non-existent 'docker' group from initial users.groups list; it is added via usermod later (CodeRabbit). - Restore package_upgrade: true to patch CVEs in the base image before anything else runs (Wirasm). - Add ufw allow 443/udp for HTTP/3 QUIC — Caddy exposes 443:443/udp in docker-compose (CodeRabbit). - Update SETUP_COMPLETE and header comment to note archon user has no sudo (use default cloud user / root for maintenance).
* deploy: harden cloud-init with archon user, swap, and fixes - Create dedicated 'archon' user (sudo + docker groups, passwordless sudo, locked password) and copy SSH authorized_keys from default cloud user (with root fallback) so login works immediately. - Run docker pulls and the image build as the archon user via sudo -u. - Add 2GB swapfile to prevent OOM during docker build on small VPS (<2GB RAM). - Remove package_upgrade to speed up boot and avoid surprise kernel updates. - Drop redundant systemctl enable/start docker (get.docker.com handles it). - ufw allow 443/tcp for consistency with 22/80. - set -e before clone for fail-fast on network errors. - Update docs link to https://archon.diy/deployment/docker/. - SETUP_COMPLETE now instructs ssh archon@<server-ip>. - Header lists supported providers (incl. Hostinger) and notes the archon user + swap behavior. * deploy: address PR review feedback on cloud-init - Fix set -e regression: merge clone/cp/chown into single shell block so fail-fast actually applies (CodeRabbit). - Drop passwordless sudo from archon user — docker group only. Removes trivial privilege escalation path (Wirasm). - Remove non-existent 'docker' group from initial users.groups list; it is added via usermod later (CodeRabbit). - Restore package_upgrade: true to patch CVEs in the base image before anything else runs (Wirasm). - Add ufw allow 443/udp for HTTP/3 QUIC — Caddy exposes 443:443/udp in docker-compose (CodeRabbit). - Update SETUP_COMPLETE and header comment to note archon user has no sudo (use default cloud user / root for maintenance).
…s-to-workspace refactor: move docs site to packages/docs-web as workspace member
…s-to-workspace refactor: move docs site to packages/docs-web as workspace member
…#981) * deploy: harden cloud-init with archon user, swap, and fixes - Create dedicated 'archon' user (sudo + docker groups, passwordless sudo, locked password) and copy SSH authorized_keys from default cloud user (with root fallback) so login works immediately. - Run docker pulls and the image build as the archon user via sudo -u. - Add 2GB swapfile to prevent OOM during docker build on small VPS (<2GB RAM). - Remove package_upgrade to speed up boot and avoid surprise kernel updates. - Drop redundant systemctl enable/start docker (get.docker.com handles it). - ufw allow 443/tcp for consistency with 22/80. - set -e before clone for fail-fast on network errors. - Update docs link to https://archon.diy/deployment/docker/. - SETUP_COMPLETE now instructs ssh archon@<server-ip>. - Header lists supported providers (incl. Hostinger) and notes the archon user + swap behavior. * deploy: address PR review feedback on cloud-init - Fix set -e regression: merge clone/cp/chown into single shell block so fail-fast actually applies (CodeRabbit). - Drop passwordless sudo from archon user — docker group only. Removes trivial privilege escalation path (Wirasm). - Remove non-existent 'docker' group from initial users.groups list; it is added via usermod later (CodeRabbit). - Restore package_upgrade: true to patch CVEs in the base image before anything else runs (Wirasm). - Add ufw allow 443/udp for HTTP/3 QUIC — Caddy exposes 443:443/udp in docker-compose (CodeRabbit). - Update SETUP_COMPLETE and header comment to note archon user has no sudo (use default cloud user / root for maintenance).
…oleam00#981)" This reverts commit 5375276.
…#981) * deploy: harden cloud-init with archon user, swap, and fixes - Create dedicated 'archon' user (sudo + docker groups, passwordless sudo, locked password) and copy SSH authorized_keys from default cloud user (with root fallback) so login works immediately. - Run docker pulls and the image build as the archon user via sudo -u. - Add 2GB swapfile to prevent OOM during docker build on small VPS (<2GB RAM). - Remove package_upgrade to speed up boot and avoid surprise kernel updates. - Drop redundant systemctl enable/start docker (get.docker.com handles it). - ufw allow 443/tcp for consistency with 22/80. - set -e before clone for fail-fast on network errors. - Update docs link to https://archon.diy/deployment/docker/. - SETUP_COMPLETE now instructs ssh archon@<server-ip>. - Header lists supported providers (incl. Hostinger) and notes the archon user + swap behavior. * deploy: address PR review feedback on cloud-init - Fix set -e regression: merge clone/cp/chown into single shell block so fail-fast actually applies (CodeRabbit). - Drop passwordless sudo from archon user — docker group only. Removes trivial privilege escalation path (Wirasm). - Remove non-existent 'docker' group from initial users.groups list; it is added via usermod later (CodeRabbit). - Restore package_upgrade: true to patch CVEs in the base image before anything else runs (Wirasm). - Add ufw allow 443/udp for HTTP/3 QUIC — Caddy exposes 443:443/udp in docker-compose (CodeRabbit). - Update SETUP_COMPLETE and header comment to note archon user has no sudo (use default cloud user / root for maintenance).
…s-to-workspace refactor: move docs site to packages/docs-web as workspace member
…#981) * deploy: harden cloud-init with archon user, swap, and fixes - Create dedicated 'archon' user (sudo + docker groups, passwordless sudo, locked password) and copy SSH authorized_keys from default cloud user (with root fallback) so login works immediately. - Run docker pulls and the image build as the archon user via sudo -u. - Add 2GB swapfile to prevent OOM during docker build on small VPS (<2GB RAM). - Remove package_upgrade to speed up boot and avoid surprise kernel updates. - Drop redundant systemctl enable/start docker (get.docker.com handles it). - ufw allow 443/tcp for consistency with 22/80. - set -e before clone for fail-fast on network errors. - Update docs link to https://archon.diy/deployment/docker/. - SETUP_COMPLETE now instructs ssh archon@<server-ip>. - Header lists supported providers (incl. Hostinger) and notes the archon user + swap behavior. * deploy: address PR review feedback on cloud-init - Fix set -e regression: merge clone/cp/chown into single shell block so fail-fast actually applies (CodeRabbit). - Drop passwordless sudo from archon user — docker group only. Removes trivial privilege escalation path (Wirasm). - Remove non-existent 'docker' group from initial users.groups list; it is added via usermod later (CodeRabbit). - Restore package_upgrade: true to patch CVEs in the base image before anything else runs (Wirasm). - Add ufw allow 443/udp for HTTP/3 QUIC — Caddy exposes 443:443/udp in docker-compose (CodeRabbit). - Update SETUP_COMPLETE and header comment to note archon user has no sudo (use default cloud user / root for maintenance).
…oleam00#981)" This reverts commit c2ae8ec.
…#981) * deploy: harden cloud-init with archon user, swap, and fixes - Create dedicated 'archon' user (sudo + docker groups, passwordless sudo, locked password) and copy SSH authorized_keys from default cloud user (with root fallback) so login works immediately. - Run docker pulls and the image build as the archon user via sudo -u. - Add 2GB swapfile to prevent OOM during docker build on small VPS (<2GB RAM). - Remove package_upgrade to speed up boot and avoid surprise kernel updates. - Drop redundant systemctl enable/start docker (get.docker.com handles it). - ufw allow 443/tcp for consistency with 22/80. - set -e before clone for fail-fast on network errors. - Update docs link to https://archon.diy/deployment/docker/. - SETUP_COMPLETE now instructs ssh archon@<server-ip>. - Header lists supported providers (incl. Hostinger) and notes the archon user + swap behavior. * deploy: address PR review feedback on cloud-init - Fix set -e regression: merge clone/cp/chown into single shell block so fail-fast actually applies (CodeRabbit). - Drop passwordless sudo from archon user — docker group only. Removes trivial privilege escalation path (Wirasm). - Remove non-existent 'docker' group from initial users.groups list; it is added via usermod later (CodeRabbit). - Restore package_upgrade: true to patch CVEs in the base image before anything else runs (Wirasm). - Add ufw allow 443/udp for HTTP/3 QUIC — Caddy exposes 443:443/udp in docker-compose (CodeRabbit). - Update SETUP_COMPLETE and header comment to note archon user has no sudo (use default cloud user / root for maintenance).
Summary
archonuser (docker group) and runs all docker operations as that user instead of rootdocker compose buildon small VPS (<2GB RAM)Changes
users:block, docker-group only (no sudo — avoids trivial privilege escalation). SSH keys copied from default cloud user (root fallback)./opt/archonchowned, builds run viasudo -u archon./etc/fstab.package_upgrade: trueretained — applies security patches to base image before anything else.systemctl enable/start docker(get.docker.com handles it).ufw allow 443/tcp+443/udp— 443/udp needed for HTTP/3 (QUIC) via Caddy.set -ein single shell block before clone — real fail-fast on network errors (fixed review feedback).ssh archon@<server-ip>and notes archon has no sudo (use default cloud user for maintenance).Test plan
ssh archon@<ip>works after ~5-8 minid archonshows membership indockergroup (no sudo)swapon --showshows 2GB swap active/opt/archonowned byarchon:archondocker images(as archon) shows the built archon imageufw statusshows 22/80/443 allowed (tcp + udp for 443)Review feedback addressed
set -emerged into single shell block so fail-fast appliesdockerfrom initialusers.groups(added later viausermod)ufw allow 443/udpfor HTTP/3package_upgrade: trueto patch CVEs in base imageSummary by CodeRabbit
Infrastructure & Deployment
Documentation