← MinBase Site Home

v-b1 — Externalize Resources

New concepts (2): external Docker network; named volume for persistence. init.sql seeding is the how of persistence, not a third concept.

What changed from v-b0

Prerequisites (create the external resources once)

docker network create minbasenet
docker volume  create minbase_pgdata

Run it

docker compose up -d

"Why" sidebar (junior track)

Verification

  1. Volume + network exist: docker volume ls | grep minbase_pgdata, docker network ls | grep minbasenet.
  2. Persistence works (v-b0's failure is fixed):
    curl -X POST http://localhost:3000/candidates -H "Content-Type: application/json" -d '{"name":"Ginny"}'
    docker compose down
    docker compose up -d
    curl http://localhost:3000/candidates
    Ginny is still there now.
  3. init.sql does not re-run: the seed rows are not duplicated after restart.

Secrets policy

Local-only dev defaults. The Basic tier keeps clearly-labelled literals so the lesson runs with no setup: devpassword (postgres superuser, inline in compose.yml). They are teaching values: never reuse them anywhere reachable from a network, and never copy them into a real deployment. Every published port in this variant binds to 127.0.0.1 only. Real, random, per-install secrets start at v-b8 (generated by install.sh) and the Intermediate tier (v-i2…v-i5). A committed .env.secret is never acceptable; only *.example files are tracked.

Raw files

Download or view the raw variant source files:

FileLinkNotes
compose.ymldownloaddocker-compose manifest
init.sqldownloadSQL bootstrap / seed
README.mddownloadraw Markdown source

Home