version: "3"

services:
  mariadb:
    image: wodby/mariadb:$MARIADB_TAG
    environment:
      MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
      MYSQL_DATABASE: $DB_NAME
      MYSQL_USER: $DB_USER
      MYSQL_PASSWORD: $DB_PASSWORD

  php:
    image: "wodby/drupal:10-${PHP_VER}-${DRUPAL_STABILITY_TAG}"
    environment:
      # To skip auto init.
      WODBY_APP_NAME: drupal
      DEBUG: 1
      DRUPAL_VERSION: 8
      DB_HOST: $DB_HOST
      DB_NAME: $DB_NAME
      DB_USER: $DB_USER
      DB_PASSWORD: $DB_PASSWORD
      DB_DRIVER: $DB_DRIVER
      PHP_SENDMAIL_PATH: '/bin/true'
      COLUMNS: 80
      PHP_FPM_USER: wodby
      PHP_FPM_GROUP: wodby
      COMPOSER_MEMORY_LIMIT: -1
      PHP_ERROR_REPORTING: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
    volumes:
    - codebase:/var/www/html
    - ./tests.sh:/usr/local/bin/tests.sh
    - ./test.settings.php:/var/www/html/web/sites/default/test.settings.php
    - ./varnish-purger.yml:/var/www/html/varnish-purger.yml
    - ./search_api.server.solr.yml:/var/www/html/solr/search_api.server.solr.yml

  nginx:
    image: wodby/nginx:$NGINX_TAG
    environment:
      NGINX_STATIC_OPEN_FILE_CACHE: "off"
      NGINX_BACKEND_HOST: php
      NGINX_SERVER_ROOT: /var/www/html/web
      NGINX_VHOST_PRESET: $NGINX_VHOST_PRESET
    volumes:
    - codebase:/var/www/html
    depends_on:
    - php

  varnish:
    image: wodby/varnish:$VARNISH_TAG
    depends_on:
    - nginx
    environment:
      VARNISH_SECRET: secret
      VARNISH_BACKEND_HOST: nginx
      VARNISH_BACKEND_PORT: 80
      VARNISH_CONFIG_PRESET: drupal
      VARNISH_PURGE_EXTERNAL_REQUEST_HEADER: X-Real-IP

  redis:
    image: wodby/redis:$REDIS_TAG
    environment:
      REDIS_PASSWORD: bad-password

  solr:
    image: wodby/solr:$SOLR_TAG
    environment:
      SOLR_DEFAULT_CONFIG_SET: $SOLR_CONFIG_SET
      ZK_HOST: zookeeper:2181
    depends_on:
    - zookeeper

  zookeeper:
    image: zookeeper:$ZOOKEEPER_TAG
    environment:
      ZOO_MY_ID: 1
      ZOO_SERVERS: server.1=zookeeper:2888:3888;2181
      ZOO_4LW_COMMANDS_WHITELIST: mntr, conf, ruok

volumes:
  codebase:
