| 1 | # This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | # file, You can obtain one at https://mozilla.org/MPL/2.0/. |
| 4 | # |
| 5 | # Default path is pure SQLite; Postgres is behind the `postgres` profile |
| 6 | # (`docker compose --profile postgres up`). |
| 7 | |
| 8 | services: |
| 9 | fabrica: |
| 10 | build: . |
| 11 | # Or: image: ghcr.io/you/fabrica:latest |
| 12 | restart: unless-stopped |
| 13 | ports: |
| 14 | - "8080:8080" |
| 15 | # Map SSH. The advertised clone port is `ssh.clone_port` in the config, |
| 16 | # which may differ from this published port (e.g. behind a forward). |
| 17 | - "2222:2222" |
| 18 | volumes: |
| 19 | - data:/var/lib/fabrica |
| 20 | - repos:/var/lib/fabrica/repos |
| 21 | # Bind-mount the config; override a couple of keys via env below to |
| 22 | # demonstrate both mechanisms. |
| 23 | - ./fabrica.toml:/etc/fabrica/fabrica.toml:ro |
| 24 | environment: |
| 25 | # FABRICA__<SECTION>__<KEY> overrides the file (double underscores nest). |
| 26 | FABRICA__INSTANCE__URL: "https://git.example.com" |
| 27 | FABRICA__LOG__FORMAT: "json" |
| 28 | healthcheck: |
| 29 | test: ["CMD", "fabrica", "doctor", "--quiet"] |
| 30 | interval: 30s |
| 31 | timeout: 5s |
| 32 | |
| 33 | postgres: |
| 34 | image: postgres:16-alpine |
| 35 | profiles: ["postgres"] |
| 36 | restart: unless-stopped |
| 37 | environment: |
| 38 | POSTGRES_USER: fabrica |
| 39 | POSTGRES_PASSWORD: fabrica |
| 40 | POSTGRES_DB: fabrica |
| 41 | volumes: |
| 42 | - pg:/var/lib/postgresql/data |
| 43 | # To use it, point the database URL at this service, e.g.: |
| 44 | # FABRICA__DATABASE__URL: "postgres://fabrica:fabrica@postgres/fabrica" |
| 45 | |
| 46 | volumes: |
| 47 | data: |
| 48 | repos: |
| 49 | pg: |
| 50 | |
| 51 | # --- Reverse proxy note ------------------------------------------------------ |
| 52 | # A proxy in front MUST NOT buffer the git pack routes, or clones stall. For |
| 53 | # nginx: |
| 54 | # |
| 55 | # location / { |
| 56 | # proxy_pass http://fabrica:8080; |
| 57 | # proxy_http_version 1.1; |
| 58 | # # Critical for `/git-upload-pack` and `/info/refs`: |
| 59 | # proxy_buffering off; |
| 60 | # proxy_request_buffering off; |
| 61 | # proxy_read_timeout 3600s; |
| 62 | # } |