services: blog: build: . image: testblog:latest container_name: simple-blog ports: - "8000:5000" environment: # BLOG_ADMIN_PASSWORD is only a first-run bootstrap value (the password is # then stored hashed in the database). Leave it empty to have a random one # generated and printed in the logs. Reset later with: # docker compose exec blog python -m blog.manage set-password - BLOG_ADMIN_PASSWORD=${BLOG_ADMIN_PASSWORD:-} # Long random signing key. If empty, one is generated and kept in the DB. - BLOG_SESSION_SECRET=${BLOG_SESSION_SECRET:-} # Set to 1 when served over HTTPS (including behind a TLS proxy). - BLOG_SECURE_COOKIES=${BLOG_SECURE_COOKIES:-0} - BLOG_SESSION_HOURS=${BLOG_SESSION_HOURS:-12} - BLOG_SESSION_IDLE_MINUTES=${BLOG_SESSION_IDLE_MINUTES:-120} - BLOG_URL=${BLOG_URL:-http://localhost:8000} # Resolve visitor country/city for the analytics map (0 disables lookups). - BLOG_GEOIP=${BLOG_GEOIP:-1} # Map LAN/local visitors at this server's own region (0 to leave blank). - BLOG_GEOIP_LOCAL=${BLOG_GEOIP_LOCAL:-1} # Optional comment-notification email (any SMTP provider). Leaving these # empty disables emails; in-app moderation alerts still work. - BLOG_SMTP_HOST=${BLOG_SMTP_HOST:-} - BLOG_SMTP_PORT=${BLOG_SMTP_PORT:-587} - BLOG_SMTP_USER=${BLOG_SMTP_USER:-} - BLOG_SMTP_PASSWORD=${BLOG_SMTP_PASSWORD:-} - BLOG_SMTP_FROM=${BLOG_SMTP_FROM:-} - BLOG_NOTIFY_EMAIL=${BLOG_NOTIFY_EMAIL:-} - BLOG_SMTP_TLS=${BLOG_SMTP_TLS:-1} # Optional push notifications via the self-hosted ntfy service below. # Set BLOG_NTFY_TOPIC to a secret topic name to switch them on. - BLOG_NTFY_URL=${BLOG_NTFY_URL:-http://ntfy:80} - BLOG_NTFY_TOPIC=${BLOG_NTFY_TOPIC:-} - BLOG_NTFY_TOKEN=${BLOG_NTFY_TOKEN:-} - BLOG_NTFY_PRIORITY=${BLOG_NTFY_PRIORITY:-default} - BLOG_DATA_DIR=/app/data volumes: # Persist posts/DB between container restarts - blog-data:/app/data # Persist uploaded media so images survive a rebuild (not just a restart) - uploads-data:/app/static/uploads restart: unless-stopped # Self-hosted push notifications. It only talks to the blog container unless # you publish its port, and its data is kept in a named volume. ntfy: image: binwiederhier/ntfy:v2.37.2 container_name: simple-blog-ntfy command: serve environment: - TZ=${TZ:-UTC} volumes: - ntfy-cache:/var/cache/ntfy - ./ntfy/server.yml:/etc/ntfy/server.yml:ro ports: - "8085:80" restart: unless-stopped volumes: blog-data: uploads-data: ntfy-cache: