You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: deploy/ansible/roles/dexdo/tasks/main.yml
+34-2Lines changed: 34 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -17,8 +17,19 @@
17
17
loop:
18
18
- "{{ dexdo_deploy_dir }}"
19
19
- "{{ dexdo_deploy_dir }}/config"
20
-
- "{{ dexdo_deploy_dir }}/logs/api"
21
-
- "{{ dexdo_deploy_dir }}/logs/indexer"
20
+
21
+
# Logs live outside the deploy dir (see dexdo_logs_dir) so they can sit on their
22
+
# own mount and survive a redeploy — one per-service subdir, bind-mounted to
23
+
# /app/logs in each container.
24
+
- name: Ensure log directories exist
25
+
ansible.builtin.file:
26
+
path: "{{ item }}"
27
+
state: directory
28
+
mode: "0750"
29
+
loop:
30
+
- "{{ dexdo_logs_dir }}"
31
+
- "{{ dexdo_logs_dir }}/api"
32
+
- "{{ dexdo_logs_dir }}/indexer"
22
33
23
34
- name: Render api config
24
35
ansible.builtin.template:
@@ -58,6 +69,17 @@
58
69
dest: "{{ dexdo_deploy_dir }}/compose.yml"
59
70
mode: "0644"
60
71
72
+
# Rotation script for the logrotate sidecar (bind-mounted into it by the compose
73
+
# file). Bind-mounts don't trigger a container recreate, so a script-only change
74
+
# is applied by the explicit restart below rather than by `compose up`.
75
+
- name: Render logrotate script (for the logrotate sidecar)
76
+
ansible.builtin.template:
77
+
src: logrotate.j2
78
+
dest: "{{ dexdo_deploy_dir }}/logrotate.sh"
79
+
mode: "0755"
80
+
when: dexdo_logrotate_enabled | bool
81
+
register: dexdo_logrotate_script
82
+
61
83
# Pulls the SHA-pinned images from the registry and (re)creates containers.
62
84
# `--pull always` picks up a new tag; config-only changes are applied by the
63
85
# "Restart dexdo stack" handler (bind-mounted YAML does not trigger a recreate).
@@ -67,3 +89,13 @@
67
89
chdir: "{{ dexdo_deploy_dir }}"
68
90
register: dexdo_compose_up
69
91
changed_when: "'Started' in dexdo_compose_up.stderr or 'Recreated' in dexdo_compose_up.stderr or 'Created' in dexdo_compose_up.stderr or 'Pulled' in dexdo_compose_up.stderr"
92
+
93
+
# `compose up` above recreates the sidecar only when the compose file changed;
94
+
# a change to logrotate.sh alone (bind-mounted) needs an explicit restart so the
95
+
# running container re-reads it.
96
+
- name: Restart logrotate sidecar when its script changed
97
+
ansible.builtin.command:
98
+
cmd: docker compose restart logrotate
99
+
chdir: "{{ dexdo_deploy_dir }}"
100
+
when: dexdo_logrotate_enabled | bool and dexdo_logrotate_script is changed
0 commit comments