Forgejo: Automate upgrade tasks #44

Open
opened 2025-02-15 12:00:40 +01:00 by histalek · 1 comment
Owner

The upgrade tasks i'm referring to are forgejo dump [1] and forgejo doctor check --all [2].

Currently i've run these manually on major upgrades only. We might want to do these automatically on any upgrade though.

At least the doctor command doesn't have noticeable downsides besides a bit of cpu usage and the need for a human to check the corresponding logs.
(AFAICT any errors lead to exit(1) while warnings lead to exit(0); so maybe checking the exit code is good enough?)

The backup task is a bit more complicated as we need to ensure extra space and need to decide when to delete the backup archive.
We could exclude/skip various parts of the back up [3] but i'd rather have a complete backup if we choose to do this.

[1] https://forgejo.org/docs/latest/admin/upgrade/#backup
[2] https://forgejo.org/docs/latest/admin/upgrade/#verify-forgejo-works
[3] https://forgejo.org/docs/latest/admin/command-line/#dump

The upgrade tasks i'm referring to are `forgejo dump` [1] and `forgejo doctor check --all` [2]. Currently i've run these manually on major upgrades only. We might want to do these automatically on any upgrade though. At least the doctor command doesn't have noticeable downsides besides a bit of cpu usage and the need for a human to check the corresponding logs. (AFAICT any errors lead to `exit(1)` while warnings lead to `exit(0)`; so maybe checking the exit code is good enough?) The backup task is a bit more complicated as we need to ensure extra space and need to decide when to delete the backup archive. We **could** exclude/skip various parts of the back up [3] but i'd rather have a complete backup if we choose to do this. [1] https://forgejo.org/docs/latest/admin/upgrade/#backup [2] https://forgejo.org/docs/latest/admin/upgrade/#verify-forgejo-works [3] https://forgejo.org/docs/latest/admin/command-line/#dump
Author
Owner

a small outline of a proper upgrade procedure could look like this:

  • disabling external access to forgejo (probably by letting caddy respond with HTTP/503 - Maintenance)
  • podman exec into forgejo container
  • running forgejo manager flush-queues as per upgrade-docs
  • running forgejo dump
  • exiting out of the container
  • running the ansible playbook
  • podman exec into container again
  • running forgejo doctor check --all --log-file doctor.log
  • restoring external access (if nothing went wrong) by reconfiguring caddy
  • some time later cleanup the zip dumpfile and the doctor log file
a small outline of a proper upgrade procedure could look like this: * disabling external access to forgejo (probably by letting caddy respond with [HTTP/503](https://http.cat/status/503) - Maintenance) * `podman exec` into forgejo container * running `forgejo manager flush-queues` as per [upgrade-docs](https://forgejo.org/docs/latest/admin/upgrade/#preparing-the-forgejo-upgrade) * running `forgejo dump` * exiting out of the container * running the ansible playbook * `podman exec` into container again * running `forgejo doctor check --all --log-file doctor.log` * restoring external access (if nothing went wrong) by reconfiguring caddy * some time later cleanup the zip dumpfile and the doctor log file
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: SipsOfCode/infrastructure#44
No description provided.