# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

version: '3.6'

services:
  bugzilla6.web:
    build: &bz_build
      context: .
      dockerfile: Dockerfile
    command: dev_httpd
    volumes:
      - bugzilla6-data-dir:/app/data
      - .:/mnt/sync
    tmpfs:
      - /tmp
      - /run
    environment: &bz_env
      - 'BMO_inbound_proxies=*'
      - BMO_db_host=bugzilla6.mysql8
      - BMO_db_name=bugs
      - BMO_db_pass=bugs
      - BMO_db_user=bugs
      - BMO_db_mysql_ssl_get_pubkey=1
      - BMO_memcached_namespace=bugzilla
      - BMO_memcached_servers=memcached:11211
      - BMO_ses_username=ses@mozilla.bugs
      - BMO_ses_password=password123456789!
      - BMO_urlbase=http://127.0.0.1:8000/
      - BUGZILLA_ALLOW_INSECURE_HTTP=1
      - BZ_ANSWERS_FILE=/app/conf/checksetup_answers.txt
      - HTTP_BACKEND=morbo
      - LOCALCONFIG_ENV=1
      - LOG4PERL_CONFIG_FILE=log4perl-docker.conf
      - MOJO_LISTEN=http://*:8000
      - PORT=8000
    depends_on:
      - bugzilla6.mysql8
      - memcached
#      - tinyproxy
    ports:
      - "8000:8000"

#  bugzilla6.jobqueue:
#    build: *bz_build
#    command: jobqueue
#    volumes:
#      - bugzilla6-data-dir:/app/data
#    tmpfs:
#      - /tmp
#      - /run
#    environment: *bz_env
#    restart: always
#    depends_on:
#      - bugzilla6.mysql8
#      - memcached

#  bugzilla6.feed:
#    build: *bz_build
#    command:
#      - perl
#      - extensions/PhabBugz/bin/phabbugz_feed.pl
#      - start
#      - '-d'
#      - '-f'
#    volumes:
#      - bugzilla6-data-dir:/app/data
#    tmpfs:
#      - /tmp
#      - /run
#    environment: *bz_env
#    restart: always
#    depends_on:
#      - bugzilla6.mysql8
#      - memcached

#  bugzilla6.pushd:
#    build: *bz_build
#    command:
#      - perl
#      - extensions/Push/bin/bugzilla-pushd.pl
#      - start
#      - '-d'
#      - '-f'
#    volumes:
#      - bugzilla6-data-dir:/app/data
#    tmpfs:
#      - /tmp
#      - /run
#    environment: *bz_env
#    restart: always
#    depends_on:
#      - bugzilla6.mysql8
#      - memcached

  bugzilla6.mysql8:
    build:
      context: .
      dockerfile: docker/images/Dockerfile.mysql8
    volumes:
      - bugzilla6-mysql-db:/var/lib/mysql
    tmpfs:
      - /tmp
    logging:
      driver: "none"
    environment:
      - MYSQL_DATABASE=bugs
      - MYSQL_USER=bugs
      - MYSQL_PASSWORD=bugs
      - MYSQL_ALLOW_EMPTY_PASSWORD=1

  memcached:
    image: memcached:latest

#  tinyproxy:
#    build:
#      context: docker/tinyproxy
#      dockerfile: ./Dockerfile
#    ports:
#      - "1080:1080"

volumes:
  bugzilla6-mysql-db:
  bugzilla6-data-dir:
