services:
  mobilizon:
    image: framasoft/mobilizon:latest
    container_name: ${mobilizonServName}
    restart: ${restartPolicy}
    depends_on:
      - db
    env_file:
      - ../../secret/env-${mobilizonServName}
    environment:
      - MOBILIZON_INSTANCE_PORT=80
      - MOBILIZON_DATABASE_HOST=db
      - MOBILIZON_LDAP_HOST=ldap
      - MOBILIZON_LDAP_BASE=ou=users,${ldap_root}
      - MOBILIZON_LDAP_UID=cn
    expose:
      - 80
    volumes:
      - mobilizonUploads:/var/lib/mobilizon/uploads
      - ${PWD}/config.exs:/etc/mobilizon/config.exs:ro
      # - ${PWD}/GeoLite2-City.mmdb:/var/lib/mobilizon/geo_db/GeoLite2-City.mmdb
    networks:
      - mobilizonNet
      - postfixNet
      - ldapNet
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.${mobilizonServName}.rule=Host(`${mobilizonHost}.${domain}`)"
      - "traefik.http.services.${mobilizonServName}.loadbalancer.server.port=80"
      - "traefik.docker.network=mobilizonNet"

  db:
    image: postgis/postgis:13-3.1
    container_name: ${mobilizonDBName}
    restart: ${restartPolicy}
    env_file:
      - ../../secret/env-${mobilizonDBName}
    volumes:
      - mobilizonDB:/var/lib/postgresql/data
    networks:
      - mobilizonNet


volumes:
  mobilizonDB:
  mobilizonUploads:

networks:
  mobilizonNet:
    external: true
    name: mobilizonNet
  postfixNet:
    external: true
    name: postfixNet
  ldapNet:
    external: true
    name: ldapNet
