Skip to content
Reference
On this page
  1. Responsibility boundary
  2. Shipped deploy/ templates
  3. Health checks and Prometheus metrics
  4. Zero-downtime configuration reload
  5. Graceful shutdown, soak verification, and SBOM
  6. Next

Operations & deploy

Production operational guide for running arks serve behind a TLS reverse proxy, monitoring health and metrics, reloading configuration without downtime, and backing up repositories.

Responsibility boundary

arks serve Self-Hosted Forge Production Topology

Layer Owner
Git Smart HTTP, SSH, LFS, SSR Web UI, REST API, PBKDF2/2FA/RBAC, audit logs, /healthz, /metrics arks serve (single binary)
Firewall rules, DNS, external TLS certificates (ACME), reverse-proxy routing, off-host backup retention Operator infrastructure

Prefer normative ports (22 / 80 / 443 / 9418) in production; 2222 / 8080 are demo defaults. See Ports.

Shipped deploy/ templates

The repository includes ready-to-adapt operational templates under deploy/:

File Purpose
Dockerfile Multi-stage source container build for arks serve
deploy/Dockerfile.release Prebuilt multi-arch runtime container image (ubuntu:24.04, non-root arks user)
deploy/docker-compose.yml Containerized arks serve --root stack with persistent volume
deploy/Caddyfile Automatic HTTPS reverse proxy with HSTS and base_path support
deploy/nginx.conf nginx reverse proxy with streaming Git/LFS body handling
deploy/systemd/arks-serve.service Hardened Linux systemd unit with graceful shutdown
deploy/backup-restore.sh Consistent repository and forge metadata backup/restore script

Prebuilt multi-arch server images (linux/amd64, linux/arm64, non-root arks user, build-provenance attested) publish directly to GHCR on v* releases:

docker pull ghcr.io/modootoday/arks:latest

Health checks and Prometheus metrics

# Liveness probe:
curl -fsS http://127.0.0.1:8080/healthz

# Prometheus scrape endpoint:
curl -fsS http://127.0.0.1:8080/metrics

Configure Prometheus to scrape /metrics on your internal interface only, and route /healthz to your load balancer or systemd watchdog.

Zero-downtime configuration reload

arks serve supports dual-bind overlap across HTTP, SSH, and forge modules when reloading configuration managed by arks serve config:

# Inspect or update server configuration:
arks serve config show

# Trigger zero-downtime reload on Unix (SIGHUP):
kill -HUP "$(pidof arks)"

On Windows (where SIGHUP is unavailable), arks serve monitors the config file modification time and rebinds automatically (verified in Windows CI).

Graceful shutdown, soak verification, and SBOM

  • Sends clean shutdown draining active connections on SIGTERM / SIGINT.
  • Protects memory and concurrency with pre-spawn connection capping (503 Service Unavailable + Retry-After: 1), bounded HTTP/1.1 Keep-Alive (up to 64 requests/connection, 5s idle read timeout), request & gzip decompression body caps (413 Payload Too Large), and login rate limits (429).
  • Accelerates concurrent reads with an (mtime, len)-validated in-memory RwLock cache holding shared Arc<ForgeStore> snapshots (zero deep-clone on reads, lock-free GET REST/Web UI dispatch, direct JSON streaming, TCP_NODELAY, and single-buffer HTTP response writes; verified under 256 concurrent reads + 16 interleaved writes and 5-minute mixed endurance soak with 0.0 kB RSS growth and p95: 1.52ms → 1.18ms; Round 1 receipt · final stress receipt).
  • Control self-hosted registration and audit retention via ARKS_DISABLE_REGISTRATION=1, ARKS_DEFAULT_REGISTER_ROLE, and ARKS_AUDIT_MAX_ENTRIES.
  • Crash-safe atomic persistence: All 68 Web UI write paths (ForgeStoreTx, 60-thread stress) plus arks-lease, loose objects, LFS uploads, credentials wallet, and authorized_keys use unique sibling atomic write-and-rename transactions (verified under 32-thread arks-lease/arks-object and 16-thread LFS contention; atomic store receipt · Round 2 receipt).
  • All-in-one soak, Keep-Alive soak, CVE-zero & SBOM: Clean-room Docker verification exercises arks serve with TLS, SSH, Web UI, and Git LFS under a 128-request all-in-one soak (fd_delta: 0, soak receipt) and a 256-request HTTP/1.1 Keep-Alive soak (fd_delta: 0, Round 2 receipt), backed by nightly clean-room regression, 0/135 OSV.dev CVE scanning, and CycloneDX SBOM generation (.github/workflows/nightly-cleanroom.yml).
  • Overload, 10k-monorepo, endurance soak & chaos hardening (6/6 PASS · 0 open findings): Cgroup-capped Docker runs (--cpus=1.5, --memory=512m) verified 5× concurrency backpressure (1,090/1,090 503 Retry-After: 1, atomic pre-spawn cap, fd_delta=0), Slowloris cumulative header-timeout eviction (ARKS_HTTP_HEADER_TIMEOUT_SECS, default 10s, 48/48 HTTP 408), a 340-client mixed Forge/Push/LFS/SSH storm (0 lost updates), 10,002-file monorepo cap (63.1 MiB peak RSS, diff --stat 0.91× Git), SIGKILL ×3 crash persistence (86/86, orphan_tmps=0), ENOSPC safe fail-closed, RLIMIT_NOFILE=128 transient EMFILE backoff survival, 10 live SIGHUP reloads (5,623/5,623 HTTP 200), and a 5-minute sustained mixed soak (46,898/46,898 HTTP 200, 1,308 Forge writes, 0 lost updates, 0.0 kB RSS growth, fd_delta=0). Full receipts and charts: Stress & resilience (final receipt).

Next

Stress & resilience Self-host Ports Forge security & auth REST API reference

Edit this page

Back to top