dockcheck runs as phil (docker group) and couldn't read /opt/stacks/gokapi (0700 root), so the labelled gokapi container could never be auto-updated. Paperless's root-only .env (2024 leftover, unused, same values as docker-compose.env) made docker compose fail for phil. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
1.9 KiB
YAML
62 lines
1.9 KiB
YAML
---
|
|
# Gokapi logs in through Pocket ID. config.json is written only on a fresh
|
|
# install (Gokapi rewrites it on upgrades), so changing the template later
|
|
# means deleting /opt/stacks/gokapi/config/config.json first.
|
|
# The stack directory is readable by the docker group so dockcheck (run as
|
|
# phil) can recreate the labelled container; config and data stay root-only.
|
|
- name: make gokapi stack directory
|
|
ansible.builtin.file:
|
|
path: /opt/stacks/gokapi
|
|
state: directory
|
|
owner: root
|
|
group: docker
|
|
mode: '0750'
|
|
|
|
- name: make gokapi config and data directories
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: '0700'
|
|
loop:
|
|
- /opt/stacks/gokapi/config
|
|
- /opt/stacks/gokapi/data
|
|
|
|
- name: Template out the compose file
|
|
ansible.builtin.template:
|
|
src: gokapi-compose.yml.j2
|
|
dest: /opt/stacks/gokapi/compose.yml
|
|
owner: root
|
|
mode: '0644'
|
|
|
|
- name: Template out the gokapi config (fresh installs only)
|
|
ansible.builtin.template:
|
|
src: gokapi-config.json.j2
|
|
dest: /opt/stacks/gokapi/config/config.json
|
|
owner: root
|
|
mode: '0600'
|
|
force: false
|
|
no_log: true
|
|
|
|
- name: Check for an existing gokapi database
|
|
ansible.builtin.stat:
|
|
path: /opt/stacks/gokapi/data/gokapi.sqlite
|
|
register: gokapi_db
|
|
|
|
# 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).
|
|
# Gokapi exits after setting the password.
|
|
- name: Create the gokapi super admin on a fresh install
|
|
ansible.builtin.command:
|
|
cmd: >-
|
|
docker compose run --rm --no-deps gokapi
|
|
/app/run.sh --deployment-password {{ vault_gokapi.deployment_password }}
|
|
chdir: /opt/stacks/gokapi
|
|
when: not gokapi_db.stat.exists
|
|
no_log: true
|
|
|
|
- name: deploy gokapi stack
|
|
community.docker.docker_compose_v2:
|
|
project_src: /opt/stacks/gokapi
|
|
files:
|
|
- compose.yml
|