Containers start with the previous deploy's NETORK_VERSION in their environment #6

Closed
opened 2026-10-07 19:48:51 +00:00 by christianmanivong · 0 comments
Owner

deploy.sh starts the containers (Starting containers..., up -d --force-recreate) before it records NETORK_VERSION in ~/netork/.env (Recording registry settings...). The services read that file through env_file: .env, so every container starts with the version of the previous deploy in its environment.

Seen

A host ran a feature tag, then deploy.sh deployed latest-dev. The containers ran the latest-dev image as they should (the image tag comes from the exported variable, not from .env), but docker exec <api> env showed NETORK_VERSION=feature-container-engine-api, which was the tag before. .env itself said latest-dev afterwards.

Impact

Low. netOrk does not read NETORK_VERSION at runtime; the image tag is right. But anybody who checks a container's environment to see what runs is told something wrong, and that happens precisely while debugging a deploy. The next deploy only shifts the error by one.

Fix

Record the settings in .env before the first up -d, or pass the same values to the containers some other way. The comment above the recording step explains why .env must hold them (a hand-typed docker compose up -d <service> on the host); moving the step earlier keeps that.

Test-First

A test that checks the recording step comes before the first up -d in the script, or a dry run asserting the order of the remote commands.

`deploy.sh` starts the containers (`Starting containers...`, `up -d --force-recreate`) **before** it records `NETORK_VERSION` in `~/netork/.env` (`Recording registry settings...`). The services read that file through `env_file: .env`, so every container starts with the version of the **previous** deploy in its environment. ## Seen A host ran a feature tag, then `deploy.sh` deployed `latest-dev`. The containers ran the `latest-dev` image as they should (the image tag comes from the exported variable, not from `.env`), but `docker exec <api> env` showed `NETORK_VERSION=feature-container-engine-api`, which was the tag before. `.env` itself said `latest-dev` afterwards. ## Impact Low. netOrk does not read `NETORK_VERSION` at runtime; the image tag is right. But anybody who checks a container's environment to see what runs is told something wrong, and that happens precisely while debugging a deploy. The next deploy only shifts the error by one. ## Fix Record the settings in `.env` before the first `up -d`, or pass the same values to the containers some other way. The comment above the recording step explains why `.env` must hold them (a hand-typed `docker compose up -d <service>` on the host); moving the step earlier keeps that. ## Test-First A test that checks the recording step comes before the first `up -d` in the script, or a dry run asserting the order of the remote commands.
christianmanivong added the
prio
P4
label 2026-10-07 19:48:51 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NetOrk/deploy#6