feat(forgejo): choose the database at installation, SQLite (default) or PostgreSQL #12

Open
opened 2026-11-15 17:49:04 +00:00 by claude-bot · 0 comments
Member

Need

The forgejo recipe stores its database in SQLite, on the data volume. That is the right default for a small forge: nothing else to run, one volume to back up.

It has limits a larger forge reaches:

  • SQLite accepts one writer at a time. With Forgejo Actions, runners write job logs and statuses continuously, next to pushes and web requests.
  • The database file lives on a ReadWriteOnce volume, so the forge can only ever run as one pod (Recreate strategy): no rolling update, no second replica.

Proposal

Make the database a choice at installation: SQLite (default) or PostgreSQL.

  • SQLite: the current behaviour, unchanged, and still what a plain install gets.
  • PostgreSQL: an optional component of the recipe (like registry-host or apex-packages) that sets FORGEJO__database__DB_TYPE=postgres and takes host, database name, user and password from the environment and a Secret.

To decide

  1. Where PostgreSQL comes from: a database the operator already runs (the component only takes connection settings), a PostgreSQL recipe of this catalogue that the component requires, or both. The first is the smallest step.
  2. Descriptor: how .tycho/recipes/k8s/forgejo/package.json expresses "one of two modes" (component with its env, and the data entry to back up: a volume in one mode, a database in the other).
  3. Secret: a secrets-postgres.dist.yaml template, as for the object storage mode.
  4. Session and cache: whether the PostgreSQL mode should also move sessions out of the data volume, which matters only for more than one replica.

Out of scope

  • Running several forge replicas. PostgreSQL is a prerequisite, not the whole work (shared repositories storage, queues, indexer).
  • Switching an existing forge from SQLite to PostgreSQL. The choice is made at installation; a migration (forgejo dump / restore into the other engine) is an operator procedure that deserves its own guide and issue.

Acceptance

  • A plain install is unchanged and still uses SQLite.
  • Installing with the PostgreSQL component yields a forge that starts against PostgreSQL, with no database file on the data volume.
  • bun run validate passes and the README (English and French) describes both modes and how to choose.
## Need The `forgejo` recipe stores its database in SQLite, on the data volume. That is the right default for a small forge: nothing else to run, one volume to back up. It has limits a larger forge reaches: - SQLite accepts one writer at a time. With Forgejo Actions, runners write job logs and statuses continuously, next to pushes and web requests. - The database file lives on a `ReadWriteOnce` volume, so the forge can only ever run as one pod (`Recreate` strategy): no rolling update, no second replica. ## Proposal Make the database a choice **at installation**: SQLite (default) or PostgreSQL. - **SQLite**: the current behaviour, unchanged, and still what a plain install gets. - **PostgreSQL**: an optional component of the recipe (like `registry-host` or `apex-packages`) that sets `FORGEJO__database__DB_TYPE=postgres` and takes host, database name, user and password from the environment and a Secret. ## To decide 1. **Where PostgreSQL comes from**: a database the operator already runs (the component only takes connection settings), a PostgreSQL recipe of this catalogue that the component `requires`, or both. The first is the smallest step. 2. **Descriptor**: how `.tycho/recipes/k8s/forgejo/package.json` expresses "one of two modes" (component with its `env`, and the `data` entry to back up: a volume in one mode, a database in the other). 3. **Secret**: a `secrets-postgres.dist.yaml` template, as for the object storage mode. 4. **Session and cache**: whether the PostgreSQL mode should also move sessions out of the data volume, which matters only for more than one replica. ## Out of scope - Running several forge replicas. PostgreSQL is a prerequisite, not the whole work (shared repositories storage, queues, indexer). - Switching an existing forge from SQLite to PostgreSQL. The choice is made at installation; a migration (`forgejo dump` / restore into the other engine) is an operator procedure that deserves its own guide and issue. ## Acceptance - A plain install is unchanged and still uses SQLite. - Installing with the PostgreSQL component yields a forge that starts against PostgreSQL, with no database file on the data volume. - `bun run validate` passes and the README (English and French) describes both modes and how to choose.
Sign in to join this conversation.
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
tycho/catalog#12
No description provided.