Compare commits

..
66 Commits
Author SHA1 Message Date
Christian Galo 421ddc8888 Drop the legacy bitnami volume now that uploads are migrated 2026-11-08 00:29:57 -06:00
Christian Galo ea7a45a438 Drop --no-data-checksums; discourse/postgres:pg18 now disables checksums itself before pg_upgrade and fails if initdb already did 2026-11-08 00:11:20 -06:00
Christian Galo 8210de07a5 Merge branch 'main' of git.coopcloud.tech:coop-cloud/discourse 2026-11-08 00:11:20 -06:00
notplants 630cba809d chore: publish 1.1.3+2026.7.4 release
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is failing
2026-11-02 14:33:03 -05:00
autonomic-bot 5906ec9269 chore: upgrade app to discourse/discourse:2026.7.4
continuous-integration/drone/push Build is failing
2026-10-30 02:28:39 +00:00
trav 7adb714307 chore: publish 1.1.2+2026.7.3 release
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is failing
2026-10-05 10:05:52 -07:00
autonomic-bot 3f2384fd0e chore: upgrade app to discourse/discourse:2026.7.3
continuous-integration/drone/push Build is failing
2026-09-28 20:20:28 +00:00
trav d1f9b66a2e chore: publish 1.1.1+2026.7.2 release
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is failing
2026-09-21 09:37:58 -07:00
trav 3c81abc2a1 Merge pull request 'chore: upgrade app to discourse/discourse:2026.7.2' (#19) from upgrade-89420d3 into main
continuous-integration/drone/push Build is failing
Reviewed-on: #19
2026-09-21 16:37:23 +00:00
autonomic-bot 89420d3f0c chore: upgrade app to discourse/discourse:2026.7.2
continuous-integration/drone/pr Build is failing
2026-08-28 02:34:00 +00:00
notplants 5878b3ed09 fix version of release notes to be correctly at 1.0.0+3.5.3 (I incorrectly created a tag manually last time, instead of using abra app release)
continuous-integration/drone/push Build is failing
2026-08-10 16:44:18 -04:00
notplants 77f4a7350b chore: publish 1.1.0+2026.7.1 release
continuous-integration/drone/push Build is failing
continuous-integration/drone/tag Build is passing
2026-08-10 16:38:18 -04:00
notplants fdf62b4257 Merge pull request 'Upgrade to discourse:2026.7.1' (#17) from upgrade-c10c04c into main
continuous-integration/drone/push Build is failing
Reviewed-on: #17
2026-08-10 20:37:21 +00:00
autonomic-bot f8dcc78013 chore: merge upstream main into the upgrade branch
continuous-integration/drone/pr Build is failing
The branch predated the official-image migration (coop-cloud/discourse#16), so its
merge-base was 0.8.1+3.5.0 and the PR's file list re-showed that migration's changes
as if this PR introduced them. The branch TREE already matched upstream; only its
history lacked those commits. Recording the merge leaves the PR's diff as what it
actually changes: app 3.5.3 -> 2026.7.1 and redis 7.4-alpine -> 8.10-alpine.

Conflict in compose.yml resolved in favour of the branch (both sides edited the same
image lines; the branch already carries upstream's official-image switch plus the
version bumps). Resulting tree is byte-identical to the pre-merge branch tree.
2026-08-10 20:34:10 +00:00
autonomic-bot bfa21bc44e chore: upgrade app to 2026.7.1, redis to 8.10-alpine 2026-08-03 22:24:21 +00:00
autonomic-bot 0d7519e9ef chore: upgrade app 3.5.3 -> 2026.1.5, redis 7.4-alpine -> 8.8-alpine 2026-07-13 17:59:04 +00:00
notplants 9d5c8ae3ca Merge pull request 'switch app to official discourse/discourse image (with idempotent migration)' (#16) from discourse-official into main
continuous-integration/drone/push Build is failing
continuous-integration/drone/tag Build is passing
Reviewed-on: #16
2026-07-07 22:17:09 +00:00
notplants 1096c38e34 Update release/next
continuous-integration/drone/pr Build is failing
2026-07-07 22:10:56 +00:00
notplants 1f77af93bd feat(db): switch to discourse/postgres image (auto-upgrade)
continuous-integration/drone/pr Build is failing
Move the db off the bitnami-era pgvector:pg17 + hand-rolled pg_upgrade entrypoint
to discourse/postgres:pg18 (pgvector + discourse's auto-upgrade layer). The image
runs the in-place major-version pg_upgrade itself on boot; the recipe configures it
via env:

- a small inline entrypoint injects the db password secret into $DB_PASSWORD (the
  image expects it in the env, no *_FILE support)
- POSTGRES_USER (the install user pg_upgrade must match) defaults to 'postgres' --
  correct for fresh installs and bitnami-origin clusters -- overridable from .env
- POSTGRES_INITDB_ARGS=--no-data-checksums so the new pg18 cluster matches pre-18
  clusters (pg18 initdb enables checksums by default; pg_upgrade needs a match)

- mount postgresql_data at /var/lib/postgresql (versioned PGDATA .../18/docker)
- pg_backup.sh uses POSTGRES_USER for the dump/drop/recreate; fix paths
- document the POSTGRES_USER override in .env.sample, README and the release note
- drop entrypoint.postgres.sh.tmpl

Tested on cctest: pg17->pg18 upgrade preserves data and serves over HTTPS; fresh
install works; backup+restore round-trips.
2026-06-22 19:57:54 +00:00
autonomic-bot c10c04c520 chore: upgrade redis 7.4-alpine -> 8.8-alpine 2026-06-19 02:21:36 +00:00
notplants 0c4539b7ad feat(discourse): switch app to official discourse/discourse image (experimental)
continuous-integration/drone/pr Build is failing
Replaces the paywalled bitnamilegacy app with the official discourse/discourse
image behind Traefik. DB is reused as-is; uploads migrate from the legacy
bitnami volume idempotently. The wrapper entrypoint injects the db_password and
smtp_password secrets (the official image has no *_FILE support). SMTP env vars
are renamed to the official names; release notes cover the migration.

Recipe 0.8.1+3.5.0 -> 1.0.0+3.5.3 (major: new image, env/volume/port changes).
2026-06-18 21:59:34 +00:00
notplants f87c612d71 chore: publish 0.8.1+3.5.0 release
continuous-integration/drone/push Build is failing
continuous-integration/drone/tag Build is passing
2026-06-16 14:46:48 -04:00
notplants 2b28de444d Merge pull request 'fix(db): make pg_upgrade 13->17 idempotent and use the cluster's real install user' (#15) from idempotent into main
continuous-integration/drone/push Build is failing
Reviewed-on: #15
2026-06-16 18:36:01 +00:00
notplants a9f08eed28 fix(db): make pg_upgrade 13->17 idempotent and use the cluster's real install user
continuous-integration/drone/pr Build is failing
2026-06-16 18:29:24 +00:00
notplants 7e4d85a810 Merge pull request 'Fix backup/restore' (#14) from fix-restore into main
continuous-integration/drone/push Build is failing
Reviewed-on: #14
2026-06-15 17:33:39 +00:00
notplants b0f9ae743a fix(db): switch postgres image to pgvector/pgvector:pg17 + bump PG_BACKUP_VERSION
continuous-integration/drone/pr Build is failing
continuous-integration/drone/tag Build is passing
2026-06-02 20:07:06 +00:00
notplants 5091fd999e improved comments
continuous-integration/drone/pr Build is failing
2026-06-02 19:10:27 +00:00
notplants ec7bbdf786 fix(backup): add pg_backup.sh + proper backup/restore hooks, 20m start_period 2026-06-02 19:10:27 +00:00
notplants 0f873433ba chore: upgrade to 0.8.0+3.5.0 2026-06-02 19:10:27 +00:00
decentral1se 7d53d4ec39 Merge pull request 'Update README.md corrected url to bitnami/discourse' (#12) from jeppebundsgaard/discourse:main into main
continuous-integration/drone/push Build is failing
Reviewed-on: #12
Reviewed-by: decentral1se <decentral1se@noreply.git.coopcloud.tech>
2025-12-28 09:32:18 +00:00
jeppebundsgaard ee2381c3b7 Update README.md
continuous-integration/drone/pr Build is failing
2025-12-28 02:04:01 +00:00
Christian Galo b7e23a690e update readme 2025-02-19 08:31:44 +00:00
cas 63d3801060 Update .drone.yml
continuous-integration/drone/push Build is passing
2025-01-08 10:09:12 -08:00
3wordchant fee61883ed Fix CI, add auto recipe catalogue generation
continuous-integration/drone/push Build is passing
2024-10-02 15:44:50 -04:00
3wordchant eb96de947b chore: publish 0.7.0+3.3.1 release
continuous-integration/drone/push Build is failing
2024-10-02 15:42:31 -04:00
Christian Galo fac465fe99 chore: update Discourse version to 3.2.2 2024-06-11 02:22:32 +00:00
knoflook ddda5da6bc chore: publish new release
continuous-integration/drone/push Build is failing
2023-10-20 15:54:13 +02:00
3wordchant 304468b8f4 chore: publish 0.6.2+3.1.1 release
continuous-integration/drone/push Build is failing
2023-10-19 11:04:19 +01:00
3wordchant 0ccf1d7a6c Fix healthcheck, sidekiq on proxy network
continuous-integration/drone/push Build is failing
2023-10-19 11:03:42 +01:00
Christian Galo 8897924813 update README and Discourse version 2023-10-16 23:18:58 +00:00
3wordchant 1049c27c35 chore: publish 0.6.1+3.1.1 release
continuous-integration/drone/push Build is failing
2023-10-08 18:41:20 +01:00
3wordchant 03dc80d073 Add healthcheck for app container
continuous-integration/drone/push Build is failing
2023-10-08 18:40:49 +01:00
3wordchant 300f374af9 chore: publish 0.6.0+3.1.1 release
continuous-integration/drone/push Build is failing
2023-10-03 19:13:06 +01:00
Christian Galo 4cde5121b7 ¿Abra? No. ¡Cierre! 2023-09-08 06:15:14 +00:00
3wordchant ec72949bfa chore: publish 0.5.0+3.0.6 release
continuous-integration/drone/push Build is failing
2023-08-21 15:57:39 +02:00
3wordchant 6a5f20bc8a Add postgres major version upgrade script 2023-08-21 15:56:57 +02:00
3wordchant 3b5d789390 chore: publish 0.4.1+3.0.6 release
continuous-integration/drone/push Build is passing
2023-08-21 14:20:29 +02:00
3wordchant 22b8f8f265 Drop separate Sidekiq vol, it should use the main one
continuous-integration/drone/push Build is passing
2023-03-20 13:35:04 -04:00
decentral1se 5868b83948 docs: events plugin
continuous-integration/drone/push Build is passing
2023-02-09 12:58:47 +01:00
decentral1se 5bef03aabd chore: publish 0.4.0+3.0.1 release
continuous-integration/drone/push Build is passing
2023-02-09 12:57:24 +01:00
decentral1se 0c7847ac15 fix: sort + PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY = 0 2023-02-09 12:56:48 +01:00
3wordchant 7fc57c52a5 Switch to self-hosted stack-ssh-deploy image [mass update]
continuous-integration/drone/push Build is passing
2023-01-21 11:49:55 -08:00
3wordchant fd24d4a328 Update abra syntax in examples (finally) [mass update]
continuous-integration/drone/push Build is passing
2023-01-19 16:02:27 -08:00
3wordchant 1240106d4d Add rudimentary database backup, and Postgres upgrade misery
continuous-integration/drone/push Build is passing
2022-11-22 18:42:42 -08:00
3wordchant add7b1e240 Clarify DISCOURSE_DATABASE_HOST
continuous-integration/drone/push Build is passing
2022-11-22 18:16:10 -08:00
3wordchant 802a22886c Remove vim swapfile 2022-11-22 13:34:06 -08:00
knoflook d1fcc7a6fa chore: publish 0.3.1+2.8.9 release
continuous-integration/drone/push Build is passing
2022-11-22 15:59:26 +01:00
knoflook 41f7c0089e feat: set notification e-mail
continuous-integration/drone/push Build is passing
2022-11-22 15:58:04 +01:00
3wordchant fa42eedcfc chore: publish 0.3.0+2.8.9 release
continuous-integration/drone/push Build is passing
2022-10-18 22:44:24 -04:00
3wordchant 0376930563 chore: publish 0.2.1+2.8.9 release
continuous-integration/drone/push Build is passing
2022-10-18 22:09:59 -04:00
3wordchant 0b2759f9ee Add proxy network for drone
continuous-integration/drone/push Build is passing
2022-03-26 01:37:26 +02:00
3wordchant fa5c18672b chore: publish 0.2.0+2.8.1 release
continuous-integration/drone/push Build is failing
2022-03-23 00:33:07 +02:00
3wordchant ab7d90edd8 chore: publish 0.1.0+2.7.7 release
continuous-integration/drone/push Build is failing
2022-03-23 00:30:52 +02:00
3wordchant fd814bd562 Revert to stable discourse version
continuous-integration/drone/push Build is passing
2021-11-30 12:43:40 +02:00
3wordchant fb6e1dfc4f Update Discourse to 2.8.0
continuous-integration/drone/push Build is passing
2021-11-21 21:49:10 +02:00
3wordchant 6b21fabe8f Merge pull request 'Add some useful instructions for setting up users and installing plugins' (#2) from cas_readme into main
continuous-integration/drone/push Build is passing
Reviewed-on: #2
2021-11-16 19:15:29 +00:00
12 changed files with 276 additions and 210 deletions
-21
View File
@@ -1,21 +0,0 @@
---
kind: pipeline
name: deploy to swarm-test.autonomic.zone
steps:
- name: deployment
image: decentral1se/stack-ssh-deploy:latest
settings:
host: swarm-test.autonomic.zone
stack: discourse
generate_secrets: true
purge: true
deploy_key:
from_secret: drone_ssh_swarm_test
environment:
DOMAIN: discourse.swarm-test.autonomic.zone
STACK_NAME: discourse
LETS_ENCRYPT_ENV: production
SECRET_DB_PASSWORD_VERSION: v1
trigger:
branch:
- main
-19
View File
@@ -1,19 +0,0 @@
TYPE=discourse
DOMAIN=discourse.example.com
## Domain aliases
#EXTRA_DOMAINS=', `www.discourse.example.com`'
LETS_ENCRYPT_ENV=production
# Outgoing email
#DISCOURSE_SMTP_HOST=
#DISCOURSE_SMTP_PORT=
#DISCOURSE_SMTP_USER=
#DISCOURSE_SMTP_PROTOCOL=
#DISCOURSE_SMTP_AUTH=
# SMTP authentication
#COMPOSE_FILE="compose.yml:compose.smtpauth.yml"
#SECRET_SMTP_PASSWORD_VERSION=v1
SECRET_DB_PASSWORD_VERSION=v1
+1
View File
@@ -0,0 +1 @@
.env
+14 -37
View File
@@ -1,47 +1,24 @@
# 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)
Wiki Cafe's configuration for a Discourse deployment. Originally slimmed down from an `abra` [recipe](https://git.coopcloud.tech/coop-cloud/discourse) by [Co-op Cloud](https://coopcloud.tech/).
A platform for community discussion
<!-- metadata -->
* **Category**: Apps
* **Status**:
* **Image**: [`bitnami/discourse`](https://hub.docker.com/r/bitname/discourse)
* **Healthcheck**: yes
* **Backups**: no
* **Email**: yes
* **Tests**: no
* **SSO**: no
<!-- endmetadata -->
## Deploying the app with Docker Swarm
## Basic usage
Set the environment variables from the .env file during the shell session.
1. Set up Docker Swarm and [`abra`]
2. Deploy [`coop-cloud/traefik`]
3. `abra app new discourse --secrets` (optionally with `--pass` if you'd like
to save secrets in `pass`)
4. `abra app YOURAPPDOMAIN config` - be sure to change `$DOMAIN` to something that resolves to
your Docker swarm box
5. `abra app YOURAPPDOMAIN deploy`
6. Open the configured domain in your browser to finish set-up
```
set -a && source .env && set +a
```
[`abra`]: https://git.autonomic.zone/autonomic-cooperative/abra
[`coop-cloud/traefik`]: https://git.autonomic.zone/coop-cloud/traefik
Set the secrets.
## To add a new Admin user
```
printf "SECRET_HERE" | docker secret create SECRET_NAME -
```
1. Login to the instance `abra app run APPNAME app sh`
2. `cd /opt/bitnami/discourse`
3. `RAILS_ENV=production bundle exec rake admin:create` and follow prompts.
Deploy using the `-c` flag to specify one or multiple compose files.
## Install plugins
1. Login to instance `abra app run APPNAME app sh`
2. `cd /bitnami/discourse/plugins/`
3. `git clone plugingit` for example `https://github.com/discourse/discourse-openid-connect.git`
4. `abra app restart APPNAME app`
## Setup Notes
Until issue #1 is fixed, the default user is `user` and the default password is `bitnami123`
```
docker stack deploy discourse --detach=true -c compose.yaml -c compose.smtpauth.yaml
```
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
# Overrides the official image's /etc/runit/1.d/install-ssl.
#
# The stock install-ssl always runs configure-ssl (and configure-letsencrypt),
# which empties the default `listen 80` nginx outlet and switches to `listen 443
# ssl` against a cert that does not exist here — nginx then crash-loops, or the
# image tries to obtain its own Let's Encrypt cert. Under Co-op Cloud, Traefik
# terminates TLS and proxies plain HTTP to port 80, so we skip the image's SSL
# setup entirely and let nginx keep its default HTTP-on-80 config.
echo "install-ssl overridden by recipe: serving plain HTTP on :80 behind Traefik"
exit 0
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
# Co-op Cloud wrapper around the official image's /sbin/boot.
# discourse/discourse reads passwords from the process env (pups/Ruby; it has no
# *_FILE support), so inject them from the docker secrets before booting.
set -e
if [ -f /run/secrets/db_password ]; then
export DISCOURSE_DB_PASSWORD="$(cat /run/secrets/db_password)"
fi
if [ -f /run/secrets/smtp_password ]; then
export DISCOURSE_SMTP_PASSWORD="$(cat /run/secrets/smtp_password)"
fi
exec /sbin/boot
+11
View File
@@ -0,0 +1,11 @@
services:
app:
# the wrapper entrypoint reads /run/secrets/smtp_password and exports
# DISCOURSE_SMTP_PASSWORD (the official image has no *_FILE support)
secrets:
- smtp_password
secrets:
smtp_password:
external: true
name: ${STACK_NAME}_smtp_password
-20
View File
@@ -1,20 +0,0 @@
---
version: "3.8"
services:
app:
environment:
- DISCOURSE_SMTP_PASSWORD_FILE=/var/run/secrets/smtp_password
secrets:
- smtp_password
sidekiq:
environment:
- DISCOURSE_SMTP_PASSWORD_FILE=/var/run/secrets/smtp_password
secrets:
- smtp_password
secrets:
smtp_password:
external: true
name: ${STACK_NAME}_smtp_password_${SECRET_SMTP_PASSWORD_VERSION}
+153
View File
@@ -0,0 +1,153 @@
services:
app:
image: discourse/discourse:2026.7.4
networks:
- proxy
- internal
# official image CMD is /sbin/boot; wrapper injects the DB password secret first
entrypoint: /usr/local/bin/cc-app-entrypoint.sh
environment:
- DISCOURSE_HOSTNAME=${DOMAIN}
- DISCOURSE_DEVELOPER_EMAILS=${DISCOURSE_DEVELOPER_EMAILS}
- DISCOURSE_DB_HOST=${STACK_NAME}_db
- DISCOURSE_DB_PORT=5432
- DISCOURSE_DB_NAME=discourse
- DISCOURSE_DB_USERNAME=discourse
- DISCOURSE_REDIS_HOST=${STACK_NAME}_redis
- DISCOURSE_REDIS_PORT=6379
- DISCOURSE_SMTP_ADDRESS
- DISCOURSE_SMTP_PORT
- DISCOURSE_SMTP_USER_NAME
- DISCOURSE_SMTP_PASSWORD
- DISCOURSE_SMTP_AUTHENTICATION
- DISCOURSE_SMTP_ENABLE_START_TLS
- DISCOURSE_NOTIFICATION_EMAIL
volumes:
- 'discourse_shared:/shared'
secrets:
- db_password
configs:
- source: app_entrypoint
target: /usr/local/bin/cc-app-entrypoint.sh
mode: 0555
- source: app_install_ssl
target: /etc/runit/1.d/install-ssl
mode: 0555
- source: app_migrate_uploads
target: /etc/runit/1.d/02-migrate-bitnami-uploads
mode: 0555
depends_on:
- db
- redis
deploy:
update_config:
failure_action: rollback
order: stop-first
labels:
- "traefik.enable=true"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
- "caddy=${DOMAIN}"
- "caddy.reverse_proxy={{upstreams 80}}"
- "caddy.tls.on_demand="
healthcheck:
test: "curl -fsS http://localhost/srv/status || exit 1"
interval: 30s
timeout: 10s
retries: 6
start_period: 25m
db:
# discourse/postgres = pgvector + discourse's postgres management layer, which
# auto-upgrades an older cluster in place on boot (pg_upgrade into the versioned
# PGDATA /var/lib/postgresql/${MAJOR}/docker); everything is driven by the env below.
image: discourse/postgres:pg18
networks:
- internal
secrets:
- db_password
volumes:
# the image expects the whole cluster tree mounted here (not the data subdir);
# an existing pg17 cluster at the volume root is found and upgraded into /18/docker
- 'postgresql_data:/var/lib/postgresql'
configs:
- source: pg_backup
target: /pg_backup.sh
mode: 0555
entrypoint:
- /bin/bash
- -c
- |
if [ -f /run/secrets/db_password ]; then
DB_PASSWORD="$$(cat /run/secrets/db_password)"
export DB_PASSWORD POSTGRES_PASSWORD="$$DB_PASSWORD"
fi
exec run-postgres.sh postgres
environment:
# internal-only overlay network; keep all-trust so the app and the
# backup/restore hooks connect without juggling the superuser password
- POSTGRES_HOST_AUTH_METHOD=trust
- POSTGRES_DB=discourse
- DB_USER=discourse
# pg_upgrade runs as this role and initdb's the new cluster with it; it must
# match the OLD cluster's bootstrap superuser (oid 10). The image default
# `postgres` matches fresh installs and bitnami-origin clusters. Override in
# the app .env (POSTGRES_USER=...) only for a cluster bootstrapped differently.
- POSTGRES_USER=${POSTGRES_USER:-postgres}
healthcheck:
test: "pg_isready -U discourse -d discourse"
interval: 30s
timeout: 10s
retries: 5
start_period: 15m
deploy:
labels:
backupbot.backup: "true"
backupbot.backup.pre-hook: "/pg_backup.sh backup"
backupbot.backup.volumes.postgresql_data.path: "backup.sql"
backupbot.restore.post-hook: "/pg_backup.sh restore"
redis:
image: redis:8.10-alpine
networks:
- internal
volumes:
- 'redis_data:/data'
healthcheck:
test: "redis-cli ping | grep -q PONG"
interval: 30s
timeout: 5s
retries: 5
start_period: 30s
secrets:
db_password:
external: true
name: ${STACK_NAME}_db_password
volumes:
postgresql_data:
redis_data:
discourse_shared:
networks:
proxy:
external: true
internal:
configs:
app_entrypoint:
name: ${STACK_NAME}_app_entrypoint
file: cc-app-entrypoint.sh
app_install_ssl:
name: ${STACK_NAME}_app_install_ssl
file: app-install-ssl.sh
app_migrate_uploads:
name: ${STACK_NAME}_app_migrate_uploads
file: migrate-uploads.sh
pg_backup:
name: ${STACK_NAME}_pg_backup
file: pg_backup.sh
-113
View File
@@ -1,113 +0,0 @@
---
version: "3.8"
services:
app:
image: bitnami/discourse:2.7.7
networks:
- proxy
- internal
# entrypoint: ['tail', '-f', '/dev/null']
environment:
- ALLOW_EMPTY_PASSWORD=yes
- DISCOURSE_HOST=${DOMAIN}
- DISCOURSE_DATABASE_HOST=db
- DISCOURSE_DATABASE_USER=discourse
- DISCOURSE_DATABASE_NAME=discourse
- DISCOURSE_DATABASE_PASSWORD_FILE=/run/secrets/db_password
- DISCOURSE_SMTP_HOST
- DISCOURSE_SMTP_PORT
- DISCOURSE_SMTP_USER
- DISCOURSE_SMTP_PROTOCOL
- DISCOURSE_SMTP_AUTH
volumes:
- 'discourse_data:/bitnami/discourse'
secrets:
- db_password
depends_on:
- db
- redis
deploy:
update_config:
failure_action: rollback
order: start-first
labels:
- "traefik.enable=true"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=3000"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
## Redirect from EXTRA_DOMAINS to DOMAIN
#- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 10
start_period: 1m
db:
image: postgres:11-alpine
networks:
- internal
secrets:
- db_password
volumes:
- 'postgresql_data:/var/lib/postgresql/data'
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
- POSTGRES_USER=discourse
- POSTGRES_DB=discourse
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
redis:
image: redis:6.0-alpine
networks:
- internal
volumes:
- 'redis_data:/data'
sidekiq:
image: bitnami/discourse:2.7.7
networks:
- internal
depends_on:
- discourse
volumes:
- 'sidekiq_data:/bitnami/discourse'
command: /opt/bitnami/scripts/discourse-sidekiq/run.sh
secrets:
- db_password
environment:
- ALLOW_EMPTY_PASSWORD=yes
- DISCOURSE_HOST=${DOMAIN}
- DISCOURSE_DATABASE_HOST=db
- DISCOURSE_DATABASE_PORT_NUMBER=5432
- DISCOURSE_DATABASE_USER=discourse
- DISCOURSE_DATABASE_NAME=discourse
- DISCOURSE_REDIS_HOST=redis
- DISCOURSE_REDIS_PORT_NUMBER=6379
- DISCOURSE_DATABASE_PASSWORD_FILE=/run/secrets/db_password
- DISCOURSE_SMTP_HOST
- DISCOURSE_SMTP_PORT
- DISCOURSE_SMTP_USER
- DISCOURSE_SMTP_PROTOCOL
- DISCOURSE_SMTP_AUTH
secrets:
db_password:
external: true
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
volumes:
postgresql_data:
redis_data:
discourse_data:
sidekiq_data:
networks:
proxy:
external: true
internal:
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
# One-time, idempotent, NON-destructive migration of uploads + backups from a
# legacy bitnami discourse volume into the official image's /shared.
#
# Runs on every boot as a runit 1.d hook but no-ops after the first success
# (sentinel) and when there is no legacy volume mounted (fresh installs). It only
# ever COPIES from the read-only /legacy mount, so an interruption just re-copies
# on the next boot — there is no move/delete to leave the data half-migrated.
set -e
SENTINEL=/shared/.bitnami-uploads-migrated
[ -e "$SENTINEL" ] && exit 0
if [ -d /legacy/public/uploads ]; then
echo "[migrate-uploads] copying bitnami uploads/backups -> /shared"
mkdir -p /shared/uploads /shared/backups
cp -a /legacy/public/uploads/. /shared/uploads/ 2>/dev/null || true
cp -a /legacy/public/backups/. /shared/backups/ 2>/dev/null || true
# discourse runs as uid 1000; the official boot also chowns /shared, but be explicit
chown -R discourse:discourse /shared/uploads /shared/backups 2>/dev/null || true
echo "[migrate-uploads] done"
fi
touch "$SENTINEL"
Executable
+47
View File
@@ -0,0 +1,47 @@
#!/bin/bash
# Postgres backup/restore hook for the discourse `db` service (discourse/postgres image).
set -e
# dump goes at the volume root so backupbot's backup.sql label finds it
BACKUP_FILE='/var/lib/postgresql/backup.sql'
DATADIR="${PGDATA:-/var/lib/postgresql/18/docker}"
DB_NAME="${POSTGRES_DB:-discourse}"
# bootstrap superuser for the dump/drop/recreate; same POSTGRES_USER the db service sets
SU="${POSTGRES_USER:-postgres}"
function backup {
pg_dump -U "$SU" "$DB_NAME" | gzip > "$BACKUP_FILE"
}
function restore {
cd "$DATADIR"
# Block all non-local connections so the running discourse app + sidekiq cannot reconnect and
# interfere with the drop/recreate/reimport. Restored on exit.
restore_hba() {
cat pg_hba.conf.bak > pg_hba.conf
rm -f pg_hba.conf.bak
su postgres -c "pg_ctl -D '$DATADIR' reload"
}
cp pg_hba.conf pg_hba.conf.bak
echo 'local all all trust' > pg_hba.conf
su postgres -c "pg_ctl -D '$DATADIR' reload"
trap restore_hba EXIT INT TERM
# terminate any lingering local sessions before recreate
# see https://stackoverflow.com/questions/5108876/kill-a-postgresql-session-connection
psql -U "$SU" -d postgres -c \
"SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='${DB_NAME}' AND pid<>pg_backend_pid();"
# drop database and then recreate it
psql -U "$SU" -d postgres -c "DROP DATABASE ${DB_NAME} WITH (FORCE);"
createdb -U "$SU" "$DB_NAME"
# reimport data
gunzip -c "$BACKUP_FILE" | psql -U "$SU" -d "$DB_NAME" -1 -v ON_ERROR_STOP=1 -f -
}
$@