10 KiB
Enterprise Deployment Architecture
Archie runs as a single static binary (cmd/archie) backed by PostgreSQL. Regulated deployments isolate each stage, separate DDL from DML credentials, split external webhook ingress from internal operator access, and enforce strict pod or container boundaries.
Multi-Stage Isolation Zones
Deploy Archie into three independent stages: dev, staging, and prod. Each stage runs its own Archie instance and shares no runtime state with any other stage.
| Resource | dev |
staging |
prod |
|---|---|---|---|
| Kubernetes namespace or host | archie-dev |
archie-staging |
archie-prod |
| PostgreSQL database | Isolated dev instance | Isolated staging instance | Managed HA PostgreSQL (sslmode=verify-full) |
age sealing key |
Stage-local age_identity |
Stage-local age_identity |
Stage-local age_identity with offline age_backup_recipients |
| OIDC client | Non-prod IdP client | Staging IdP client | Production IdP confidential client |
| Earned autonomy | Local to dev |
Local to staging |
Built independently in prod |
| Helm overlay | values-dev.yaml |
values-staging.yaml |
values-prod.yaml |
Earned autonomy in staging never promotes to prod. Promote declarative configuration (workflows, Cedar policies, judgement rules, and action-type metadata) with archie bundle. Keep credentials, OIDC bindings, target hosts, and autonomy counters local to each stage.
Pin container images by immutable SHA-256 digest (image.digest in Helm) and verify cosign signatures before deploying to staging and prod. Set [catalogue] disable_auto_update = true and mirror signed extension catalogues internally in air-gapped stages.
Stage Promotion Models
Choose one of two promotion workflows depending on your delivery pipeline:
- Push CI/CD (GitHub Actions, GitLab CI, or Jenkins):
- On pull requests, run
archie bundle validateoffline to check workflow YAML, Cedar policy syntax, judgement rules, and stageBindingswithout database access. - Export the tested bundle from
stagingand record its canonical SHA-256 digest (Bundle.Digest()). - After manual change approval, the
prodpipeline runsarchie bundle apply --expect-digest <sha256>over HTTPS usingARCHIE_URLandARCHIE_TOKEN_FILE. The CI runner never touches PostgreSQL directly.
- On pull requests, run
- Pull GitOps (Argo CD or Flux):
- Store the stage Helm values (
values-staging.yaml,values-prod.yaml),bundle.yaml, and stage-localbindings.yamlin Git. - Enable
bundleSync.enabled: trueindeployments/helm/archieto runtemplates/job-bundle-sync.yamlas an Argo CDPostSyncor Helmpost-install,post-upgradeJob. - The Job mounts the bundle
ConfigMap, uses only the runtimearchie_appdatabase secret (ARCHIE_DATABASE_URL_FILE), and applies unchanged bundles idempotently with optionalexpectDigestverification.
- Store the stage Helm values (
Split Ingress and Network Boundaries
Separate external webhook delivery from operator and administrator access using two ingress resources (deployments/helm/archie/templates/ingress.yaml):
- Perimeter webhook ingress (
ingress.perimeter): Expose only webhook intake paths (/hooks/forcmd/archieintake and/webhooks/where routed by a reverse proxy). Terminate TLS at the edge and apply rate limits. Theeventsmodule verifies each payload's HMAC signature before parsing JSON (modules/events/verify.go). - Internal operator ingress (
ingress.internal): Serve the Dashboard,/api/, and OIDC routes behind a corporate VPN or internal load balancer. Never expose/api/or the setup surface on the perimeter ingress.
Enforce default-deny NetworkPolicy rules (deployments/helm/archie/templates/networkpolicy.yaml) in staging and prod. Permit ingress only from the perimeter ingress controller (port 8080), internal ingress controller (port 8080), and Prometheus scraper (port 9090 on /metrics). Permit egress only to DNS (53), PostgreSQL or PgBouncer (5432), the OIDC issuer (443), configured remote extension endpoints, the corporate proxy (HTTPS_PROXY), and the OpenTelemetry collector (4317).
Database Role Split and PgBouncer Session Pooling
Archie separates schema ownership from runtime operations across two PostgreSQL roles:
archie_owner(ARCHIE_DATABASE_OWNER_URL_FILE): Holds DDL rights. Used only byarchie migrateinside the Helm pre-install/pre-upgradeJob(job-migrate.yaml) or the Composearchie-migrateinit service (deployments/archie/compose.enterprise.yml).archie_app(ARCHIE_DATABASE_URL_FILE): Holds onlyUSAGEand DML privileges (SELECT,INSERT,UPDATE,DELETE, andSELECTonpublic.goose_db_version). The runtimeStatefulSetand Composearchieservice mount only this credential. At startup,pg.VerifySchema(internal/platform/pg/pg.go) checks that every embedded migration is applied and fails closed if the schema lags behind.
PgBouncer Session-Pooling Requirement for ClaimServe
At boot, cmd/archie calls pg.ClaimServe (internal/platform/pg/pg.go). ClaimServe opens a dedicated connection via db.Conn(ctx) and acquires a shared PostgreSQL session advisory lock (pg_try_advisory_lock_shared(hashtextextended('archie.serve.owner', 0))). It holds that lock for the entire lifetime of the serving process. A database restore takes the same key exclusively so no serving pod can start or run during a restore window.
If you deploy PgBouncer in front of PostgreSQL, configure pool_mode = session for Archie's runtime pool. PgBouncer transaction and statement pooling modes share server backends across clients and release or drop session advisory locks between transactions. Direct connections to the HA PostgreSQL primary also satisfy this requirement.
Pod Security and Extension Confinement
Extension execution differs between Kubernetes and Docker Compose because Kubernetes restricted Pod Security Standards forbid user namespaces.
| Control | Kubernetes (deployments/helm/archie) |
Hardened Compose (deployments/archie/compose.enterprise.yml) |
|---|---|---|
| User and root filesystem | runAsNonRoot: true, UID/GID 65532, read-only root filesystem, allowPrivilegeEscalation: false, capabilities.drop: [ALL] |
user: "65532:65532", read_only: true, tmpfs: /tmp, cap_drop: [ALL], no-new-privileges:true |
| Seccomp profile | seccompProfile.type: RuntimeDefault |
deployments/archie/seccomp.json (Docker default plus clone for namespaces) |
| Extension runtime | RemoteGRPCRuntime over mTLS or Unix socket (require_remote = true) |
LocalNamespaceRuntime (CLONE_NEWUSER and CLONE_NEWNET) |
| Egress proxy and PKI | HTTPS_PROXY, NO_PROXY, and SSL_CERT_FILE propagated to runtime and NetworkPolicy |
HTTPS_PROXY, NO_PROXY, and SSL_CERT_FILE propagated into confined namespaces |
In Kubernetes, run extensions as separate Pods or sidecars under restricted Pod Security Standards and isolate them with NetworkPolicy. Configure [extensions] in config.toml (templates/configmap.yaml) with require_remote = true, TLS 1.3 mTLS certificates (ca_file, cert_file, key_file), and explicit [extensions.remote.<name>] targets. If neither RemoteGRPCRuntime nor LocalNamespaceRuntime is available, modules/connectors/internal/host/remote.go fails closed.
In Docker Compose and VM hosts, LocalNamespaceRuntime confines each extension binary in its own user and network namespace behind an allow-list forward proxy (modules/connectors/internal/egress/tunnel.go). The tunnel enforces Archie's host allow-list and loopback checks before chaining allowed traffic through HTTPS_PROXY.
OpenShift restricted-v2 SCC
OpenShift's default restricted-v2 security context rejects pinned runAsUser, runAsGroup, and fsGroup values because it assigns UIDs per namespace. Add values-openshift.yaml alongside values-prod.yaml to omit those numeric IDs while keeping runAsNonRoot: true, allowPrivilegeEscalation: false, and a read-only root filesystem.
Private OCI and Air-Gapped Catalogues
Private OCI registries authenticate through [catalogue] in config.toml or container environment variables:
- Docker config file: Set
catalogue.auth_file(ARCHIE_CATALOGUE_AUTH_FILE) or setconfig.catalogue.authSecretin Helm to mount a registryconfig.jsonSecret. - Direct credentials: Set
catalogue.usernameandcatalogue.passwordviaARCHIE_CATALOGUE_USERNAMEandARCHIE_CATALOGUE_PASSWORD_FILE.
In air-gapped stages, mirror a verified catalogue to local storage and re-sign it with an internal Ed25519 key:
- Generate an internal signing keypair with
archie catalogue keygen. - Download, verify, and re-sign the catalogue and binaries with
archie catalogue mirror -to /var/lib/archie/mirror -sign-key-file /etc/archie/mirror.key. - Transfer the mirror directory into the isolated environment and point
[catalogue]locationandpublic_keyat the mirroredcatalogue.jsonand internal public key.
Probes, Graceful Drain, and High Availability
cmd/archie exposes three health endpoints (internal/platform/health/health.go):
/healthz: Liveness probe. Returns200while the HTTP server process is alive./startupz: Startup probe. Verifies database connectivity and confirms the deletion ledger is consistent before Kubernetes routes traffic or triggers liveness checks./readyz: Readiness probe. Requires/startupzchecks plus completion of owner setup (gate.go), and returns503as soon asSIGTERMbegins draining.
Set terminationGracePeriodSeconds (45 seconds in values-prod.yaml) higher than shutdown_grace (30s) so in-flight HTTP requests and run checkpoints finish before SIGKILL.
Enterprise v1 runs Active-Passive HA with replicaCount: 1 on a StatefulSet backed by a ReadWriteOnce PVC for state_dir. Never scale replicaCount above 1 in v1 without shared state_dir storage and v2 Active-Active coordination (LISTEN/NOTIFY hub, lease election, and object-lock deletion ledger).