Skip to content

Commit 265a879

Browse files
authored
ci: fix initial-push CI failures (yamllint + backup image pull) (#5)
* ci(lint): fix yamllint braces/colons + comment indentation _build-cell.yml workflow_call.inputs used aligned inline mappings (spaces inside braces / after colons / after commas) that fail yamllint's default rules; collapse to single-space form. Reorder the commented cadvisor depends_on note so the comment is followed by same-indent content (comments-indentation). Verified clean against the exact CI yamllint config + actionlint. Signed-off-by: Sebastian Mendel <sebastian.mendel@netresearch.de> * fix(backup): make phpbu backup an opt-in profile; decouple scheduler The ghcr.io/netresearch/phpbu-docker image is currently unpullable upstream (all tags resolve to GC'd manifests), which broke `docker compose up` for the whole stack. Move the backup service behind a `backup` compose profile so the default stack (and smoke-test) comes up without it, and remove backup from the scheduler's depends_on so the cron/heartbeat — which the app healthcheck rides on — never hinges on the backup image. Pin the tag to :6. Add `make backup-up` and document the opt-in. Verified: default stack serves GLPI, app+web healthy. Signed-off-by: Sebastian Mendel <sebastian.mendel@netresearch.de> * ci(smoke-test): poll for app+web healthy instead of one-shot check web depends_on app:service_healthy, so it starts only after the ~2-3 min GLPI install and is freshly-started (Up <1s) when the serve-check passes — its docker healthcheck (start_period 20s + interval 30s) hasn't reported healthy yet. The one-shot assert raced that and failed despite the stack serving correctly. Poll up to 120s for both to report healthy. Signed-off-by: Sebastian Mendel <sebastian.mendel@netresearch.de> * ci: re-trigger PR checks (prior commit touched only a workflow file) Signed-off-by: Sebastian Mendel <sebastian.mendel@netresearch.de> --------- Signed-off-by: Sebastian Mendel <sebastian.mendel@netresearch.de>
1 parent d24a07e commit 265a879

6 files changed

Lines changed: 54 additions & 36 deletions

File tree

.github/workflows/_build-cell.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ name: _build-cell
1414
on:
1515
workflow_call:
1616
inputs:
17-
version: { type: string, required: true }
18-
major: { type: string, required: true }
19-
major_minor: { type: string, required: true }
20-
glpi_sha256: { type: string, required: true }
21-
build_date: { type: string, required: true }
22-
date_tag: { type: string, required: true }
23-
registry: { type: string, required: true }
24-
image_name: { type: string, required: true }
25-
is_main_ref: { type: boolean, required: true }
26-
is_release_from_file: { type: boolean, required: true }
27-
push_artifacts: { type: boolean, required: true }
17+
version: {type: string, required: true}
18+
major: {type: string, required: true}
19+
major_minor: {type: string, required: true}
20+
glpi_sha256: {type: string, required: true}
21+
build_date: {type: string, required: true}
22+
date_tag: {type: string, required: true}
23+
registry: {type: string, required: true}
24+
image_name: {type: string, required: true}
25+
is_main_ref: {type: boolean, required: true}
26+
is_release_from_file: {type: boolean, required: true}
27+
push_artifacts: {type: boolean, required: true}
2828

2929
permissions:
3030
contents: read

.github/workflows/smoke-test.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,21 +134,30 @@ jobs:
134134
- name: Assert app + web report healthy
135135
run: |
136136
set -eu
137-
docker compose ps
138-
rc=0
139-
for svc in app web; do
140-
cid=$(docker compose ps -q "$svc")
141-
if [ -z "$cid" ]; then
142-
echo "::error::no container found for service $svc"; rc=1; continue
137+
# web depends_on `app: service_healthy`, so it only starts once app is
138+
# healthy (~2-3 min into the GLPI install). web is then functional —
139+
# the serve-check above already proved it — but its docker healthcheck
140+
# (start_period 20s + interval 30s) needs a cycle to flip to "healthy".
141+
# Poll for up to 120s instead of checking once.
142+
deadline=$(( $(date +%s) + 120 ))
143+
while :; do
144+
docker compose ps
145+
rc=0
146+
for svc in app web; do
147+
cid=$(docker compose ps -q "$svc")
148+
if [ -z "$cid" ]; then echo "$svc: no container yet"; rc=1; continue; fi
149+
health=$(docker inspect -f '{{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}}' "$cid")
150+
echo "$svc: $health"
151+
[ "$health" = "healthy" ] || rc=1
152+
done
153+
[ "$rc" -eq 0 ] && { echo "app + web report healthy"; break; }
154+
if [ "$(date +%s)" -ge "$deadline" ]; then
155+
echo "::error::app/web did not become healthy within 120s"
156+
docker compose logs --tail=200
157+
exit 1
143158
fi
144-
health=$(docker inspect -f '{{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}}' "$cid")
145-
echo "$svc: $health"
146-
[ "$health" = "healthy" ] || { echo "::error::$svc is not healthy ($health)"; rc=1; }
159+
sleep 6
147160
done
148-
if [ "$rc" -ne 0 ]; then
149-
docker compose logs --tail=200
150-
exit 1
151-
fi
152161
153162
- name: Tear down (cleanup)
154163
if: always()

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ disable-observability: .env ## Remove observability overlay
7676
# Backup / restore
7777
# ────────────────────────────────────────────────────────────────────
7878

