The services read ~/netork/.env through env_file, so whatever it says
when `up -d` creates a container ends up in that container's
environment. The settings were recorded only after the swap, so every
container carried the previous deploy's NETORK_VERSION: the image was
right, `docker exec <api> env` was not.
Record them once the pull has brought the images onto the host and
before the first `up -d`. A failed pull still leaves .env alone. If the
swap fails afterwards, .env names the tag whose compose files and
images are already on the host, which is what a hand-typed
`docker compose up -d` there should start.
Also say which branches a feature-<branch> tag comes from: feature/<name>
and feat/<name> become feature-<name>, and fix/<name> now becomes
feature-fix-<name> (NetOrk/netork#208), because the registry keeps only
feature-* branch tags. The accepted forms do not change; the comment, the
refusal message and the README now say so, and a test holds that
feature-fix-<name> passes and a bare fix-<name> does not.
Closes#6
From 0.34.0 on, netOrk's releases (X.Y.Z, latest) are published for
linux/amd64 and linux/arm64, so a Raspberry Pi with a 64-bit OS can be a
target (NetOrk/netork#934). The deploy itself needed no change for that:
every step runs docker on the target host, which pulls its own platform,
and the images on the host (postgres, redis, apt-cacher-ng, signal-api)
exist for arm64 as well.
What did not work is a tag without arm64: latest-dev, main-<sha>,
feature-<branch> and every release before 0.34.0. On a Pi those failed at
the first pull with "no matching manifest for linux/arm64/v8", which names
neither the cause nor a tag that would work.
Now, right after the registry login, the host's architecture (docker
version) is compared with the platforms the registry lists for the
engine image, and on UI servers the ui image (docker manifest inspect).
A definite mismatch stops the deploy before anything on the host changes,
and says which tags carry arm64. When the registry's answer can't be read,
the pull decides, as before.
`docker rm -f` exits 0 for a container that does not exist, so the
"Removing retired services" step printed "removed container
netork-registry-1" on every deploy of every host, long after the
container was gone. That read as something recreating the registry
each time, and it would hide the one deploy that really removed it.
Check with `docker inspect` first, so only an existing container is
removed and reported. The volume branch needed nothing: `docker volume
rm` already fails for a missing volume.
Closes#7
netOrk's docker-compose.yml shipped a registry:2 for the satellite image,
and this script started it on every deploy as infrastructure. Satellites
pull from registry.netork.io; on 172.22.8.50 the registry held one old
image, nothing had pulled from it in 30 days, and it accepted anonymous
pushes on port 5000 of every instance (NetOrk/netork#763).
- registry leaves INFRA_SERVICES.
- A new step removes services netOrk no longer ships: the container
netork-registry-1, then the volume netork_registry_data. `docker
compose up` never removes a container whose service left the compose
file, so without this each host would keep it until someone removed it
by hand. The step is idempotent and works with the old compose file as
well as the new one, so it can go out before netOrk drops the service.
Several sessions deploy to the same test server, and two runs used to
overlap. On 2026-10-05 two `up -d --force-recreate` runs recreated each
other's containers and the API was down for a minute (#1). On 2026-10-06
two runs renamed each other's *.new compose files and one broke off; with
two different tags, one tag's compose files could have started the
other's images (#3).
- Each deploy first takes flock on ~/netork/.deploy.lock on the host. An
ssh session holds it: the remote side takes the lock on fd 9, reports
LOCKED and waits on its stdin, so ending the session frees it, whether
the deploy finished, failed, was interrupted or lost its connection.
Checked over real ssh on .50, including a client killed with -9.
- A second deploy prints who holds the lock, since when and with which
tag, and waits up to DEPLOY_LOCK_WAIT seconds (default 900); then it
gives up without touching the host.
- A host without flock is deployed without the lock, with a warning.
- deploy_server is now the lock around deploy_steps, the old body.
Closes#1Closes#3
On 2026-10-05 a deploy to 172.22.8.50 failed in "Starting containers":
docker compose up -d --force-recreate recreates the services in parallel,
lost a container it had just renamed ("No such container: 02586df7…") and
stopped with every engine container Created and none running. The old API
was already gone, so netOrk was down for about two minutes, until the same
deploy was run again and went through cleanly.
The script now does that second run itself, after DEPLOY_RECREATE_RETRY_DELAY
seconds (5 by default). If the second attempt fails too, it prints the
container states (docker compose ps -a) and fails as before.
Tests run the script against a fake ssh that fails the recreate zero, one
or two times. README step 3 says what happens.
Refs NetOrk/netork#586