services:
  db:
    image: postgres:17-alpine
    restart: unless-stopped
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5s
      timeout: 5s
      retries: 5

  notifuse:
    image: notifuse/notifuse:latest
    restart: unless-stopped
    depends_on:
      - db
    environment:
      # Root user configuration
      - ROOT_EMAIL=${ROOT_EMAIL}

      # API configuration
      - API_ENDPOINT=${API_ENDPOINT}

      # Database configuration
      - DB_HOST=db
      - DB_PORT=5432
      - DB_USER=postgres
      - DB_PASSWORD=postgres
      - DB_PREFIX=notifuse
      - DB_NAME=notifuse_system
      - DB_SSLMODE=disable

      # PASETO keys for authentication
      # Default keys for testing - GENERATE YOUR OWN for production at https://paseto.notifuse.com/
      - PASETO_PRIVATE_KEY=${PASETO_PRIVATE_KEY}
      - PASETO_PUBLIC_KEY=${PASETO_PUBLIC_KEY}

      # SMTP configuration
      - SMTP_HOST=${SMTP_HOST}
      - SMTP_PORT=${SMTP_PORT}
      - SMTP_USERNAME=${SMTP_USERNAME}
      - SMTP_PASSWORD=${SMTP_PASSWORD}
      - SMTP_FROM_EMAIL=${SMTP_FROM_EMAIL}
      - SMTP_FROM_NAME=${SMTP_FROM_NAME}

      # Server configuration
      - SERVER_PORT=8080
      - SERVER_HOST=0.0.0.0
      - ENVIRONMENT=production

volumes:
  db-data:
    driver: local
