docker-compose.yml: - Every env var documented inline with type/default/purpose - env_file: .env (required: false) — container starts without it - NTFY_TOPIC uses :? operator so compose errors clearly if unset - New vars: NTFY_TOKEN (private topics), NTFY_PRIORITY, TZ, APP_PORT, DEV_PORT - Removed duplicate NTFY_URL entry notifier/index.mjs: - Reads TZ from env (was hardcoded "America/Chicago") - Reads NTFY_PRIORITY from env (was hardcoded "default") - Adds Authorization: Bearer header when NTFY_TOKEN is set - Startup log shows auth status and full schedule config .env.example: mirrors every compose variable with descriptions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
67 lines
2.8 KiB
YAML
67 lines
2.8 KiB
YAML
services:
|
|
|
|
# ── Web app (nginx, port 8080) ──────────────────────────────────────────────
|
|
app:
|
|
build: .
|
|
image: ghcr.io/nmemmert/letter:main
|
|
ports:
|
|
- "${APP_PORT:-8080}:80"
|
|
restart: unless-stopped
|
|
|
|
# ── Monthly ntfy reminder ───────────────────────────────────────────────────
|
|
notifier:
|
|
build: ./notifier
|
|
restart: unless-stopped
|
|
env_file:
|
|
- path: .env
|
|
required: false # container still starts without a .env file
|
|
environment:
|
|
# ── ntfy connection ───────────────────────────────────────────────────
|
|
# Required: your ntfy topic — keep it unguessable, e.g. "nate-letter-k7x2"
|
|
# Subscribe at https://ntfy.sh/<NTFY_TOPIC> or in the ntfy mobile app
|
|
NTFY_TOPIC: ${NTFY_TOPIC:?NTFY_TOPIC is required — set it in .env}
|
|
|
|
# ntfy server (default: ntfy.sh; set to your self-hosted URL if applicable)
|
|
NTFY_URL: ${NTFY_URL:-https://ntfy.sh}
|
|
|
|
# Bearer token for access-controlled / private topics (leave blank for public)
|
|
NTFY_TOKEN: ${NTFY_TOKEN:-}
|
|
|
|
# Notification priority: min | low | default | high | urgent
|
|
NTFY_PRIORITY: ${NTFY_PRIORITY:-default}
|
|
|
|
# ── Schedule ──────────────────────────────────────────────────────────
|
|
# Cron expression — default fires at 9 AM on the 1st of every month
|
|
# Format: minute hour day-of-month month day-of-week
|
|
CRON_SCHEDULE: ${CRON_SCHEDULE:-0 9 1 * *}
|
|
|
|
# IANA timezone for the cron schedule
|
|
TZ: ${TZ:-America/Chicago}
|
|
|
|
# ── App ───────────────────────────────────────────────────────────────
|
|
# URL the notification deep-links back to (shown as "Open" in ntfy)
|
|
APP_URL: ${APP_URL:-http://localhost:8080}
|
|
|
|
# Set to "true" to fire a test notification immediately on container start
|
|
NTFY_TEST_ON_START: ${NTFY_TEST_ON_START:-false}
|
|
|
|
depends_on:
|
|
- app
|
|
|
|
# ── Local dev (Vite HMR, port 5173) — run with: docker compose --profile dev up dev
|
|
dev:
|
|
image: node:20-alpine
|
|
working_dir: /app
|
|
volumes:
|
|
- .:/app
|
|
- node_modules:/app/node_modules
|
|
ports:
|
|
- "${DEV_PORT:-5173}:5173"
|
|
environment:
|
|
NODE_ENV: development
|
|
command: sh -c "npm install && npm run dev -- --host 0.0.0.0"
|
|
profiles: [dev]
|
|
|
|
volumes:
|
|
node_modules:
|