79-
backup: ## Run a backup now (normally scheduled by ofelia at 03:00)
80-
docker compose exec -T backup phpbu --configuration=/config/backup.json
79+
backup-up: .env ## Start the opt-in backup service (phpbu, behind the `backup` profile)
80+
docker compose --profile backup up -d backup
81+
82+
backup: ## Run a backup now (requires `make backup-up`; normally ofelia at 03:00)
83+
docker compose --profile backup exec -T backup phpbu --configuration=/config/backup.json
8184

8285
backup-list: ## List backup archives
8386
docker compose exec -T backup ls -lh /backups
@@ -201,7 +204,7 @@ clean: ## DESTRUCTIVE: down + delete ALL volumes (db + uploads + backups)
201204

202205
.PHONY: \
203206
help init up down restart logs logs-app ps \
204-
backup backup-list backup-verify \
207+
backup backup-up backup-list backup-verify \
205208
health test test-image test-bats hardening-check \
206209
dev build lint pull upgrade \
207210
shell console restore clean \

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The official `glpi/glpi` image is Apache + mod_php in a single container with a
5151
| `app` | `ghcr.io/netresearch/glpi-php-fpm` | GLPI on php-fpm, socket-only, non-root |
5252
| `web` | `nginx:alpine` | serves `public/` + FastCGI to `app`, CSP/security headers |
5353
| `scheduler` | `ghcr.io/netresearch/ofelia` | runs GLPI `front/cron.php` (2 min) + phpbu (nightly) |
54-
| `backup` | `ghcr.io/netresearch/phpbu-docker` | nightly DB dump + `files/` + **config (crypt key)** archive |
54+
| `backup` _(opt-in: `--profile backup`)_ | `ghcr.io/netresearch/phpbu-docker` | nightly DB dump + `files/` + **config (crypt key)** archive |
5555

5656
## Quickstart
5757

@@ -133,7 +133,7 @@ make down # stop (keep volumes)
133133
**CLI** mode (Setup → General → Automatic actions) for deterministic scheduling.
134134
- **Upgrades** — bump `.glpi-version` (+ `GLPI_IMAGE_TAG`), `make up`; the
135135
entrypoint runs a maintenance-wrapped `database:update`.
136-
- **Backups / restore** — see [`docs/runbook-restore.md`](docs/runbook-restore.md).
136+
- **Backups / restore** — see [`docs/runbook-restore.md`](docs/runbook-restore.md). The `backup` service (phpbu) is **opt-in** behind the `backup` compose profile — start it with `make backup-up` (or `docker compose --profile backup up -d`).
137137
- **Day-2 ops** — see [`docs/runbook-day2-ops.md`](docs/runbook-day2-ops.md).
138138
- **ofelia is host-wide:** with the docker socket mounted it runs the labelled
139139
jobs of **every** stack on the host — run only one labelled stack per host, or

compose.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# scheduler — ofelia (Netresearch's fork), label-driven cron for GLPI's
1414
# front/cron.php (every 2 min) and phpbu (nightly)
1515
# backup — phpbu-docker, nightly DB dump + files/config archives
16+
# (opt-in: `--profile backup`)
1617
#
1718
# Quickstart:
1819
# 1. make init # generates .env with random secrets
@@ -335,8 +336,6 @@ services:
335336
depends_on:
336337
app:
337338
condition: service_started
338-
backup:
339-
condition: service_started
340339
command: ["daemon"]
341340
volumes:
342341
- /var/run/docker.sock:/var/run/docker.sock:ro
@@ -353,9 +352,16 @@ services:
353352
#
354353
# For off-host storage, bind-mount ./backups to a NAS/NFS share, or run
355354
# restic/rclone on the host reading the named volume.
355+
#
356+
# OPT-IN: behind the `backup` compose profile, so a plain `docker compose
357+
# up -d` (and the default `make up`) brings up the working core without it.
358+
# Enable with: docker compose --profile backup up -d (or `make backup-up`).
359+
# This also decouples the default stack from the phpbu-docker image's
360+
# availability — pin/replace the tag below for your environment.
356361
# ---------------------------------------------------------------------
357362
backup:
358-
image: ghcr.io/netresearch/phpbu-docker:latest
363+
profiles: ["backup"]
364+
image: ghcr.io/netresearch/phpbu-docker:6
359365
restart: unless-stopped
360366
mem_limit: 256m
361367
cpus: 0.5

examples/compose.observability.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,14 @@ services:
212212
max-size: "10m"
213213
max-file: "5"
214214
depends_on:
215-
mysqld-exporter:
216-
condition: service_started
217-
nginx-prometheus-exporter:
218-
condition: service_started
219215
# Uncomment together with the cadvisor service block above to enable
220216
# container-tier metrics:
221217
# cadvisor:
222218
# condition: service_started
219+
mysqld-exporter:
220+
condition: service_started
221+
nginx-prometheus-exporter:
222+
condition: service_started
223223
command:
224224
- --config.file=/etc/prometheus/prometheus.yml
225225
- --storage.tsdb.path=/prometheus

0 commit comments

Comments
 (0)