I'm not certain this belongs in this mail thread, it's a reply to Brent's recent email.
I don't think we need this for the launch but I agree that this needs to be done ASAP. I wanted to document my approach here.
I did the following changes to my install.sh and docker-compose.yml files in order to do repeated upgrade tests yesterday after the latest image push. These changes pull the specified version of images, tags them as latest, and builds and runs the container with the latest tag. This ensures that watchtower identifies the tag as latest and performs upgrades as expected.
1. Create an additional .install-env file which contains all existing variables along with an additional variable: MATHESAR_VERSION='${mathesar_version}'.
2. The docker commands in install.sh are updated as follows:
docker compose --env-file .install-env --profile prod pull
docker tag mathesar/mathesar-prod:"${mathesar_version}" mathesar/mathesar-prod:latest
docker compose --profile prod up -d --wait --no-recreate --no-build || installation_fail
3. The images within docker-compose.yml are updated as follows:
image: "mathesar/mathesar-prod:${MATHESAR_VERSION-latest}"
Change 1 creates an additional file because I couldn't find a way to pass env variables directly as part of the command to `docker compose pull`.
Change 2 pulls the images using the additional .install-env file, tags the prod image as latest, and then builds and starts the containers with the default .env file.
Change 3 is to ensure that docker-compose.yml uses the version mentioned in the MATHESAR_VERSION env variable.
We could delete the .install-env file once this completes.
These are crude and can be improved, but I've tested this approach a few times, so I can ensure that this works (at least in my local environment).