| 1 | # Dogfood — deployment. |
| 2 | # |
| 3 | # Deviations from spec §10, both forced by the environment: |
| 4 | # |
| 5 | # * No `postgres` service. The database is the externally provided instance in |
| 6 | # .env (PostgreSQL 17 behind a TLS proxy on :6543). |
| 7 | # * No `caddy` service. TLS and routing are already handled by the existing |
| 8 | # caddy-proxy-manager edge (compose project `edge`), which owns :80/:443 on |
| 9 | # this host. Dogfood joins its network and the edge proxies to it by |
| 10 | # container name. |
| 11 | |
| 12 | name: dogfood |
| 13 | |
| 14 | services: |
| 15 | web: |
| 16 | build: |
| 17 | context: .. |
| 18 | dockerfile: docker/Dockerfile |
| 19 | target: web |
| 20 | container_name: dogfood-web |
| 21 | env_file: ../.env |
| 22 | environment: |
| 23 | BIND: 0.0.0.0:8080 |
| 24 | volumes: |
| 25 | - repos:/srv/repos |
| 26 | networks: |
| 27 | - default |
| 28 | # Reachable from the edge proxy for TLS termination at dogfood.sh. |
| 29 | - edge_caddy-network |
| 30 | restart: unless-stopped |
| 31 | # Repository storage is the only thing on disk; everything else is in |
| 32 | # Postgres. Read-only root keeps a compromised process from rewriting the |
| 33 | # binary or dropping a hook script. |
| 34 | read_only: true |
| 35 | tmpfs: |
| 36 | - /tmp |
| 37 | security_opt: |
| 38 | - no-new-privileges:true |
| 39 | |
| 40 | # Git over SSH. Published on 2222 because the host sshd owns :22 (spec §10 |
| 41 | # assumes otherwise; the environment does not allow it), so clone URLs are |
| 42 | # ssh://git@dogfood.sh:2222/owner/repo.git. |
| 43 | ssh: |
| 44 | build: |
| 45 | context: .. |
| 46 | dockerfile: docker/Dockerfile |
| 47 | target: ssh |
| 48 | container_name: dogfood-ssh |
| 49 | env_file: ../.env |
| 50 | environment: |
| 51 | SSH_BIND: 0.0.0.0:2222 |
| 52 | SSH_HOST_KEY_PATH: /etc/dogfood/ssh_host_ed25519_key |
| 53 | ports: |
| 54 | - "2222:2222" |
| 55 | volumes: |
| 56 | - repos:/srv/repos |
| 57 | # The host key must survive a redeploy or every client reports a changed |
| 58 | # host key, which is indistinguishable from an attack. |
| 59 | - ssh_keys:/etc/dogfood |
| 60 | networks: |
| 61 | - default |
| 62 | restart: unless-stopped |
| 63 | read_only: true |
| 64 | tmpfs: |
| 65 | - /tmp |
| 66 | security_opt: |
| 67 | - no-new-privileges:true |
| 68 | |
| 69 | worker: |
| 70 | build: |
| 71 | context: .. |
| 72 | dockerfile: docker/Dockerfile |
| 73 | target: worker |
| 74 | container_name: dogfood-worker |
| 75 | env_file: ../.env |
| 76 | volumes: |
| 77 | - repos:/srv/repos |
| 78 | networks: |
| 79 | - default |
| 80 | restart: unless-stopped |
| 81 | read_only: true |
| 82 | tmpfs: |
| 83 | - /tmp |
| 84 | security_opt: |
| 85 | - no-new-privileges:true |
| 86 | |
| 87 | volumes: |
| 88 | repos: |
| 89 | ssh_keys: |
| 90 | |
| 91 | networks: |
| 92 | edge_caddy-network: |
| 93 | external: true |
93 lines · YAML