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:7-${PHP_VER}-${DRUPAL_STABILITY_TAG}"
    environment:
      # To skip auto init.
      WODBY_APP_NAME: drupal
      DEBUG: 1
      DRUPAL_VERSION: 7
      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
    volumes:
    - codebase:/var/www/html
    - ./tests.sh:/usr/local/bin/tests.sh
    - ./test.settings.php:/var/www/html/web/sites/default/test.settings.php
    - ./feature_search_api_solr:/var/www/html/web/sites/all/modules/features/feature_search_api_solr

  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

volumes:
  codebase:
