mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-10-10 18:58: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
56 lines
1.7 KiB
YAML
56 lines
1.7 KiB
YAML
---
|
|
- name: "load docker, db and proxy for {{ application_id }}"
|
|
include_role:
|
|
name: sys-stk-full-stateful
|
|
vars:
|
|
docker_compose_flush_handlers: false
|
|
|
|
- name: "Deploy '{{ ESPOCRM_ENTRYPOINT_SCRIPT_HOST_ABS }}'"
|
|
copy:
|
|
src: "{{ ESPOCRM_ENTRYPOINT_SCRIPT_FILE }}"
|
|
dest: "{{ ESPOCRM_ENTRYPOINT_SCRIPT_HOST_ABS }}"
|
|
notify:
|
|
- docker compose up
|
|
- docker compose build
|
|
|
|
- name: "Deploy '{{ ESPOCRM_SET_FLAG_SCRIPT_HOST_ABS }}'"
|
|
copy:
|
|
src: "{{ ESPOCRM_SET_FLAG_SCRIPT_FILE }}"
|
|
dest: "{{ ESPOCRM_SET_FLAG_SCRIPT_HOST_ABS }}"
|
|
notify:
|
|
- docker compose up
|
|
- docker compose build
|
|
|
|
|
|
- name: "Docker Compose Up for '{{ application_id }}'"
|
|
meta: flush_handlers
|
|
|
|
- name: Check if config.php exists in EspoCRM
|
|
command: docker exec --user root {{ ESPOCRM_CONTAINER }} test -f {{ ESPOCRM_CONFIG_FILE_PRIVATE }}
|
|
register: config_file_exists
|
|
changed_when: false
|
|
failed_when: false
|
|
|
|
- name: Patch EspoCRM config.php
|
|
include_tasks: 01_patch_config.yml
|
|
when: config_file_exists.rc == 0
|
|
|
|
- name: Run EspoCRM upgrade (only when MODE_UPDATE is true)
|
|
command: >
|
|
docker exec --user {{ ESPOCRM_USER }} {{ ESPOCRM_CONTAINER }}
|
|
php command.php upgrade -y
|
|
register: espocrm_upgrade
|
|
changed_when: "'Upgrading' in espocrm_upgrade.stdout or 'successfully' in espocrm_upgrade.stdout"
|
|
failed_when: false
|
|
when: MODE_UPDATE | bool
|
|
|
|
- name: Run flag setter as root (fallback)
|
|
command: >
|
|
docker exec --user root {{ ESPOCRM_CONTAINER }}
|
|
php {{ ESPOCRM_SET_FLAG_SCRIPT_DOCKER }}
|
|
register: flags_result_root
|
|
changed_when: "'CHANGED' in flags_result_root.stdout"
|
|
|
|
- name: Flush handlers to make DB available before password reset
|
|
meta: flush_handlers
|