Run Gokapi's first-run password step as a blocking command
--deployment-password sets the password and exits, so the detached run plus health wait never saw a healthy container. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -35,30 +35,15 @@
|
|||||||
|
|
||||||
# A new database has no users and Gokapi refuses to start, so run it once with
|
# A new database has no users and Gokapi refuses to start, so run it once with
|
||||||
# --deployment-password to create the super admin (the Pocket ID email above).
|
# --deployment-password to create the super admin (the Pocket ID email above).
|
||||||
|
# Gokapi exits after setting the password.
|
||||||
- name: Create the gokapi super admin on a fresh install
|
- name: Create the gokapi super admin on a fresh install
|
||||||
when: not gokapi_db.stat.exists
|
|
||||||
block:
|
|
||||||
- name: Start a one-off gokapi with a deployment password
|
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: >-
|
cmd: >-
|
||||||
docker compose run -d --rm --no-deps --name gokapi-init gokapi
|
docker compose run --rm --no-deps gokapi
|
||||||
/app/run.sh --deployment-password {{ vault_gokapi.deployment_password }}
|
/app/run.sh --deployment-password {{ vault_gokapi.deployment_password }}
|
||||||
chdir: /opt/stacks/gokapi
|
chdir: /opt/stacks/gokapi
|
||||||
no_log: true
|
|
||||||
|
|
||||||
- name: Wait for the one-off gokapi to finish starting
|
|
||||||
ansible.builtin.command: docker inspect -f '{{ "{{" }}.State.Health.Status{{ "}}" }}' gokapi-init
|
|
||||||
register: gokapi_init_health
|
|
||||||
until: gokapi_init_health.stdout == "healthy"
|
|
||||||
retries: 30
|
|
||||||
delay: 3
|
|
||||||
changed_when: false
|
|
||||||
always:
|
|
||||||
- name: Stop the one-off gokapi
|
|
||||||
ansible.builtin.command: docker rm -f gokapi-init
|
|
||||||
when: not gokapi_db.stat.exists
|
when: not gokapi_db.stat.exists
|
||||||
changed_when: true
|
no_log: true
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- name: deploy gokapi stack
|
- name: deploy gokapi stack
|
||||||
community.docker.docker_compose_v2:
|
community.docker.docker_compose_v2:
|
||||||
|
|||||||
Reference in New Issue
Block a user