Skip to content

Add deploy/ scaffold for reproducible server bootstrap #7

Merged
muhammetselimfe merged 2 commits into
mainfrom
dev
May 27, 2026
Merged

Add deploy/ scaffold for reproducible server bootstrap #7
muhammetselimfe merged 2 commits into
mainfrom
dev

Conversation

@muhammetselimfe
Copy link
Copy Markdown
Collaborator

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 + remember
everything" 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 with 127.0.0.1: port binds and bind-mounted users.d so the password survives container recreation
  • clickhouse/ — sha256 default-user template + the read-only anonymous users SQL
  • nginx/api.conf — reverse-proxy vhost with X-Forwarded-For (the bit we had to add manually mid-session)
  • systemd/icicle-api and icicle-indexer units with EnvironmentFile for secrets and memory caps
  • iptables/rules.v4 — default-deny firewall plus defense-in-depth PREROUTING drops on CH ports
  • setup.sh — idempotent installer that wires it together
  • README.md — runbook, verification checklist, password rotation procedure

What's NOT included (deliberately)

  • avalanchego — assumed external or already installed
  • Observability (Prometheus / Grafana / Loki) — operator concern, not customer
  • ClickHouse data backups — biggest remaining gap, separate work item

Public-repo safety

Audited before push:

  • No real domains, IPs, usernames, or secrets — all __PLACEHOLDER__ or $ENV_VAR
  • deploy/.env is gitignored via the existing *.env rule (verified with git check-ignore)
  • bash -n setup.sh syntax check passes

Test plan

  • Spin up a fresh Ubuntu 24.04 VM (Hetzner, vagrant, whatever)
  • git clone this branch, cd deploy, fill in .env, run setup.sh
  • Follow the 4 manual steps from the script output
  • Run the verification checklist at the bottom of deploy/README.md — every box should tick

muhammetselimfe and others added 2 commits May 27, 2026 18:26
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>
@muhammetselimfe muhammetselimfe merged commit 589c156 into main May 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant