Files
theoldfitz/docker-compose.yaml

66 lines
2.4 KiB
YAML

# The Old Fitz — compose for any Docker host (test or production).
#
# The site itself is baked into the image (see Dockerfile); the host only
# holds state. Expected layout, one folder per site:
# theoldfitz/
# docker-compose.yaml (this file)
# .env (FITZ_IMAGE, and PROXY_NETWORK if not "proxy")
# config/config.php (live secrets — never in the image)
# data/ (fitz.sqlite + cache/ — never in the image)
#
# Deploy: `docker compose pull && docker compose up -d`.
# Manual fallback from a checkout of the repo: `docker compose up -d --build`.
#
# First run: create data/ and `chown 33:33 data` (www-data in the image).
# Copy config.example.php to config/config.php, fill it in, and make it
# readable by www-data (`chown root:33` + `chmod 640`). Then create the
# first admin with bin/create-user.php (see its header).
#
# The CasaOS dev host keeps its own copy of this file in the CasaOS app
# settings, with CasaOS paths and its x-casaos block.
name: the-old-fitz
networks:
proxy:
external: true
# The reverse proxy's Docker network (NPM or Caddy). Set PROXY_NETWORK
# in .env if it isn't called "proxy".
name: ${PROXY_NETWORK:-proxy}
services:
the-old-fitz:
# Servers set FITZ_IMAGE in .env to the registry image, e.g.
# gitea.example.com/david/the-old-fitz:latest. Unset, it falls back to a
# local tag so `up --build` works from a checkout.
image: ${FITZ_IMAGE:-the-old-fitz:local}
build: .
container_name: the-old-fitz
restart: unless-stopped
networks:
- proxy
volumes:
# Database and cache live outside the web root so Apache can't serve
# them, and outside the image so deploys never touch them.
- type: bind
source: ./data
target: /var/www/data
# Config is mounted as a directory, not a single file: a single-file
# bind mount pins the inode, so an editor that saves by replacing the
# file leaves the container reading the old copy until a restart.
- type: bind
source: ./config
target: /var/www/config
read_only: true
environment:
- TZ=America/Indiana/Indianapolis
- FITZ_DB_PATH=/var/www/data/fitz.sqlite
- FITZ_CACHE_DIR=/var/www/data/cache
- FITZ_CONFIG_PATH=/var/www/config/config.php
# Cap container logs so PHP's error log can't slowly fill the disk.
logging:
driver: json-file
options:
max-size: 10m
max-file: "3"