e2e has no checks for healthchecks, Compose depends_on conditions, up --wait or up --build

Open
#358 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
docker-compose, rust

Research direction

Start by reading tests/e2e.sh and the existing container and Compose checks; the issue proposes a new section there of about 50 lines. Add coverage for healthcheck outcomes and filtering, Compose up --build --wait with healthy dependencies and bind volumes, and the locked down container options. Done means the proposed checks pass on Kiri and Docker Engine and clean up the resources they create.

Written by the indexing model from the issue text.

Description

What you're trying to do

Kiri runs healthchecks itself (no dockerd), and tests/e2e.sh has no check for
them, nor for the Compose features built on them. On main 260cf66:

$ for w in health service_healthy --wait driver_opts 'up --build' --init no-new-privileges; do printf '%s ' "$w"; grep -c -- "$w" tests/e2e.sh; done
health 0
service_healthy 0
--wait 0
driver_opts 0
up --build 0
--init 0
no-new-privileges 1

These are the parts a typical
Compose dev stack depends on: a database with a healthcheck, an app with
depends_on: {db: {condition: service_healthy}}, docker compose up --build --wait, and often a local volume bound to a project folder with
driver_opts: {type: none, o: bind, device: ...}.

They all work on Kiri 0.2.1 today; this is about keeping it that way. I ran the
checks below on Kiri 0.2.1 and on Docker Engine 29.8.2 (OrbStack) on Apple
silicon, macOS 27.0.1: 14 of 14 pass on both.

What you'd like Kiri to do

Proposed checks (about 50 lines, one new section, ~35 s):

  • --health-cmd true: healthy
  • --health-cmd 'exit 1' --health-retries 3: unhealthy, FailingStreak >= 3
  • --health-cmd 'sleep 5' --health-timeout 1s: log output
    Health check exceeded timeout (1s)
  • --health-interval 30s --health-start-period 20s --health-start-interval 1s:
    healthy within 4 s (so the start interval is honored)
  • ps --filter health=unhealthy and health=healthy
  • One Compose project: app is build: ./app, depends on db with
    condition: service_healthy (db becomes healthy after 2 s), and mounts a
    local volume with driver_opts type none / o bind on a temp folder.
    up -d --build --wait exits 0; ps shows db healthy; the built file is
    in app; app started at least 2 s after db; a file written on the host
    is read in the container and the other way round; after down -v the
    folder still has both files.
  • A locked-down run: --read-only --cap-drop ALL --security-opt no-new-privileges --init --network none --user 1000:1000 --tmpfs /x:uid=1000,gid=1000,mode=0700 gives a writable tmpfs owned by 1000 with
    mode 700, a read-only root, CapEff 0, NoNewPrivs 1, the shell not
    PID 1, and only lo.

Everything is plain docker CLI, so it should run unchanged on Linux and WSL; I
have only run it on a Mac so far. The checks remove what they create (four
hc-* containers, the Compose project kirihealth and its built image).

I have the change ready and can open a PR if this is welcome.

Would you like to build it?

Yes, once we've agreed on the approach

Dominant language
Rust
Stars
7.5k
Forks
329
Avg merge
7h 48m
Merged PRs (30d)
105

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libracoder/kiri

All issues in libracoder/kiri

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.