Updating
Bringing a site you already run up to a newer version.
Updating never touches your photographs. Everything a site owns is in its data folder, and a new version brings the database up to date by itself the first time it starts. All the same, download a backup first (how), and keep it until you have seen the new version working.
The short version
| Installed with | Update with |
|---|---|
| git, run under pm2 | Admin, System, Update to version X. It restarts by itself. |
git, started with pnpm start | Admin, System, Update to version X, then restart it on the server |
| Docker | docker compose pull, then docker compose up -d |
| Docker on Laravel Forge | Forge's Deploy button, with deploy/forge-deploy.sh as the deploy script |
Not sure which is yours? Admin, System says how the copy was installed when it offers an update: it shows either an Update button or the commands to run.
Hearing that a new version is out
Fotobogen makes no outside requests you have not agreed to, so it does not look for new versions until you say it may.
- The first time you open the admin, a note asks Hear about new versions? Answer Yes, check once a day or No thanks. It asks once, and remembers either answer.
- After a yes, Fotobogen asks GitHub for the latest release at most once a day, when you use the admin. The request is anonymous: nothing about your site is sent.
- When a newer version exists, a note on every admin page says Version X is available, with See what is new, which opens the System page. Nothing is installed by itself: updating is always your decision.
- Close puts the note away on every admin page for the rest of your session. It comes back the next time you log in, or open your browser again, for as long as there is a newer version.
To change your answer, or to look right now: Admin, System has Check for updates and a Check once a day box. Releases are also listed on the Releases page and on GitHub.
Updating from the admin
For a copy installed with git (the macOS, Windows, Linux, and pm2 instructions). Available from version 1.1.0.
- Log in and open Admin, System.
- Press Download a backup and keep the file.
- Press Check for updates if the page does not already show a newer version.
- Read the list under Install version X: it says exactly what will happen on your server.
- Press Update to version X, then Yes, update now.
- Watch the steps. You can leave the page; the update carries on.
- Under pm2, Fotobogen restarts by itself and the page says Updated to version X. Started with
pnpm start, the page tells you to restart it: in the terminal where it runs, press Control + C, then runpnpm start.
What the update does, in order:
- Saves a copy of the database in the data folder (
before-update-<time>.db). - Fetches the release from where your copy was cloned from, and checks that it is a real, later release that follows on from yours.
- Switches to it and installs its packages.
- Builds it. This takes a few minutes and needs about 2 GB of memory, counting swap (adding swap). The site may be slow or show an error for a minute or two.
- Restarts, or waits for you to restart.
If any step fails, the old version is put back (and, if the new one had been switched to, built again), and the site carries on as it was. If that build fails too, which can happen on a server short of memory, the page says so: the running site carries on, but build it by hand on the server before restarting. The page says what went wrong and keeps the output. Files you changed on the server, such as a port in ecosystem.config.cjs, are left as they are.
Only the logged-in owner can update. An API token cannot, and neither can a demo visitor.
The same from a terminal
cd fotobogen
pnpm fotobogen update # the latest release
pnpm fotobogen update 1.2.0 # a particular one
Then restart Fotobogen.
Updating by hand
Use these if the admin cannot update your copy, if you are on version 1.0.0, or if you simply prefer to.
Node.js on a Mac, a PC, or a Linux server
Stop Fotobogen (Control + C), then in its folder:
git pull
pnpm install
pnpm build
pnpm start
Node.js with pm2
cd fotobogen
scripts/rebuild.sh
It fetches, installs, builds, and restarts under pm2 in one step.
Docker
cd fotobogen
docker compose pull
docker compose up -d
That downloads the new version's image and starts it; nothing is built on your server. On Laravel Forge, add -f docker-compose.forge.yml after docker compose in both commands, or press Forge's Deploy button if deploy/forge-deploy.sh is your deploy script. If you build the image yourself, use git pull and docker compose up -d --build instead.
To stay on one version instead of following the newest, set the image's tag in the compose file, for example ghcr.io/cschweda/fotobogen:1.1.0.
Checking that it worked
- Admin, Overview shows the version under The server.
/api/healthon your site answers with the version:{ "status": "ok", "version": "…" }.- Open your site and a photograph or two.
Going back
Changes to the database only go forward, so an older version refuses to start on a database that a newer one has changed, and says so. (Versions before 1.3.3 did not check, and would start on it regardless.) To go back, install the older version and restore the backup you made before updating. The steps are in the upgrade policy, which also says what a version number promises.
If the System page shows no Update button
Versions 1.1.0 to 1.3.0 had a fault: a site that had updated itself from the admin once went on showing Updated to version X and did not offer the next update there. The note and the check still worked. If that is your site, update once from a terminal, in Fotobogen's folder on the server, then restart it:
pnpm fotobogen update
From version 1.3.1 on, the button is back.
From version 1.0.0
Version 1.0.0 cannot update itself, and its System page links to the release instead of offering a button. Update it once by hand; from then on the admin can do it.