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

99 lines
2.9 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:
driver: local
driver_opts:
type: nfs4
o: "nfsvers=4,addr=146.48.123.250,rw"
device: ":/nfs/inception_mysql_data"
inception_project_service_volume:
driver: local
driver_opts:
type: nfs4
o: "nfsvers=4,addr=146.48.123.250,rw"
device: ":/nfs/inception_service_home"
secrets:
inception_service_config:
external: true
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_docker_stack_name }}_{{ 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:
- inception_project_service_volume:/export
secrets:
- source: inception_service_config
target: /export/settings.properties
mode: 0444
depends_on:
- {{ inception_project_db_host }}
deploy:
mode: replicated
replicas: 1
{% if not inception_pep %}
endpoint_mode: dnsrr
{% endif %}
placement:
constraints:
- node.role == worker
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
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
logging:
driver: 'journald'
{% endif %}