Files
computer-playbook/roles/web-app-openproject/templates/compose.yml.j2

87 lines
4.0 KiB
Django/Jinja

x-op-app: &app
logging:
driver: journald
{{ lookup('container_image', application_id, 'web') }}
{{ lookup('template', 'roles/sys-svc-container/templates/build.yml.j2') | indent(2) }}
args:
OPENPROJECT_IMAGE: "{{ OPENPROJECT_IMAGE }}"
OPENPROJECT_VERSION: "{{ OPENPROJECT_VERSION }}"
{% include 'roles/sys-svc-compose/templates/base.yml.j2' %}
{% set service_name = 'cache' %}
{{ service_name }}:
{{ lookup('container_image', 'svc-db-memcached', 'memcached') }}
{{ lookup('compose_only', 'container_name', OPENPROJECT_CACHE_CONTAINER) }}
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{% set service_name = 'proxy' %}
{{ service_name }}:
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{{ lookup('container_image', application_id, 'proxy', version=OPENPROJECT_VERSION) }}
{{ lookup('compose_only', 'container_name', OPENPROJECT_PROXY_CONTAINER) }}
{{ lookup('compose_only', 'pull_policy', 'never') }}
command: "./docker/prod/proxy"
{{ lookup('container_ports', ['openproject', 'http', DOCKER_BIND_HOST]) | indent(4) }}
environment:
APP_HOST: {{ OPENPROJECT_WEB_SERVICE }}
{{ lookup('depends_on', [OPENPROJECT_WEB_SERVICE]) }}
{{ lookup('container_volumes', service_name) | indent(4) }}
{% set service_name = OPENPROJECT_WEB_SERVICE %}
{{ service_name }}:
<<: *app
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
command: ["{{ OPENPROJECT_AWAIT_MIGRATIONS_TARGET }}", "{{ OPENPROJECT_MIGRATION_WAIT_SECONDS }}", "{{ OPENPROJECT_MIGRATION_POLL_SECONDS }}", "./docker/prod/web"]
{{ lookup('compose_only', 'container_name', OPENPROJECT_WEB_CONTAINER) }}
{{ lookup('container_extra_hosts') | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{{ lookup('container_depends_on', application_id, extra={
'cache': {'condition': 'service_started'},
OPENPROJECT_SEEDER_SERVICE: {'condition': 'service_completed_successfully'},
}) | indent(4) }}
{{ lookup('container_healthcheck', service_name) | indent(4) }}
{{ lookup('container_volumes', service_name) | indent(4) }}
{% set service_name = 'worker' %}
{{ service_name }}:
<<: *app
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
command: ["{{ OPENPROJECT_AWAIT_MIGRATIONS_TARGET }}", "{{ OPENPROJECT_MIGRATION_WAIT_SECONDS }}", "{{ OPENPROJECT_MIGRATION_POLL_SECONDS }}", "./docker/prod/worker"]
{{ lookup('compose_only', 'container_name', OPENPROJECT_WORKER_CONTAINER) }}
{{ lookup('container_extra_hosts') | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{{ lookup('container_depends_on', application_id, extra={
'cache': {'condition': 'service_started'},
OPENPROJECT_SEEDER_SERVICE: {'condition': 'service_completed_successfully'},
}) | indent(4) }}
{{ lookup('container_volumes', service_name) | indent(4) }}
{% set service_name = 'cron' %}
{{ service_name }}:
<<: *app
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
command: "./docker/prod/cron"
{{ lookup('compose_only', 'container_name', OPENPROJECT_CRON_CONTAINER) }}
{{ lookup('container_extra_hosts') | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{{ lookup('container_depends_on', application_id, extra={
'cache': {'condition': 'service_started'},
OPENPROJECT_SEEDER_SERVICE: {'condition': 'service_completed_successfully'},
}) | indent(4) }}
{{ lookup('container_volumes', service_name) | indent(4) }}
{% set service_name = OPENPROJECT_SEEDER_SERVICE %}
{% set docker_restart_policy = 'on-failure' %}
{{ service_name }}:
<<: *app
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
command: "./docker/prod/seeder"
{{ lookup('compose_only', 'container_name', OPENPROJECT_SEEDER_CONTAINER) }}
{{ lookup('container_extra_hosts') | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('compose_volumes') }}
{{ lookup('compose_networks') }}