Updates
Updating
- Put the new version into
.env:HIWISKI_VERSION=<new version>. - Pull the image and start:
docker compose pull app
docker compose up -d
The server backs up by itself when it starts with another version than it last ran — before it touches the database. Until that backup is written the app is not reachable yet; the log says “Backing up before the update to …”. If the backup fails (a full disk, mostly), the server migrates nothing and does not start; the old version still starts as it was.
What a version brings and whether there is anything to watch when updating is under What’s new, in the Upgrade notes.
Back to the old version
The same, with the old version in .env. Schema changes are made so that the old server still starts on the new schema. The backup made before the update — “Before the update to …” in the list — restores on the old version and on every newer one.
The database’s own role (optional)
A server set up with the current files signs in to Postgres with a role of its own that is no superuser: if a flaw ever let SQL through, it could not reach further than the database. One set up before keeps its single role and keeps working unchanged. To move it over:
- Back up first (Back up now). Download the current
docker-compose.ymlfrom the release, thendocker compose up -d postgresanddocker compose stop app. If you already copiedHIWISKI_DB_ADMIN_USERandHIWISKI_DB_ADMIN_PASSWORDfrom the new.env.exampleinto your.envwithout moving, remove those two lines first. - Open a database shell:
docker compose exec postgres sh -c 'psql -U "$HIWISKI_DB_USER" -d "$POSTGRES_DB"'(until step 3 that is your old role, the superuser), and paste this, with a new long password (openssl rand -hex 24) and, if yours is another, yourHIWISKI_DB_NAMEin place ofhiwiskiin the last line:
create role hiwiski_app login password 'NEW-PASSWORD'
nosuperuser nocreatedb nocreaterole noreplication nobypassrls;
do $$
declare t record;
begin
for t in select tablename from pg_tables where schemaname = 'public' loop
execute format('alter table public.%I owner to hiwiski_app', t.tablename);
end loop;
end $$;
alter database hiwiski owner to hiwiski_app;
- In
.env: renameHIWISKI_DB_USERandHIWISKI_DB_PASSWORDtoHIWISKI_DB_ADMIN_USERandHIWISKI_DB_ADMIN_PASSWORD, keeping their values, and addHIWISKI_DB_USER=hiwiski_appandHIWISKI_DB_PASSWORD=with the new password. docker compose up -d.
The apps
Apps and server may be of different versions. Not every device has to update at once.