version: "3.9"

services:
  traefik-n8n:
    image: traefik:v2.10
    container_name: traefik-n8n
    command:
      - --api.dashboard=true
      - --api.insecure=true
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      # ACME / Let’s Encrypt automático:
      - --certificatesresolvers.myresolver.acme.httpchallenge=true
      - --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web
      - --certificatesresolvers.myresolver.acme.email=contacto@sollers.co
      - --certificatesresolvers.myresolver.acme.storage=/ssl/acme.json
    ports:
      - "144.208.74.211:80:80"
      - "144.208.74.211:443:443"
      - "8088:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./ssl:/ssl
    networks:
      - web
    restart: unless-stopped

  n8n:
    image: n8nio/n8n
    container_name: n8n-sollers
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=SollersN8N@25
      - N8N_HOST=n8n.sollers.co
      - N8N_PORT=5678
      - WEBHOOK_URL=https://n8n.sollers.co/
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.n8n.rule=Host(`n8n.sollers.co`)"
      - "traefik.http.routers.n8n.entrypoints=websecure"
      - "traefik.http.routers.n8n.tls=true"
      - "traefik.http.routers.n8n.tls.certresolver=myresolver"
      - "traefik.http.services.n8n.loadbalancer.server.port=5678"
    volumes:
      - ./n8n_data:/home/node/.n8n
    networks:
      - web
    restart: unless-stopped

networks:
  web:
    external: true