mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-10-10 02:38:10 +02:00
• Build a custom image and replace upstream entrypoint with docker-entrypoint-custom.sh (strict fail on flag script). • Introduce set_flags.php and wire via ESPOCRM_SET_FLAGS_SCRIPT; apply flags at container start; clear cache afterwards. • Keep exactly one Docker volume (data:/var/www/html/); drop separate custom/extensions mounts. • Compose: use custom image, add healthchecks & depends_on for daemon/websocket; keep service healthy gating. • Ansible: deploy scripts, build & up via handlers; patch siteUrl as www-data; run upgrade non-fatal; always run flag setter. • Vars/Env: add ESPO_INIT_* toggles and ESPOCRM_SET_FLAGS_SCRIPT; refactor variables for scripts & custom image paths. Conversation context: https://chatgpt.com/share/68dd1992-020c-800f-bcf5-2db60cb4aab2
78 lines
2.8 KiB
Django/Jinja
78 lines
2.8 KiB
Django/Jinja
{% include 'roles/docker-compose/templates/base.yml.j2' %}
|
|
|
|
{% set service_name = ESPOCRM_SERVICE %}
|
|
{{ service_name }}:
|
|
{{ lookup('template', 'roles/docker-container/templates/build.yml.j2') | indent(4) }}
|
|
container_name: {{ ESPOCRM_CONTAINER }}
|
|
image: "{{ ESPOCRM_CUSTOM_IMAGE }}"
|
|
init: true
|
|
stop_signal: SIGTERM
|
|
stop_grace_period: 30s
|
|
{% include 'roles/docker-container/templates/base.yml.j2' %}
|
|
{% include 'roles/docker-container/templates/healthcheck/curl.yml.j2' %}
|
|
ports:
|
|
- "127.0.0.1:{{ ports.localhost.http[application_id] }}:80"
|
|
{% include 'roles/docker-container/templates/depends_on/dmbs_excl.yml.j2' %}
|
|
{% include 'roles/docker-container/templates/networks.yml.j2' %}
|
|
volumes:
|
|
- data:/var/www/html/
|
|
|
|
{% set service_name = 'daemon' %}
|
|
{{ service_name }}:
|
|
image: "{{ ESPOCRM_CUSTOM_IMAGE }}"
|
|
container_name: {{ ESPOCRM_CONTAINER }}_{{ service_name }}
|
|
pull_policy: never
|
|
init: true
|
|
stop_signal: SIGTERM
|
|
stop_grace_period: 30s
|
|
{% include 'roles/docker-container/templates/base.yml.j2' %}
|
|
entrypoint: docker-daemon.sh
|
|
{% include 'roles/docker-container/templates/networks.yml.j2' %}
|
|
volumes:
|
|
- data:/var/www/html/
|
|
depends_on:
|
|
{{ ESPOCRM_SERVICE }}:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "php", "-r", "require '/var/www/html/bootstrap.php'; echo 'OK';"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 40s
|
|
|
|
{% set service_name = 'websocket' %}
|
|
{{ service_name }}:
|
|
image: "{{ ESPOCRM_CUSTOM_IMAGE }}"
|
|
container_name: {{ ESPOCRM_CONTAINER }}_{{ service_name }}
|
|
pull_policy: never
|
|
init: true
|
|
stop_signal: SIGTERM
|
|
stop_grace_period: 30s
|
|
{% include 'roles/docker-container/templates/base.yml.j2' %}
|
|
environment:
|
|
- ESPOCRM_CONFIG_USE_WEB_SOCKET=true
|
|
- ESPOCRM_CONFIG_WEB_SOCKET_URL={{ WEBSOCKET_PROTOCOL }}://{{ domains | get_domain(application_id) }}/ws
|
|
- ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBSCRIBER_DSN=tcp://*:7777
|
|
- ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBMISSION_DSN=tcp://websocket:7777
|
|
entrypoint: docker-websocket.sh
|
|
{% include 'roles/docker-container/templates/depends_on/dmbs_excl.yml.j2' %}
|
|
{% include 'roles/docker-container/templates/networks.yml.j2' %}
|
|
volumes:
|
|
- data:/var/www/html/
|
|
ports:
|
|
- "127.0.0.1:{{ ports.localhost.websocket[application_id] }}:8080"
|
|
depends_on:
|
|
{{ ESPOCRM_SERVICE }}:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "sh", "-c", "exec 3<>/dev/tcp/127.0.0.1/8080 && echo 'OK' && exec 3<&- 3>&-"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 40s
|
|
|
|
{% include 'roles/docker-compose/templates/volumes.yml.j2' %}
|
|
data:
|
|
name: {{ ESPOCRM_DATA_VOLUME }}
|
|
|
|
{% include 'roles/docker-compose/templates/networks.yml.j2' %} |