Files
discourse/README.md
notplants 9b33fd8761
All checks were successful
cc-ci/testme cc-ci: success
feat(db): switch to discourse/postgres image with install-user + checksum adapter
Replace the bitnami-era pgvector:pg17 db + hand-rolled pg_upgrade entrypoint
with discourse/postgres:pg18 (pgvector + discourse's auto-upgrade layer, as
suggested on coop-cloud/discourse#16). The image does the heavy lifting
(installs old binaries, runs pg_upgrade into the versioned PGDATA); a thin
cc-db-entrypoint.sh wrapper fills the two gaps it leaves:

- secrets: inject DB_PASSWORD/POSTGRES_PASSWORD from the docker secret (the
  image reads them from env, no *_FILE support);
- install user: detect the old cluster's bootstrap superuser (oid 10) and
  export POSTGRES_USER so pg_upgrade + the new cluster's initdb match it. Real
  deployments differ (bitnami-origin clusters install as 'postgres' + a
  'discourse' app role; others as 'discourse'). The image hardcodes
  --username=$POSTGRES_USER and never detects this, so the adapter is required;
- checksums: pg18's initdb enables data checksums by default but pg13-17
  clusters here have them off, and pg_upgrade requires a match -> initdb the new
  cluster with --no-data-checksums unless the old one reports them on.

Other changes:
- mount postgresql_data at /var/lib/postgresql (versioned PGDATA .../18/docker)
- pg_backup.sh: detect the superuser at runtime; fix paths for the new layout
- bump DB_ENTRYPOINT_VERSION v6, PG_BACKUP_VERSION v3 (immutable swarm configs)
- drop entrypoint.postgres.sh.tmpl

Verified on cctest: upgrade from an existing pg17 cluster (install user
'postgres') -> pg18, all data preserved, serves over HTTPS via Traefik.
2026-06-22 16:55:12 +00:00

71 lines
2.7 KiB
Markdown

# Discourse
[![Build Status](https://build.coopcloud.tech/api/badges/coop-cloud/discourse/status.svg?ref=refs/heads/main)](https://build.coopcloud.tech/coop-cloud/discourse)
A platform for community discussion
<!-- metadata -->
* **Category**: Apps
* **Status**: 3, experimental
* **Image**: [`discourse/discourse`](https://hub.docker.com/r/discourse/discourse), 4, upstream
* **Healthcheck**: yes
* **Backups**: yes
* **Email**: yes
* **Tests**: yes
* **SSO**: no
<!-- endmetadata -->
> **Note**: this recipe runs the official, **experimental** `discourse/discourse`
> image. Upstream does not yet recommend it for production — see
> <https://meta.discourse.org/t/380646>. Use with care.
## Basic usage
1. Set up Docker Swarm and [`abra`]
2. Deploy [`coop-cloud/traefik`]
3. `abra app new discourse --secrets`
4. `abra app config YOURAPPDOMAIN` — set `DOMAIN` and `DISCOURSE_DEVELOPER_EMAILS`
5. `abra app deploy YOURAPPDOMAIN`
6. Open the configured domain in your browser to finish set-up. The first account
that registers with an address listed in `DISCOURSE_DEVELOPER_EMAILS` becomes
an admin.
[`abra`]: https://docs.coopcloud.tech/abra/
[`coop-cloud/traefik`]: https://git.coopcloud.tech/coop-cloud/traefik
The app serves plain HTTP on port 80; Traefik terminates TLS in front of it. The
image's built-in nginx/Let's Encrypt is disabled by the recipe (`install-ssl`
override) so it works behind the reverse proxy.
## Add an admin user
```
abra app run YOURAPPDOMAIN app discourse admin create
```
## Postgres major version upgrades
Handled automatically by the [`discourse/postgres`] image (pgvector + an
auto-upgrade layer). On deploy it finds an older cluster, installs the old
binaries and runs `pg_upgrade` into the new versioned data directory. The recipe
adds a small entrypoint wrapper that injects the password secret and detects the
old cluster's real install superuser (oid 10), so the upgrade works whether that
user is `postgres` or `discourse`. No manual dump/restore needed.
[`discourse/postgres`]: https://github.com/discourse/discourse-postgres
## Migrating from the previous (bitnami) recipe
The official image stores uploads under `/shared` rather than bitnami's
`/bitnami/discourse`. On first boot the recipe copies uploads + backups from the
old bitnami volume (mounted read-only at `/legacy`) into `/shared`, once,
idempotently. The Postgres database is reused as-is. After a successful migration
a later recipe version will drop the transitional `/legacy` mount.
If you are upgrading from the bitnami recipe, also remove the now-unused sidekiq
service that swarm leaves behind (sidekiq runs inside the app container now):
```
docker service rm YOURSTACK_sidekiq
```