version: "3.8"

services:
  postgres:
    image: library/postgres:9.3
    ports:
      - 5433:5432
    environment:
      POSTGRES_PASSWORD: postgres
    volumes:
     - C:\projects\database:/var/lib/postgresql/data
  pgAdmin:
    image: dpage/pgadmin4
    ports:
     - 5050:80
    environment:
      PGADMIN_DEFAULT_EMAIL: domain@mail.ru
      PGADMIN_DEFAULT_PASSWORD: 123456
  rabbitmq:
    image: rabbitmq:management
    ports:
      - 5672:5672
      - 15672:15672
    environment:
      RABBITMQ_DEFAULT_USER: guest
      RABBITMQ_DEFAULT_PASS: guest
  openldap:
    image: osixia/openldap:1.2.0
    #container_name: openldap
    environment:
      LDAP_LOG_LEVEL: "-1"
      LDAP_ORGANISATION: "docker ltd"
      LDAP_DOMAIN: "zje.name"
      LDAP_BASE_DN: ""
      LDAP_ADMIN_PASSWORD: "ADMIN_PASSWORD"
      LDAP_CONFIG_PASSWORD: "config"
      LDAP_READONLY_USER: "false"
      #LDAP_READONLY_USER_USERNAME: "readonly"
      #LDAP_READONLY_USER_PASSWORD: "readonly"
      LDAP_RFC2307BIS_SCHEMA: "false"
      LDAP_BACKEND: "mdb"
      LDAP_TLS: "false"
      #LDAP_TLS_CRT_FILENAME: "${LDAP_TLS_CRT_FILENAME}"
      #LDAP_TLS_KEY_FILENAME: "${LDAP_TLS_KEY_FILENAME}"
      #LDAP_TLS_CA_CRT_FILENAME: "${LDAP_TLS_CA_CRT_FILENAME}"
      #LDAP_TLS_ENFORCE: "${LDAP_TLS_ENFORCE}"
      #LDAP_TLS_CIPHER_SUITE: "${LDAP_TLS_CIPHER_SUITE}"
      #LDAP_TLS_PROTOCOL_MIN: "${LDAP_TLS_PROTOCOL_MIN}"
      #LDAP_TLS_VERIFY_CLIENT: "${LDAP_TLS_VERIFY_CLIENT}"
      LDAP_REPLICATION: "false"
      #LDAP_REPLICATION_CONFIG_SYNCPROV: "binddn="cn=admin,cn=config" bindmethod=simple credentials=$LDAP_CONFIG_PASSWORD searchbase="cn=config" type=refreshAndPersist retry="60 +" timeout=1 starttls=critical"
      #LDAP_REPLICATION_DB_SYNCPROV: "binddn="cn=admin,$LDAP_BASE_DN" bindmethod=simple credentials=$LDAP_ADMIN_PASSWORD searchbase="$LDAP_BASE_DN" type=refreshAndPersist interval=00:00:00:10 retry="60 +" timeout=1 starttls=critical"
      #LDAP_REPLICATION_HOSTS: "#PYTHON2BASH:['ldap://ldap.example.org','ldap://ldap2.example.org']"
      KEEP_EXISTING_CONFIG: "false"
      LDAP_REMOVE_CONFIG_AFTER_SETUP: "true"
      LDAP_SSL_HELPER_PREFIX: "ldap"
    #tty: true
    #stdin_open: true
    volumes:
      - C:\projects\ldap\ldap_data:/var/lib/ldap
      - C:\projects\emias\ldap\ldap_slap:/etc/ldap/slapd.d
      - C:\projects\emias\ldap\ldap_certs:/container/service/slapd/assets/certs/
    ports:
      - "389:389"
      - "636:636"
    hostname: "openldap.local"
#    networks:
#      ldap-network
#        aliases:
#          - openldap.local
#    deploy:
#      #endpoint_mode: dnsrr
#      #mode: replicated
#      replicas: 1
#      resources:
#        # Hard limit - Docker does not allow to allocate more
#        limits:
#          cpus: '1'
#          memory: 1G
#        # Soft limit - Docker makes best effort to return to it
#        reservations:
#          #cpus: '0.25'
#          memory: 256M
#      # service restart policy
#      restart_policy:
#        condition: on-failure
#        delay: 5s
#        max_attempts: 8
#        window: 3s
#      # service update configuration
#      update_config:
#        parallelism: 1
#        delay: 10s
#        failure_action: continue
#        monitor: 60s
#        max_failure_ratio: 0.3
#      # placement constraint - in this case on 'worker' nodes only
#      placement:
#        constraints: [node.role == manager]
  phpldapadmin:
    image: osixia/phpldapadmin:latest
    #container_name: phpldapadmin
    environment:
      PHPLDAPADMIN_LDAP_HOSTS: "openldap"
#      PHPLDAPADMIN_LDAP_HOSTS: "127.0.0.1"
      PHPLDAPADMIN_HTTPS: "false"
    ports:
      - "8081:80"
