ansible-role-inception/templates/inception-project-docker-co...

84 lines
2.6 KiB
Django/Jinja

version: '3.6'
networks:
{% if not inception_pep %}
haproxy-public:
external: true
{% endif %}
{{ inception_project_docker_network }}:
volumes:
{{ inception_project_db_volume }}:
# {{ inception_project_service_volume }}:
services:
{{ inception_project_docker_service_name }}:
image: {{ inception_project_docker_image }}
networks:
- {{ inception_project_docker_network }}
{% if not inception_pep %}
- haproxy-public
{% endif %}
environment:
- INCEPTION_DB_DIALECT=org.hibernate.dialect.MariaDB103Dialect
- INCEPTION_DB_DRIVER=org.mariadb.jdbc.Driver
- INCEPTION_DB_URL=jdbc:mariadb://{{ inception_project_db_host }}:{{ inception_project_db_port }}/{{ inception_project_db_name }}?useUnicode=true&characterEncoding=UTF-8
- INCEPTION_DB_USERNAME={{ inception_project_db_user }}
- INCEPTION_DB_PASSWORD={{ inception_project_db_pwd }}
- VIRTUAL_HOST={{ inception_project_server_endpoint }}
- JAVA_OPTS=-Dspring.jpa.properties.hibernate.dialect.storage_engine=innodb
volumes:
volumes:
- {{ inception_project_service_volume }}:/export
depends_on:
- {{ inception_project_db_host }}
deploy:
mode: replicated
replicas: 1
{% if not inception_pep %}
endpoint_mode: dnsrr
{% endif %}
placement:
constraints:
- node.role == worker
- {{ inception_project_service_constraints }}
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
logging:
driver: 'journald'
{% if inception_project_db_as_container %}
{{ inception_project_db_host }}:
image: {{ inception_project_db_image }}
networks:
- {{ inception_project_docker_network }}
volumes:
- {{ inception_project_db_volume }}:/var/lib/mysql
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=yes
- MYSQL_DATABASE={{ inception_project_db_name }}
- MYSQL_USER={{ inception_project_db_user }}
- MYSQL_PORT=3306
- MYSQL_PASSWORD={{ inception_project_db_pwd }}
command: ["--character-set-server=utf8", "--collation-server=utf8_bin"]
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "-p{{ inception_project_db_pwd }}", "-u{{ inception_project_db_user }}"]
interval: 20s
timeout: 10s
retries: 10
deploy:
placement:
constraints:
- node.role == worker
- {{ inception_project_db_constraints }}
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
logging:
driver: 'journald'
{% endif %}