From 0cb42f581ebcf5951724b8d50c0f7044146e4512 Mon Sep 17 00:00:00 2001 From: SyniRon <66834451+SyniRon@users.noreply.github.com> Date: Thu, 21 May 2026 23:32:43 -0400 Subject: [PATCH] chore: refresh docker-compose.yaml template to align with prod (#71) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The in-repo template predated Redis and the tickets endpoint, declared deprecated `version: '3'`, and bundled a database + nginx that the live api stack doesn't carry. Refresh aligned with the live `7cav-api` stack: - drop deprecated `version: '3'` - add `redis` service (caching has been required since 2.1.0; the template never had it) - drop the `database` service — the DB is sourced from the `xenforo` stack via the `xenforo_internal` external network, not bundled in the api compose - drop the local-TLS-test `nginx` service — TLS is terminated at a different stack; `make certs` is independent and unchanged for devs who want local TLS - networks: switch to the live `edge` + `xenforo_internal` external pair - env vars: add full set — `REDIS_HOST` / `REDIS_PORT` / `REDIS_PASSWORD`, plus commented `FORUM_BASE_URL` and `REFERENCE_CACHE_REFRESH_INTERVAL` for the tickets endpoint - live patterns: rename api container to `7cav-api`, add the watchtower-enable label, `restart: always` - `DB_HOST` defaults to `xenforo-db` (the cross-stack hostname) - header comment documents the prerequisites Makes Dependabot #85 (mariadb 11.4 → 12.2.2) moot — the image reference is gone. Co-Authored-By: Claude Opus 4.7 (1M context) --- docker-compose.yaml | 90 ++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 51 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index d43d3fd..d11415a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,11 @@ -version: '3' +# Prod-shaped template — mirrors the live `7cav-api` stack. +# +# Prerequisites for `docker compose up`: +# - A `xenforo` stack is already running (provides `xenforo-db` on +# the `xenforo_internal` network). +# - The external networks exist: +# docker network create edge +# docker network create xenforo_internal services: api: @@ -6,64 +13,45 @@ services: dockerfile: "Dockerfile" context: "./" image: 7cav/api:latest - container_name: go-api + container_name: 7cav-api + labels: + - com.centurylinklabs.watchtower.enable=true networks: - - api - depends_on: - - database - - nginx + - edge + - xenforo_internal + restart: always ports: - - "11000:11000" - - "10000:10000" + - "11000:11000" + - "10000:10000" environment: PORT: 10000 - DB_USERNAME: + DB_USERNAME: xenforo DB_PASSWORD: - DB_HOST: - DB_PORT: - - nginx: - networks: - - api - image: nginx:1.27-alpine - container_name: api-nginx - ports: - - "8080:80" - - "4443:443" - restart: always - volumes: - - api-nginx-conf:/etc/nginx/conf.d/ - # use `make certs` to generate self-signed certs for nginx TLS - - ./out:/out + DB_HOST: xenforo-db + DB_PORT: 3306 + REDIS_HOST: redis + REDIS_PORT: 6379 + REDIS_PASSWORD: + # Optional — populates Ticket.forum_url; empty if unset. + # FORUM_BASE_URL: https://7cav.us + # Optional — refresh interval for the in-memory ticket reference cache; defaults to 15m. + # REFERENCE_CACHE_REFRESH_INTERVAL: 15m + depends_on: + - redis - database: - container_name: xenforo-db + redis: + image: redis:latest + container_name: redis networks: - - api - healthcheck: - test: mysqladmin --user=$$MYSQL_USER --password=$$MYSQL_PASSWORD ping - interval: 15s - timeout: 10s - retries: 3 + - xenforo_internal restart: always - image: mariadb:11.4 - ports: - - "3306:3306" - volumes: - - xenforo-database:/var/lib/mysql environment: - MYSQL_DATABASE: xenforo - MYSQL_USER: xenforo - MYSQL_PASSWORD: password - MYSQL_ROOT_PASSWORD: root_password - -volumes: - xenforo-database: - api-nginx-conf: - driver_opts: - type: none - o: bind - device: $PWD/docker/nginx/ + REDIS_PASSWORD: networks: - api: + edge: + external: true + name: edge + xenforo_internal: + external: true + name: xenforo_internal