# Watchfall - install with Docker Compose v2 (also works pasted into Portainer, # Synology Container Manager or Unraid stacks). # 1. Put this file in an empty folder. # 2. Optional: adjust "Your settings" below. # 3. docker compose up -d then open http://:3000 and create the admin. # No .env file and no secrets folder are needed: the database password and the # scanner token are created on the first start (volume-init), the app creates # its sign-in and 2FA keys; all stay in Docker volumes and are never shown. # Advanced: a .env file next to this one overrides any ${NAME:-default} below # (installs from 1.7.x keep theirs). Update: replace this file, then # docker compose pull && docker compose up -d # Developers: ./build.sh builds the images from source (docker-compose.build.yml). # ---- Your settings --------------------------------------------------------- # Edit the value after ":-", e.g. ${TRUST_PROXY:-1}. Empty = off / default. x-watchfall-settings: &settings # Public https:// address for password-reset links, e.g. https://watchfall.example.com PUBLIC_BASE_URL: ${PUBLIC_BASE_URL:-} # Behind a reverse proxy: number of proxies (one nginx = 1), or the # proxy's network, e.g. 172.18.0.0/16 for Traefik. Empty = no proxy. TRUST_PROXY: ${TRUST_PROXY:-} # Sign-in cookie HTTPS-only: auto (whenever reached over HTTPS) or always. COOKIE_SECURE: ${COOKIE_SECURE:-auto} # Over HTTPS: seconds browsers keep insisting on HTTPS (0 = off). HSTS_MAX_AGE: ${HSTS_MAX_AGE:-15552000} # Stop scans that run longer than this many minutes (5-240). SCAN_TIMEOUT_MINUTES: &scan_timeout ${SCAN_TIMEOUT_MINUTES:-30} # Largest backup from Settings -> Backup, in bytes (empty = 2 GiB). BACKUP_MAX_BYTES: ${BACKUP_MAX_BYTES:-} # Time zone for schedules and e-mails, e.g. Europe/Berlin (empty = container default). TZ: ${TZ:-} # --------------------------------------------------------------------------- services: db: image: postgres:16-alpine container_name: watchfall-db restart: unless-stopped depends_on: volume-init: condition: service_completed_successfully environment: POSTGRES_DB: ${POSTGRES_DB:-watchfall} POSTGRES_USER: ${POSTGRES_USER:-watchfall} # Created by volume-init (from POSTGRES_PASSWORD in a .env, if set). POSTGRES_PASSWORD_FILE: /run/watchfall/db_password volumes: - db_data:/var/lib/postgresql/data - db_secret:/run/watchfall:ro # Not published: only the app reaches the database, over the internal backend network. # Admin access: docker exec -it watchfall-db psql -U watchfall watchfall networks: - backend healthcheck: test: ["CMD-SHELL", "pg_isready -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\""] interval: 10s timeout: 5s retries: 5 # Long-running, locked-down scanner service. It gets no .env and no # container-engine access; its only volume is its token (read-only). It can # reach the internet (to scan) and the app's private scan-control network, # but not the database. scanner: image: ghcr.io/dezeptor/watchfall:scanner-${WATCHFALL_VERSION:-1.16.0} container_name: watchfall-scanner depends_on: volume-init: condition: service_completed_successfully read_only: true # Scan workspace; counts against mem_limit. tmpfs: - /tmp:rw,noexec,nosuid,nodev,size=1g,mode=1777 cap_drop: - ALL security_opt: - no-new-privileges:true pids_limit: 512 mem_limit: 2g cpus: 2 init: true restart: unless-stopped # Time to stop running scans cleanly. stop_grace_period: 30s environment: SCANNER_TOKEN_FILE: /run/watchfall/scanner_token SCAN_TIMEOUT_MINUTES: *scan_timeout volumes: - scanner_secret:/run/watchfall:ro networks: - scan_control - scan_egress healthcheck: test: ["CMD", "/usr/local/bin/node", "-e", "require('http').get('http://127.0.0.1:8080/healthz', r => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"] interval: 15s timeout: 5s retries: 5 # One-shot: hands old data volumes to the app's non-root user (uid 1000, only # when not done yet) and creates the database password and scanner token if # missing, in secret volumes the services mount read-only (never shown). # No network, read-only, minimal capabilities. It runs at every # "docker compose up" and then stops: "watchfall-setup Exited (0)" is normal. # Deleting the stopped container is safe (it is recreated at the next up); # never delete the watchfall_* volumes. volume-init: image: ghcr.io/dezeptor/watchfall:app-${WATCHFALL_VERSION:-1.16.0} container_name: watchfall-setup user: "0:0" entrypoint: ["/usr/local/bin/node", "/app/lib/volume-init.js"] environment: # Only installs with a .env set it; empty = keep or create the password. POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-} volumes: - reports:/vol/reports - app_data:/vol/app-data - db_secret:/vol/db-secret - scanner_secret:/vol/scanner-secret - app_secret:/vol/app-secret network_mode: none read_only: true pids_limit: 64 mem_limit: 128m cap_drop: - ALL cap_add: - CHOWN - DAC_OVERRIDE - FOWNER security_opt: - no-new-privileges:true restart: "no" app: image: ghcr.io/dezeptor/watchfall:app-${WATCHFALL_VERSION:-1.16.0} container_name: watchfall-app restart: unless-stopped depends_on: db: condition: service_healthy scanner: condition: service_started volume-init: condition: service_completed_successfully # Runs as the image's non-root `node` user; PORT must be 1024 or higher. read_only: true tmpfs: - /tmp:rw,noexec,nosuid,nodev,size=64m cap_drop: - ALL security_opt: - no-new-privileges:true pids_limit: 256 mem_limit: 1g # Another host port: replace the first ${PORT:-3000}, e.g. "8080:${PORT:-3000}". ports: - "${PORT:-3000}:${PORT:-3000}" environment: <<: *settings PORT: ${PORT:-3000} REPORTS_DIR: ${REPORTS_DIR:-/reports} # App-only data (settings fallback, scan state, debug logs, .secrets). DATA_DIR: /app-data DB_HOST: ${DB_HOST:-db} DB_PORT: ${DB_PORT:-5432} DB_NAME: ${DB_NAME:-watchfall} DB_USER: ${DB_USER:-watchfall} # Set only by installs with a .env; otherwise the file below is used. DB_PASSWORD: ${DB_PASSWORD:-} DB_PASSWORD_FILE: /run/watchfall/db_password SCANNER_URL: http://watchfall-scanner:8080 SCANNER_TOKEN_FILE: /run/watchfall/scanner_token # Optional overrides (empty = created/derived automatically, see docs). JWT_SECRET: ${JWT_SECRET:-} TOTP_ENCRYPTION_KEY: ${TOTP_ENCRYPTION_KEY:-} UPDATE_CHECK_URL: ${UPDATE_CHECK_URL:-} TESTSSL_SEVERITY: ${TESTSSL_SEVERITY:-} NODE_ENV: ${NODE_ENV:-} volumes: - reports:${REPORTS_DIR:-/reports} - app_data:/app-data - app_secret:/run/watchfall:ro networks: - frontend - backend - scan_control networks: # Published app port and outgoing email. frontend: {} # App <-> database only, no outside access. backend: internal: true # App -> scanner job API only, no outside access. scan_control: internal: true # Scanner -> scan targets. scan_egress: {} volumes: app_data: name: watchfall_app_data reports: name: ${REPORTS_VOLUME:-watchfall_reports} db_data: name: watchfall_db_data # Generated secrets (volume-init); never shown, kept across updates. db_secret: name: watchfall_db_secret scanner_secret: name: watchfall_scanner_secret app_secret: name: watchfall_app_secret