Skip to content
Snippets Groups Projects
docker-compose.yml.twig 17.3 KiB
Newer Older
  • Learn to ignore specific revisions
  • jurgenhaas's avatar
    jurgenhaas committed
    {% if drupal.live|default(0) %}
    name: {{ projectname }}
    {% endif %}
    
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    services:
      mariadb:
    
        image: '{{ docker_image_prefix }}{% if dbserver.type == "mariadb" %}wodby/mariadb:{{ dbserver.version }}{% elseif dbserver.type == "mysql" %}mysql/mysql-server:{{ dbserver.version }}{% endif %}'
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if drupal.live|default(0) %}
        restart: unless-stopped
    {% endif %}
    
        environment:
          MYSQL_ROOT_PASSWORD: password
          MYSQL_DATABASE: drupal
          MYSQL_USER: drupal
          MYSQL_PASSWORD: drupal
          MYSQL_LOG_CONSOLE: 0
    
        volumes:
    
    jurgenhaas's avatar
    jurgenhaas committed
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
          - {{ projectrootdb }}:/var/lib/mysql
    {% endif %}
    
    {% if not drupal.live|default(0) %}
    
        image: '{{ docker_image_prefix }}{% if dbserver.type == "mariadb" %}wodby/mariadb:{{ dbserver.version }}{% elseif dbserver.type == "mysql" %}mysql/mysql-server:{{ dbserver.version }}{% endif %}'
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    
    jurgenhaas's avatar
    jurgenhaas committed
        environment:
          MYSQL_ROOT_PASSWORD: password
          MYSQL_DATABASE: drupal
          MYSQL_USER: drupal
          MYSQL_PASSWORD: drupal
    
        volumes:
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
    {% endif %}
    
    jurgenhaas's avatar
    jurgenhaas committed
    
      php:
    
        image: '{{ docker_image_prefix }}wodby/drupal-php:{{ php.version }}'
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if drupal.live|default(0) %}
        restart: unless-stopped
    {% endif %}
    
    jurgenhaas's avatar
    jurgenhaas committed
        environment:
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if mailhog.enable %}
    
    jurgenhaas's avatar
    jurgenhaas committed
          PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% endif %}
    
          DB_HOST: mariadb
          DB_USER: drupal
          DB_PASSWORD: drupal
          DB_NAME: drupal
          DB_DRIVER: mysql
    
          COMPOSER_ALLOW_SUPERUSER: 1
    
    {% if php.xdebug and not drupal.live|default(0) %}
    
    jurgenhaas's avatar
    jurgenhaas committed
          PHP_XDEBUG: 1
    
          PHP_XDEBUG_MAX_NESTING_LEVEL: 512
    
          PHP_XDEBUG_MODE: {% if php.coverage %}coverage{% else %}debug{% endif %}
    
          PHP_XDEBUG_REMOTE_HOST: {{ docker0.ip }}
    
          PHP_XDEBUG_CLIENT_HOST: {{ docker0.ip }}
          PHP_XDEBUG_LOG: /dev/null
    
          PHP_XDEBUG_START_WITH_REQUEST: 1
    
          PHP_IDE_CONFIG: serverName=Docker
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if webgrind.enable %}
          PHP_XDEBUG_PROFILER_ENABLE: 1
          PHP_XDEBUG_PROFILER_ENABLE_TRIGGER: 1
          PHP_XDEBUG_PROFILER_ENABLE_TRIGGER_VALUE: 1
          PHP_XDEBUG_PROFILER_OUTPUT_DIR: /mnt/files/xdebug/profiler
          PHP_XDEBUG_TRACE_OUTPUT_DIR: /mnt/files/xdebug/traces
    {% endif %}
    {% endif %}
    
    {% if blackfire.enable and not drupal.live|default(0) %}
    
    jurgenhaas's avatar
    jurgenhaas committed
          PHP_BLACKFIRE: 1
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% endif %}
    
    {% if php.ssh and not drupal.live|default(0) %}
    
    {% endif %}
    
    jurgenhaas's avatar
    jurgenhaas committed
        volumes:
    
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
          - {{ projectroot }}:/var/www/html
    
          - {{ projectroot }}/drush:/etc/drush
    
    {% if drupal.live|default(0) %}
    
    jurgenhaas's avatar
    jurgenhaas committed
          - {{ projectrootfiles }}:/data/default
    
          - {{ projectrootfiles }}/db:/var/backups/mysql
    {% endif %}
    
    {% if php.ssh and not drupal.live|default(0) %}
    
          - {{ php.ssh_auth_sock }}:/ssh-agent
    
    {% endif %}
    
    {% if webgrind.enable and not drupal.live|default(0) %}
    
    jurgenhaas's avatar
    jurgenhaas committed
          - files:/mnt/files
    
    {% endif %}
    {% if wkhtmltox.enable %}
          - './.docker-init/wkhtmltox.sh:/docker-entrypoint-init.d/50-wkhtmltox.sh'
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% endif %}
    
        extra_hosts:
    
          - '{{ projectdomain }}:{{ docker0.ip }}'
    
    {% for subdomain in relatedprojectdomains %}
          - '{{ subdomain }}:{{ docker0.ip }}'
    {% endfor %}
    
    {% if crontabs.enable|default(0) %}
    
    jurgenhaas's avatar
    jurgenhaas committed
    
      cron:
    
        image: '{{ docker_image_prefix }}mcuadros/ofelia:latest'
    
    jurgenhaas's avatar
    jurgenhaas committed
        restart: unless-stopped
        volumes:
    
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
          - /var/run/docker.sock:/var/run/docker.sock:ro
    
          - {{ projectroot }}/crontabs/jobs.ini:/etc/ofelia/config.ini
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    
      {{ webserver.type }}:
    
        image: '{{ docker_image_prefix }}{% if webserver.type == "nginx" %}wodby/drupal-nginx:{{ webserver.version|default("1.21") }}{% elseif webserver.type == "apache" %}wodby/apache:2.4{% endif %}'
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if drupal.live|default(0) %}
        restart: unless-stopped
    {% endif %}
    
    jurgenhaas's avatar
    jurgenhaas committed
        depends_on:
          - php
        environment:
    
    {% if webserver.type == 'nginx' %}
    
    {% if live is defined and live.uri is defined %}
          NGINX_DRUPAL_FILE_PROXY_URL: '{{ live.uri }}'
    {% endif %}
    
          NGINX_ERROR_LOG_LEVEL: debug
    {% elseif webserver.type == 'apache' %}
    
          APACHE_VHOST_PRESET: php
    
          APACHE_LOG_LEVEL: debug
    
    {% if webserver.overwriteconfig %}
          APACHE_INCLUDE_CONF: /var/www/html/apache/vhost.conf
    {% endif %}
    
    {% endif %}
    
          {{ webserver.type|upper }}_BACKEND_HOST: php
    
          {{ webserver.type|upper }}_SERVER_ROOT: /var/www/html/{{ webRoot }}/
    
    jurgenhaas's avatar
    jurgenhaas committed
        volumes:
    
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
          - {{ projectroot }}:/var/www/html
    
    {% if drupal.live|default(0) %}
    
    jurgenhaas's avatar
    jurgenhaas committed
          - {{ projectrootfiles }}:/data/default
    
    {% endif %}
    
    jurgenhaas's avatar
    jurgenhaas committed
        labels:
    
          traefik.enable: 'true'
    
    {% if basicauth.enable %}
    
    jurgenhaas's avatar
    jurgenhaas committed
          traefik.http.middlewares.{{ webserver.type }}-{{ projectname }}-auth.basicauth.users: {{ basicauth.code }}
    {% endif %}
    
          traefik.http.routers.{{ webserver.type }}-{{ projectname }}.rule: Host(`{{ projectdomain }}`){% for domain in extradomains|default([]) %} || Host(`{{ domain }}`){% endfor %}
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if drupal.live|default(0) %}
          traefik.http.routers.{{ webserver.type }}-{{ projectname }}.tls: 'true'
          traefik.http.routers.{{ webserver.type }}-{{ projectname }}.tls.certresolver: lakedrops
    {% endif %}
    
    {% if extradomains|default([]) and basicauth.enable %}
          traefik.http.routers.{{ webserver.type }}-{{ projectname }}.middlewares: {{ webserver.type }}-{{ projectname }}-middleware
    
          traefik.http.middlewares.{{ webserver.type }}-{{ projectname }}-middleware.chain.middlewares: {% for domain in extradomains %}{% if loop.index > 1 %},{% endif %}{{ webserver.type }}-{{ projectname }}-redirectregex{{ loop.index }}@docker{% endfor %},{{ webserver.type }}-{{ projectname }}-auth@docker
    
    {% elseif extradomains|default([])|length == 1 %}
    
          traefik.http.routers.{{ webserver.type }}-{{ projectname }}.middlewares: {{ webserver.type }}-{{ projectname }}-redirectregex1@docker
    
          traefik.http.routers.{{ webserver.type }}-{{ projectname }}.middlewares: {{ webserver.type }}-{{ projectname }}-middleware
          traefik.http.middlewares.{{ webserver.type }}-{{ projectname }}-middleware.chain.middlewares: {% for domain in extradomains %}{% if loop.index > 1 %},{% endif %}{{ webserver.type }}-{{ projectname }}-redirectregex{{ loop.index }}@docker{% endfor %}
    
    
    {% elseif basicauth.enable %}
          traefik.http.routers.{{ webserver.type }}-{{ projectname }}.middlewares: {{ webserver.type }}-{{ projectname }}-auth@docker
    {% endif %}
    {% for domain in extradomains|default([]) %}
    
          traefik.http.middlewares.{{ webserver.type }}-{{ projectname }}-redirectregex{{ loop.index }}.redirectRegex.regex: "^https://{{ domain }}/(.*)"
          traefik.http.middlewares.{{ webserver.type }}-{{ projectname }}-redirectregex{{ loop.index }}.redirectRegex.replacement: "https://{{ projectdomain }}/$${1}"
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if varnish.enable %}
    
    jurgenhaas's avatar
    jurgenhaas committed
      varnish:
    
        image: '{{ docker_image_prefix }}wodby/varnish:6.0'
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if drupal.live|default(0) %}
        restart: unless-stopped
    {% endif %}
    
    jurgenhaas's avatar
    jurgenhaas committed
        depends_on:
    
          - {{ webserver.type }}
    
    jurgenhaas's avatar
    jurgenhaas committed
        environment:
          VARNISH_SECRET: secret
    
          VARNISH_BACKEND_HOST: {{ webserver.type }}
    
    jurgenhaas's avatar
    jurgenhaas committed
          VARNISH_BACKEND_PORT: 80
    
        volumes:
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
    jurgenhaas's avatar
    jurgenhaas committed
        labels:
    
          traefik.enable: 'true'
    
          traefik.http.routers.varnish-{{ projectname }}.rule: Host(`varnish-{{ projectdomain }}`)
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% endif %}
    
    
    jurgenhaas's avatar
    jurgenhaas committed
      redis:
    
        image: '{{ docker_image_prefix }}wodby/redis:{{ redis.version }}'
    
        environment:
          REDIS_MAXMEMORY: '{{ redis.max_memory }}'
    
    jurgenhaas's avatar
    jurgenhaas committed
        volumes:
    
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    {% if drupal.live|default(0) %}
    
    jurgenhaas's avatar
    jurgenhaas committed
          - {{ projectrootredis }}:/data
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% endif %}
    
    {% if not drupal.live|default(0) %}
    
    {% if dbbrowser.type == 'adminer' %}
    
        image: '{{ docker_image_prefix }}wodby/adminer:{{ dbbrowser.version|default("4.6") }}'
    
        environment:
          ADMINER_SALT: adminer-salt
    
        volumes:
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
          traefik.enable: 'true'
    
          traefik.http.services.{{ projectname }}_adminer.loadbalancer.server.port: 9000
    
          traefik.http.routers.adminer-{{ projectname }}.rule: Host(`adminer-{{ projectdomain }}`)
    
    {% elseif dbbrowser.type == 'pma' %}
    
    jurgenhaas's avatar
    jurgenhaas committed
      pma:
    
        image: '{{ docker_image_prefix }}phpmyadmin/phpmyadmin:latest'
    
        networks:
          - traefik-public
          - default
        depends_on:
          - mariadb
    
    jurgenhaas's avatar
    jurgenhaas committed
        environment:
          PMA_HOST: mariadb
          PMA_USER: drupal
          PMA_PASSWORD: drupal
          PHP_UPLOAD_MAX_FILESIZE: 1G
          PHP_MAX_INPUT_VARS: 1G
    
        volumes:
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
    jurgenhaas's avatar
    jurgenhaas committed
        labels:
    
          traefik.enable: 'true'
    
          traefik.http.routers.pma-{{ projectname }}.rule: Host(`pma-{{ projectdomain }}`)
    {% endif %}
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if solr.enable %}
    
    jurgenhaas's avatar
    jurgenhaas committed
      solr:
    
        image: '{{ docker_image_prefix }}wodby/solr:8-{{ solr.version }}'
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if drupal.live|default(0) %}
        restart: unless-stopped
    {% endif %}
    
    jurgenhaas's avatar
    jurgenhaas committed
        environment:
          SOLR_HEAP: 1024m
    
        volumes:
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
    jurgenhaas's avatar
    jurgenhaas committed
        labels:
    
          traefik.enable: 'true'
    
          traefik.http.services.{{ projectname }}_solr.loadbalancer.server.port: 8983
    
          traefik.http.routers.solr-{{ projectname }}.rule: Host(`solr-{{ projectdomain }}`)
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% endif %}
    
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if mailhog.enable and (not drupal.live|default(0) or staging) %}
    
    jurgenhaas's avatar
    jurgenhaas committed
      mailhog:
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if staging %}
        restart: unless-stopped
    {% endif %}
    
        environment:
          MH_OUTGOING_SMTP: /test/mhout.json
        privileged: true
        volumes:
    
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
          - {{ projectroot }}/tests/mhout.json:/test/mhout.json
    
    jurgenhaas's avatar
    jurgenhaas committed
        labels:
    
          traefik.enable: 'true'
    
    {% if basicauth.enable %}
    
    jurgenhaas's avatar
    jurgenhaas committed
          traefik.http.middlewares.mailhog-{{ projectname }}-auth.basicauth.users: {{ basicauth.code }}
          traefik.http.routers.mailhog-{{ projectname }}.middlewares: mailhog-{{ projectname }}-auth@docker
    {% endif %}
    
          traefik.http.services.{{ projectname }}_mailhog.loadbalancer.server.port: 8025
    
          traefik.http.routers.mailhog-{{ projectname }}.rule: Host(`mailhog-{{ projectdomain }}`)
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if drupal.live|default(0) %}
          traefik.http.routers.mailhog-{{ projectname }}.tls: 'true'
          traefik.http.routers.mailhog-{{ projectname }}.tls.certresolver: lakedrops
    {% endif %}
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% endif %}
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if node.enable %}
    
      nodejs:
    
        image: '{{ docker_image_prefix }}wodby/drupal-node:1.0'
    
        environment:
    
          NODE_SERVICE_KEY: '{{ node.key }}'
    
        labels:
    
          traefik.enable: 'true'
    
          traefik.http.services.{{ projectname }}_nodejs.loadbalancer.server.port: 8080
    
          traefik.http.routers.nodejs-{{ projectname }}.rule: Host(`nodejs-{{ projectdomain }}`)
    
        volumes:
    
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
          - {{ projectroot }}/{{ node.path }}:/app
    
        command: sh -c 'npm install && npm run start'
    
    
    jurgenhaas's avatar
    jurgenhaas committed
      node:
    
    jurgenhaas's avatar
    jurgenhaas committed
        working_dir: /app
        labels:
    
          traefik.enable: 'true'
    
          traefik.http.services.{{ projectname }}_node.loadbalancer.server.port: 3000
    
          traefik.http.routers.node-{{ projectname }}.rule: Host(`front-{{ projectdomain }}`)
    
    jurgenhaas's avatar
    jurgenhaas committed
        expose:
    
    jurgenhaas's avatar
    jurgenhaas committed
        volumes:
    
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
          - {{ projectroot }}/{{ node.path }}:/app
    
    jurgenhaas's avatar
    jurgenhaas committed
        command: sh -c 'npm install && npm run start'
    {% endif %}
    
    {% if memcached.enable %}
    
      memcached:
    
        image: '{{ docker_image_prefix }}wodby/memcached:1.6'
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if drupal.live|default(0) %}
        restart: unless-stopped
    {% endif %}
    
        volumes:
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
    {% endif %}
    {% if rsyslog.enable %}
    
      rsyslog:
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if drupal.live|default(0) %}
        restart: unless-stopped
    {% endif %}
    
        volumes:
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
    {% endif %}
    {% if athenapdf.enable %}
    
      athenapdf:
    
        image: '{{ docker_image_prefix }}arachnysdocker/athenapdf-service'
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if drupal.live|default(0) %}
        restart: unless-stopped
    {% endif %}
    
        environment:
          WEAVER_AUTH_KEY: '{{ athenapdf.key }}'
    
          WEAVER_MAX_WORKERS: 10
          WEAVER_MAX_CONVERSION_QUEUE: 50
          WEAVER_WORKER_TIMEOUT: 90
          WEAVER_CONVERSION_FALLBACK: false
    
        volumes:
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
    {% endif %}
    
    {% if blackfire.enable and not drupal.live|default(0) %}
    
    jurgenhaas's avatar
    jurgenhaas committed
    
      blackfire:
    
        image: '{{ docker_image_prefix }}blackfire/blackfire'
    
    jurgenhaas's avatar
    jurgenhaas committed
        environment:
          BLACKFIRE_SERVER_ID: '{{ blackfire.id }}'
          BLACKFIRE_SERVER_TOKEN: '{{ blackfire.token }}'
    
        volumes:
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% endif %}
    
    {% if webgrind.enable and not drupal.live|default(0) %}
    
    jurgenhaas's avatar
    jurgenhaas committed
    
      webgrind:
        # add XDEBUG_PROFILE=1 to your request to profile that
    
        image: '{{ docker_image_prefix }}wodby/webgrind:1'
    
    jurgenhaas's avatar
    jurgenhaas committed
        environment:
          WEBGRIND_PROFILER_DIR: '/mnt/files/xdebug/profiler'
        labels:
    
          traefik.enable: 'true'
    
          traefik.http.services.{{ projectname }}_webgrind.loadbalancer.server.port: 8080
    
          traefik.http.routers.webgrind-{{ projectname }}.rule: Host(`webgrind-{{ projectdomain }}`)
    
    jurgenhaas's avatar
    jurgenhaas committed
        volumes:
    
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
          - {{ projectroot }}/files:/mnt/files
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% endif %}
    
    {% if selenium.enable and not drupal.live|default(0) %}
    
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
          - /dev/shm:/dev/shm
        privileged: true
        environment:
    
          SELENIUM_HUB_HOST: 'hub'
          SELENIUM_HUB_PORT: '4444'
          GRID: 'true'
          CHROME: 'false'
          FIREFOX: 'false'
    
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
          - /dev/shm:/dev/shm
        privileged: true
        environment:
    
          NOVNC: 'true'
          SELENIUM_HUB_HOST: 'hub'
          SELENIUM_HUB_PORT: '4444'
          SELENIUM_NODE_HOST: '{{ docker0.ip }}'
          SCREEN_WIDTH: '1300'
          SCREEN_HEIGHT: '999'
          VIDEO: 'false'
          GRID: 'false'
          CHROME: 'true'
          FIREFOX: 'false'
    
        #ports:
          # VNC: See what's going on by connecting your VNC client to 0.0.0.0:5900
          #- 5900:25900
          # noVNC: See what's going on by hitting http://0.0.0.0:6080 in your browser
          #        Important: http://127.0.0.1:6081 works but http://localhost:6081 doesn't
          #- 6080:26080
    
    {% endif %}
    {% if elasticsearch.enable %}
    
      elasticsearch:
    
        image: '{{ docker_image_prefix }}wodby/elasticsearch:7'
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if drupal.live|default(0) %}
        restart: unless-stopped
    {% endif %}
    
        environment:
          discovery.type: single-node
    
    jurgenhaas's avatar
    jurgenhaas committed
          ES_BOOTSTRAP_MEMORY_LOCK: false
    
          ES_JAVA_OPTS: '-Xms512m -Xmx512m'
        ports:
          - 9200
          - 9300
    
        volumes:
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
    {% if drupal.live|default(0) %}
    
        image: 'registry.lakedrops.com/docker/alerta-proxy:1.0.2'
    
        restart: unless-stopped
        tty: true
        environment:
          - ALERTA_API_KEY={{ alerta.apikey }}
    {% if alerta.environment is defined %}
          - ALERTA_ENVIRONMENT={{ alerta.environment }}
    {% endif %}
    {% if alerta.project_id is defined %}
          - ALERTA_PROJECT_ID={{ alerta.project_id }}
    {% endif %}
    {% if alerta.proxy_port is defined %}
          - PORT={{ alerta.proxy_port }}
    {% endif %}
    {% endif %}
    
    {% if backup.enable|default(0) %}
    
    jurgenhaas's avatar
    jurgenhaas committed
    
      borgmatic:
    
        image: '{{ docker_image_prefix }}b3vis/borgmatic:{{ backup.version }}'
    
        restart: unless-stopped
    
    jurgenhaas's avatar
    jurgenhaas committed
        volumes:
    
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
    
          - /usr/local/bin/alertalerta.py:/usr/local/bin/alertalerta.py
    
    jurgenhaas's avatar
    jurgenhaas committed
          - {{ projectrootfiles }}:/mnt/source:ro
          - {{ projectrootbackup }}/files:/mnt/borg-repository
          - {{ projectroot }}/backup:/etc/borgmatic.d/
          - {{ projectrootbackup }}/config:/root/.config/borg
          - {{ projectrootbackup }}/ssh:/root/.ssh
          - {{ projectrootbackup }}/cache:/root/.cache/borg
    
    jurgenhaas's avatar
    jurgenhaas committed
        env_file: ../backup/.env
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% endif %}