Repository navigation
Updates
OwnMail tells you when a new version is out, and depending on how it runs it can update itself after one click. Versions and image tags are explained in Releases.
Every 6 hours ownmail serve asks GitHub's list of OwnMail releases for the
newest one (GET https://api.github.com/repos/ownlabs-dev/ownmail/releases/latest).
Nothing about the server goes with the request: no version, no name, no
address beyond the connection itself, no cookies; the User-Agent is a fixed
string. The first question comes a minute after the start; the answer is
kept across restarts.
When a newer release is out, the administration shows a quiet line on every page, "Version X is available", and Settings → Updates shows the running and the newest version, what changed, how this server updates, an Update now button and how the last update went.
-
Turn it off under Settings → Updates, or for good with
-update-check=false(OWNMAIL_UPDATE_CHECK=false); then OwnMail never asks. - A development build (
edge, or a binary built from source) is never offered updates and does not ask. Run a release to get them.
Settings → Updates → How this server updates has three choices.
Only administrators signed in with a password can start an update or change
how it is done. Access tokens (and with them AI programs) can only read the
state, with the tool get_update_status.
The default with the docker-compose.yml at the
root of the repository. A second service, updater, runs the same image
with ownmail updater.
It has the Docker socket, so it can control Docker on this server.
Whoever takes over that container can take over the server. It is set up to
keep that small, but if you do not want it, remove the updater service
and the OWNMAIL_UPDATES_DIR line from the compose file and update by hand.
What happens after "Update now":
- OwnMail writes
{"version":"X.Y.Z"}into a volume (ownmail-updates) that only OwnMail and the update container share. - The update container takes the request and checks it:
- the version must be a published release of
ownlabs-dev/ownmail(it asks GitHub itself, not OwnMail); - the image is the one the release names,
ghcr.io/ownlabs-dev/ownmail, pinned by its digest (the release notes end withImage: ghcr.io/ownlabs-dev/ownmail@sha256:…); the downloaded image must carry that digest and say it is that version; - it only touches the one container labelled
dev.ownmail.updatable=<id>, where<id>is its ownOWNMAIL_UPDATER_ID(the compose file sets both to the project name), and only if that container runs an OwnMail release older than the requested one.
- the version must be a published release of
- It downloads the image, stops the old container, creates a new one with the same settings (environment, ports, volumes, networks, labels, restart policy), starts it and waits up to 3 minutes for its health check.
- If the new version is not healthy, it removes it and starts the old container again ("Went back"). Otherwise it removes the old container.
- It writes how it went into the shared volume; the page shows it.
The moving tag in the compose file (latest, or X / X.Y when the new
version belongs to it) is pointed at the new image, so a later
docker compose up -d keeps the new version. With an exact version
(OWNMAIL_IMAGE=…:0.2.0) the new container names the image by digest;
change OWNMAIL_IMAGE in .env afterwards, or docker compose up -d goes
back to the version it names.
How the container is restricted (see the compose file): no published ports,
its own network (it only reaches out to ask for releases and Docker pulls
the image), read-only file system, no capabilities except the one the
program file carries, no-new-privileges. It runs as root because the
Docker socket belongs to root. Its health check is ownmail updater -alive
(it writes a sign of life every 20 seconds); OwnMail shows whether it runs.
The update container itself is not replaced by a click; it gets the new
image with the next docker compose pull && docker compose up -d.
Flags of ownmail updater (also as OWNMAIL_<NAME>):
| Flag | Default | |
|---|---|---|
-updater-id |
the value of dev.ownmail.updatable on the container to update (required) |
|
-updates-dir |
/updates |
the shared volume |
-docker-socket |
/var/run/docker.sock |
the Docker socket |
-health-timeout |
3m |
how long the new version has to pass its health check |
ownmail serve -updates-dir /updates (OWNMAIL_UPDATES_DIR) is the other
end; without it the choice "Update container" is not offered.
For platforms that deploy from a compose file and can redeploy on a call,
like Coolify. OwnMail sends POST to the address you enter, with
Authorization: Bearer <token> if you enter a token. The platform then
pulls the image again, so the compose file must name a moving tag
(latest, the default in deploy/coolify/, or 0).
On Coolify:
- Keys & Tokens → API tokens: create a token with the permission deploy.
- Open the OwnMail resource → Webhooks: copy the Deploy Webhook address
(
https://<coolify>/api/v1/deploy?uuid=…&force=false). - In OwnMail, Settings → Updates → How this server updates: choose Deploy hook, paste the address and the token, save.
The page never shows the saved address again, only where it goes (for
example https://coolify.example.com), since some platforms put a secret
into it; leave the field empty to keep it, or enter a new one. The token is
stored sealed with the server's secret key and never shown again; it does not appear in logs or the activity log.
A saved token goes only to the site it was saved for (scheme, host and
port): a new address on another site is refused until the token is entered
again or removed, and removing the address removes the token with it. The page says
"Waiting" until the new version runs, then "Updated". The hook does not
check releases itself: it redeploys whatever the moving tag names, which is
the newest release.
Notice and instructions only:
- Docker Compose:
docker compose pull && docker compose up -din the folder with the compose file. - Coolify: Redeploy the resource.
- systemd: replace
/usr/local/bin/ownmailwith the new release's binary andsystemctl restart ownmail(systemd).
For signed-in administrators (with a session, changing requests need the header X-Ownmail-Request: 1, see Usage):
GET /api/status |
{"version", "development"} |
GET /api/updates |
the version, the newest release (latest with notes), available, method, the update container's state, the hook address (never the token; access tokens see only its scheme and host), last (how the last update went), in_progress
|
POST /api/updates/check |
ask now (at most every 30 seconds) |
PUT /api/updates/settings |
{"check", "method", "hook_url", "hook_token"}; missing fields stay, "" removes the address or token; password session only |
POST /api/updates |
{"version": "X.Y.Z"} starts the update; password session only |
This wiki is copied from docs/ in the repository; changes go there, in a pull request.