# Indie Hacker self-host stack — n8n + Listmonk
# Curl + run:
#   curl -O https://osalt.dev/stack/indie-hacker/compose.yml
#   curl -O https://osalt.dev/stack/indie-hacker/.env.example && mv .env.example .env
#   docker compose up -d
# After first 'up', initialise the listmonk schema once:
#   docker compose exec listmonk ./listmonk --install --idempotent --yes
#
# Not in this file (per stack editorial):
#   - Plausible: heavy (postgres + clickhouse). Use the official community-edition
#     compose at https://github.com/plausible/community-edition.
#   - Cal.com: requires a long env list + NextAuth setup. See
#     https://github.com/calcom/docker.
#   - Coolify: meant to BE the host platform, not a sibling service. Install via
#     https://coolify.io/docs/installation (its installer brings its own compose).

services:
  n8n:
    image: docker.n8n.io/n8nio/n8n:1.74.0
    restart: unless-stopped
    ports:
      - "${N8N_PORT:-5678}:5678"
    environment:
      N8N_HOST: ${N8N_HOST:-localhost}
      N8N_PROTOCOL: http
      N8N_PORT: 5678
      WEBHOOK_URL: ${N8N_WEBHOOK_URL:-http://localhost:5678/}
      GENERIC_TIMEZONE: ${TZ:-UTC}
      N8N_RUNNERS_ENABLED: "true"
    volumes:
      - n8n_data:/home/node/.n8n

  listmonk-db:
    image: postgres:16-alpine
    restart: unless-stopped
    environment:
      POSTGRES_USER: ${LISTMONK_DB_USER:-listmonk}
      POSTGRES_PASSWORD: ${LISTMONK_DB_PASSWORD:?set LISTMONK_DB_PASSWORD in .env}
      POSTGRES_DB: ${LISTMONK_DB_NAME:-listmonk}
    volumes:
      - listmonk_db:/var/lib/postgresql/data

  listmonk:
    image: listmonk/listmonk:v3.0.0
    restart: unless-stopped
    depends_on:
      - listmonk-db
    ports:
      - "${LISTMONK_PORT:-9000}:9000"
    environment:
      TZ: ${TZ:-UTC}
      LISTMONK_app__address: 0.0.0.0:9000
      LISTMONK_db__host: listmonk-db
      LISTMONK_db__port: "5432"
      LISTMONK_db__user: ${LISTMONK_DB_USER:-listmonk}
      LISTMONK_db__password: ${LISTMONK_DB_PASSWORD:?set LISTMONK_DB_PASSWORD in .env}
      LISTMONK_db__database: ${LISTMONK_DB_NAME:-listmonk}
      LISTMONK_db__ssl_mode: disable

volumes:
  n8n_data:
  listmonk_db:
