version: '3.7'
services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: always
    ports:
      - "5678:5678"
    environment:
      - N8N_USER_FOLDER=/data
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=ltd69boxi2282fa
      - N8N_BASIC_AUTH_PASSWORD="?DYbBBAg8qtgcSr7G#"   # 🔑 CHANGE THIS
      - GENERIC_TIMEZONE=Europe/Berlin
      - TZ=Europe/Berlin
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=db
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_USER=n8n
      - DB_POSTGRESDB_PASSWORD="39hRafLXE&?fKzT!Rj"     # 🔑 CHANGE THIS
    volumes:
      - /volume1/docker/n8n:/data
    depends_on:
      - db

  db:
    image: postgres:14
    container_name: n8n_postgres
    restart: always
    environment:
      - POSTGRES_USER=n8n
      - POSTGRES_PASSWORD="39hRafLXE&?fKzT!Rj"          # 🔑 SAME AS ABOVE
      - POSTGRES_DB=n8n
    volumes:
      - /volume1/docker/n8n/db:/var/lib/postgresql/data
