networks:
  default:
    enable_ipv6: true

volumes:
  wallabag:
    driver: local

services:
  wallabag:
    image: wallabag/wallabag
    restart: unless-stopped
    environment:
      - SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql
      - SYMFONY__ENV__DATABASE_PORT=5432
      - SYMFONY__ENV__DATABASE_TABLE_PREFIX="wallabag_"
      - SYMFONY__ENV__FROM_EMAIL=service@gnous.eu
      - SYMFONY__ENV__DOMAIN_NAME=https://bag.gnous.eu
      - SYMFONY__ENV__SERVER_NAME="GnousBag"
      - SYMFONY__ENV__LOCALE="fr"
      - SYMFONY__ENV__FOSUSER_REGISTRATION=true
      - SYMFONY__ENV__FOSUSER_CONFIRMATION=true
      - POPULATE_DATABASE=False
      - SYMFONY__ENV__DATABASE_HOST=${MEP_DB_HOST_IP}
      - SYMFONY__ENV__DATABASE_NAME=${WALLABAG_DB_NAME}
      - SYMFONY__ENV__DATABASE_USER=${WALLABAG_DB_USER}
      - SYMFONY__ENV__DATABASE_PASSWORD="${WALLABAG_DB_PASS}"
      - SYMFONY__ENV__MAILER_DSN=smtp://service%40gnous.eu:${SMTP_PASS}@${SMTP_HOST}
      - SYMFONY__ENV__SECRET=${WALLABAG_SECRET}
    ports:
      - "3009:80"
    volumes:
      - wallabag:/var/www/wallabag/web/assets/images
    healthcheck:
      test:
        [
          "CMD",
          "wget",
          "--no-verbose",
          "--tries=1",
          "--spider",
          "http://localhost/api/info",
        ]
      interval: 1m
      timeout: 3s
    labels:
      - "traefik.enable=true"
      # web server
      - "traefik.http.services.wallabag-service-gnous.loadbalancer.server.port=3009"
      - "traefik.http.routers.fwallabaggnous.rule=Host(`bag.gnous.eu`)"
      - "traefik.http.routers.forgejofwallabaggnousgnous.tls=true"
      - "traefik.http.routers.fwallabaggnous.tls.certresolver=defaultacme"
      - "traefik.http.routers.fwallabaggnous.entrypoints=websecure"
      - "traefik.http.routers.fwallabaggnous.service=wallabag-service-gnous"
      - "traefik.http.routers.fwallabaggnous.middlewares=proxyHeader@file,proxyError@file"
    depends_on:
      - redis
  redis:
    image: redis:alpine
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 20s
      timeout: 3s