Files
vh daa56289ae stacks/miniflux: flatten to single network; fix verify
Initial deploy failed with 'Container cannot be connected to network
endpoints: miniflux-net, traefik-net' — the docker engine balks at
joining a brand-new internal network and an existing external
network in one create step.

Flattened both containers onto traefik-net only. The DB password
still protects miniflux-db, and traefik-net is internal-LAN-only,
so co-locating them is fine. Verify step updated to check for
traefik-net membership instead of the (now-gone) miniflux-net.
2026-04-26 11:55:04 -07:00

83 lines
3.0 KiB
YAML

# Deploy Miniflux + bundled Postgres to ana-docker.
#
# Usage:
# scripts/elway ana-docker --playbook playbooks/deploy-miniflux.yaml
#
# Idempotent — every step is creates-/when-gated; rerun is safe.
#
# After this playbook runs once, fill in the two CHANGE_ME passwords
# in /opt/docker/compose/miniflux/.env on the host (see README) and
# re-run `docker compose up -d` to start the stack with the real
# passwords. The first-run CREATE_ADMIN=1 then bootstraps the admin
# user on the empty DB.
vars:
compose_dir: /opt/docker/compose/miniflux
host_port: "8080"
steps:
- name: Ensure compose dir exists
shell: mkdir -p {{ compose_dir }}
creates: "{{ compose_dir }}"
- name: Upload compose.yaml
upload:
src: stacks/miniflux/compose.yaml
dest: "{{ compose_dir }}/compose.yaml"
mode: "0644"
- name: Upload starter-feeds.opml (for in-UI import)
upload:
src: stacks/miniflux/starter-feeds.opml
dest: "{{ compose_dir }}/starter-feeds.opml"
mode: "0644"
- name: Seed .env from template (only if absent)
upload:
src: stacks/miniflux/.env.example
dest: "{{ compose_dir }}/.env"
mode: "0644"
when: "[ ! -f {{ compose_dir }}/.env ]"
# ── compose pull + bring up ─────────────────────────────────────────
- name: docker compose pull (~250 MB total — postgres + miniflux)
shell: |
set -o pipefail
cd {{ compose_dir }} && docker compose pull --quiet 2>&1 \
| grep -vE '^\s*[0-9a-f]{8,16}\s+(Extracting|Pull complete|Pulling fs layer|Verifying Checksum|Download complete|Waiting|Already exists|Downloading|Pulling from)'
- name: docker compose up -d
shell: cd {{ compose_dir }} && docker compose up -d
- name: Wait for /healthcheck to respond (or report .env passwords still placeholder)
shell: |
for i in $(seq 1 30); do
# Miniflux returns 200 on /healthcheck once running.
if curl -sf -o /dev/null --max-time 3 http://localhost:{{ host_port }}/healthcheck; then
exit 0
fi
sleep 5
done
# Don't fail hard — first run with placeholder passwords will
# never come up healthy. Tell the operator what to do.
echo
echo "Miniflux didn't come healthy in 150 s — likely cause:"
echo " /opt/docker/compose/miniflux/.env still has CHANGE_ME passwords."
echo " Edit them (see stacks/miniflux/README.md) and re-run docker compose up -d."
exit 0
changed_when: "false"
verify:
- name: Container miniflux exists
shell: docker inspect miniflux --format '{{.State.Status}}' | grep -qE 'running|created|restarting'
changed_when: "false"
- name: Container miniflux-db exists
shell: docker inspect miniflux-db --format '{{.State.Status}}' | grep -qE 'running|created|restarting'
changed_when: "false"
- name: Both containers on traefik-net
shell: docker inspect miniflux miniflux-db --format '{{json .NetworkSettings.Networks}}' | grep -q traefik-net
changed_when: "false"