version: '2' {% set volume_path = kimai.general.base_path + kimai.general.volumes_path %} services: {% if kimai.services.mysql.enabled -%} {{ kimai.services.mysql.service_name }}: image: mysql:5.7 environment: - MYSQL_DATABASE={{ kimai.services.mysql.db }} - MYSQL_USER={{ kimai.services.mysql.user }} - MYSQL_PASSWORD={{ kimai.services.mysql.password }} - MYSQL_ROOT_PASSWORD={{ kimai.services.mysql.root_password }} volumes: {% if kimai.volumes.mysql.disk %} - {{ volume_path + kimai.volumes.mysql.data }}/:/var/lib/mysql {% else %} - {{ kimai.volumes.mysql.data }}:/var/lib/mysql {% endif -%} command: --default-storage-engine innodb restart: unless-stopped {% if kimai.general.healthchecks -%} healthcheck: test: mysqladmin -p$$MYSQL_ROOT_PASSWORD ping -h localhost interval: 20s start_period: 10s timeout: 10s retries: 3 {% endif -%} {%- endif %} {% if kimai.services.nginx.enabled -%} {{ kimai.services.nginx.service_name }}: image: tobybatch/nginx-fpm-reverse-proxy ports: {%- for port_map in kimai.services.nginx.port_maps %} - {{ port_map }} {% endfor -%} volumes: {% if kimai.general.volume.disk -%} - {{ volume_path + kimai.general.volume.data }}/:/opt/kimai/public:ro {% else %} - {{ kimai.general.volume.data }}:/opt/kimai/public:ro {% endif -%} restart: unless-stopped depends_on: - {{ kimai.main.service_name }} {% if kimai.general.healthchecks -%} healthcheck: test: wget --spider http://nginx/health || exit 1 interval: 20s start_period: 10s timeout: 10s retries: 3 {% endif %} {% endif %} {% if kimai.services.postfix.enabled -%} {{ kimai.services.postfix.service_name }}: image: catatnight/postfix:latest environment: maildomain: {{ kimai.services.postfix.domain }} smtp_user: {{ kimai.services.postfix.smtp.user.name }}:{{ kimai.services.postfix.smtp.user.password }} restart: unless-stopped {% endif %} {{ kimai.main.service_name }}: # This is the latest FPM image of kimai image: kimai/kimai2:fpm environment: - ADMINMAIL={{ kimai.main.users.superadmin.mail }} - ADMINPASS={{ kimai.main.users.superadmin.password }} - DATABASE_URL=mysql://{{ kimai.services.mysql.user }}:{{ kimai.services.mysql.password }}@{{ kimai.services.mysql.service_name }}/{{ kimai.services.mysql.db }} - TRUSTED_HOSTS={{ kimai.services.nginx.service_name }},localhost,127.0.0.1,{{ kimai.main.trusted_hosts}} volumes: {% if kimai.general.volume.disk %} - {{ volume_path + kimai.general.volume.data }}/:/opt/kimai/public {% else %} - {{ kimai.general.volume.data }}:/opt/kimai/public {% endif -%} depends_on: - {{ kimai.services.mysql.service_name }} # - var:/opt/kimai/var # - ./ldap.conf:/etc/openldap/ldap.conf:z # - ./ROOT-CA.pem:/etc/ssl/certs/ROOT-CA.pem:z restart: unless-stopped volumes: {% if not kimai.general.volume.disk -%} {{ kimai.general.volume.data }}: {% endif -%} {% if not kimai.volumes.mysql.disk -%} {{ kimai.volumes.mysql.data }}: {% endif -%}