version: '3.3'

name: birdsite_{{ birdsite.id }}

networks:
  traefik-public:
    external: true

services:
  app:
    image: nicolasconstant/birdsitelive:latest
    restart: unless-stopped
    networks:
      - traefik-public
      - default
    environment:
      - Instance:Domain={{ birdsite.domain }}
      - Instance:AdminEmail={{ birdsite.adminmail }}
      - Db:Type=postgres
      - Db:Host=db
      - Db:Name=birdsitelive
      - Db:User=birdsitelive
      - Db:Password=birdsitelive
      - Twitter:ConsumerKey={{ birdsite.twitter.key }}
      - Twitter:ConsumerSecret={{ birdsite.twitter.secret }}
{% if birdsite.allowlist is defined %}
      - Moderation:FollowersWhiteListing={{ birdsite.allowlist|join(';') }}
{% endif %}
{% if birdsite.denylist is defined %}
      - Moderation:TwitterAccountsBlackListing={{ birdsite.denylist|join(';') }}
{% endif %}
      - Instance:Name={{ birdsite.name }}
      - Instance:ResolveMentionsInProfiles=true
      - Instance:PublishReplies=true
      #            - Instance:UnlistedTwitterAccounts=cocacola;twitter
      #            - Instance:SensitiveTwitterAccounts=archillect
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    labels:
      traefik.enable: 'true'
      traefik.docker.network: traefik-public
      traefik.http.services.birdsite_{{ birdsite.id }}.loadbalancer.server.port: 80
      traefik.http.routers.birdsite_{{ birdsite.id }}.rule: Host(`{{ birdsite.domain }}`)
      traefik.http.routers.birdsite_{{ birdsite.id }}.tls: 'true'
      traefik.http.routers.birdsite_{{ birdsite.id }}.tls.certresolver: lakedrops

  db:
    image: postgres:9.6
    restart: unless-stopped
    environment:
      - POSTGRES_USER=birdsitelive
      - POSTGRES_PASSWORD=birdsitelive
      - POSTGRES_DB=birdsitelive
    volumes:
      - '{{ appRoot }}/postgres:/var/lib/postgresql/data'

  borgmatic: {{ docker_compose_borgmatic_service }}
