Add deploy/ scaffold for reproducible server bootstrap #7
Merged
Conversation
Previously .gitignore blanket-ignored the entire deploy/ directory. With deploy/ scaffold landing as version-controlled infra-as-code, only the per-server secrets file should stay out of git — the existing *.env pattern already covers deploy/.env. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Captures the manual server hardening we did over the past two days as version-controlled infra-as-code. Bootstrapping a fresh indexer server now takes ~20 minutes from clone to running, with no remembered steps. Includes: - docker-compose.yml — ClickHouse with 127.0.0.1-only ports and bind-mounted users.d so the password survives container recreation - clickhouse/users.d/default-user.xml.template — sha256-hashed default user - clickhouse/access-setup.sql — read-only anonymous users for frontends - nginx/api.conf — reverse proxy with X-Forwarded-For wiring - systemd/icicle-api.service, icicle-indexer.service — units with memory caps and EnvironmentFile for secrets - iptables/rules.v4 — default-deny firewall plus defense-in-depth PREROUTING drops for CH ports - setup.sh — idempotent installer that wires all of the above together - README.md — runbook, verification checklist, and rotation procedures No real domains, IPs, usernames, or secrets in the templates — all placeholders rendered from .env at install time. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Captures all the manual server hardening from the past two days (CH password rotation, loopback-only ports, default-deny firewall, nginx X-Forwarded-For
wiring, systemd memory caps, IP logging) as version-controlled infra-as-code under
deploy/. New server bootstrap goes from "follow a wiki + remembereverything" to:
git clone && cd icicle/deploy
cp .env.example .env && nano .env
./setup.sh
Then 4 documented manual steps (clone src + build, apply CH access SQL, certbot, enable services).
This is the foundation for the upcoming indexer-as-a-service product — each customer server gets identical, auditable config.
What's included
docker-compose.yml— ClickHouse with127.0.0.1:port binds and bind-mountedusers.dso the password survives container recreationclickhouse/— sha256 default-user template + the read-only anonymous users SQLnginx/api.conf— reverse-proxy vhost withX-Forwarded-For(the bit we had to add manually mid-session)systemd/—icicle-apiandicicle-indexerunits withEnvironmentFilefor secrets and memory capsiptables/rules.v4— default-deny firewall plus defense-in-depth PREROUTING drops on CH portssetup.sh— idempotent installer that wires it togetherREADME.md— runbook, verification checklist, password rotation procedureWhat's NOT included (deliberately)
Public-repo safety
Audited before push:
__PLACEHOLDER__or$ENV_VARdeploy/.envis gitignored via the existing*.envrule (verified withgit check-ignore)bash -n setup.shsyntax check passesTest plan
git clonethis branch,cd deploy, fill in.env, runsetup.shdeploy/README.md— every box should tick