Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
Christian Galo | 8897924813 | |
Christian Galo | 4cde5121b7 |
23
.drone.yml
23
.drone.yml
|
@ -1,23 +0,0 @@
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
name: deploy to swarm-test.autonomic.zone
|
|
||||||
steps:
|
|
||||||
- name: deployment
|
|
||||||
image: git.coopcloud.tech/coop-cloud/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
|
|
||||||
networks:
|
|
||||||
- proxy
|
|
||||||
environment:
|
|
||||||
DOMAIN: discourse.swarm-test.autonomic.zone
|
|
||||||
STACK_NAME: discourse
|
|
||||||
LETS_ENCRYPT_ENV: production
|
|
||||||
SECRET_DB_PASSWORD_VERSION: v1
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- main
|
|
21
.env.sample
21
.env.sample
|
@ -1,21 +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=
|
|
||||||
# Set this if you send e-mails from a different domain than noreply@$DOMAIN
|
|
||||||
#DISCOURSE_NOTIFICATION_EMAIL=$SMTP_USER
|
|
||||||
|
|
||||||
# SMTP authentication
|
|
||||||
#COMPOSE_FILE="compose.yml:compose.smtpauth.yml"
|
|
||||||
#SECRET_SMTP_PASSWORD_VERSION=v1
|
|
||||||
|
|
||||||
SECRET_DB_PASSWORD_VERSION=v1
|
|
|
@ -0,0 +1 @@
|
||||||
|
.env
|
76
README.md
76
README.md
|
@ -1,72 +1,24 @@
|
||||||
# Discourse
|
# 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 -->
|
## Deploying the app with Docker Swarm
|
||||||
* **Category**: Apps
|
|
||||||
* **Status**:
|
|
||||||
* **Image**: [`bitnami/discourse`](https://hub.docker.com/r/bitname/discourse)
|
|
||||||
* **Healthcheck**: yes
|
|
||||||
* **Backups**: no
|
|
||||||
* **Email**: yes
|
|
||||||
* **Tests**: no
|
|
||||||
* **SSO**: no
|
|
||||||
<!-- endmetadata -->
|
|
||||||
|
|
||||||
## 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`]
|
set -a && source .env && set +a
|
||||||
3. `abra app new discourse --secrets` (optionally with `--pass` if you'd like
|
```
|
||||||
to save secrets in `pass`)
|
|
||||||
4. `abra app config YOURAPPDOMAIN` - be sure to change `$DOMAIN` to something that resolves to
|
|
||||||
your Docker swarm box
|
|
||||||
5. `abra app deploy YOURAPPDOMAIN`
|
|
||||||
6. Open the configured domain in your browser to finish set-up
|
|
||||||
|
|
||||||
[`abra`]: https://git.autonomic.zone/autonomic-cooperative/abra
|
Set the secrets.
|
||||||
[`coop-cloud/traefik`]: https://git.autonomic.zone/coop-cloud/traefik
|
|
||||||
|
|
||||||
## 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`
|
Deploy using the `-c` flag to specify one or multiple compose files.
|
||||||
2. `cd /opt/bitnami/discourse`
|
|
||||||
3. `RAILS_ENV=production bundle exec rake admin:create` and follow prompts.
|
|
||||||
|
|
||||||
## Install plugins
|
```
|
||||||
|
docker stack deploy discourse -c compose.yaml -c compose.smtpauth.yaml
|
||||||
1. Login to instance `abra app run APPNAME app sh`
|
```
|
||||||
2. `cd /bitnami/discourse/plugins/`
|
|
||||||
3. `git clone plugin.git` for example `https://github.com/discourse/discourse-openid-connect.git`
|
|
||||||
4. `abra app restart YOURAPPDOMAIN app`
|
|
||||||
|
|
||||||
### Events / calendar plugin
|
|
||||||
|
|
||||||
We've had some luck running [discourse-events](https://github.com/paviliondev/discourse-events).
|
|
||||||
|
|
||||||
## Setup Notes
|
|
||||||
|
|
||||||
Until issue #1 is fixed, the default user is `user` and the default password is `bitnami123`
|
|
||||||
|
|
||||||
## Postgres major version upgrades
|
|
||||||
|
|
||||||
Welcome to hell.
|
|
||||||
|
|
||||||
1. `abra app run YOURAPPDOMAIN db pg_dumpall -U discourse | gzip > YOURAPPDOMAIN_db_DATE.sql.gz`
|
|
||||||
2. `abra app volume ls YOURAPPDOMAIN`, find the name of the Postgres data volume
|
|
||||||
3. `scp` the backup to your VPS
|
|
||||||
4. `abra app undeploy YOURAPPDOMAIN`
|
|
||||||
5. `abra app volume rm YOURAPPDOMAIN`, choose the Postgres data volume
|
|
||||||
6. `abra app deploy YOURAPPDOMAIN`, then `abra app undeploy YOURAPPDOMAIN`
|
|
||||||
7. `ssh` to the VPS, run (replacing `13-alpine` with the new Postgres version)
|
|
||||||
`docker run -v YOURDATAVOLUME:/var/lib/postgresql/data -e POSTGRES_HOST_AUTH_METHOD=trust -it postgres:13-alpine`
|
|
||||||
8. In another SSH session on the server, run `docker ps` to find the ID of the
|
|
||||||
new Postgres container, then `docker exec -it CONTAINERID bash`
|
|
||||||
9. In the shell you just launched, run `dropdb -U discourse discourse`, then
|
|
||||||
`createdb -U discourse discourse`, then Ctrl+D or run `exit`
|
|
||||||
10. In the second SSH session, run `zcat YOURAPPDOMAIN_db_DATE.sql.gz | docker exec -it CONTAINERID psql -U discourse`
|
|
||||||
11. Exit the second SSH session
|
|
||||||
12. Back in the first SSH session, Ctrl+C to shut down the database
|
|
||||||
13. `abra app deploy YOURAPPDOMAIN`
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
---
|
|
||||||
version: "3.8"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
environment:
|
environment:
|
||||||
|
@ -17,4 +14,4 @@ services:
|
||||||
secrets:
|
secrets:
|
||||||
smtp_password:
|
smtp_password:
|
||||||
external: true
|
external: true
|
||||||
name: ${STACK_NAME}_smtp_password_${SECRET_SMTP_PASSWORD_VERSION}
|
name: ${STACK_NAME}_smtp_password
|
|
@ -1,9 +1,6 @@
|
||||||
---
|
|
||||||
version: "3.8"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: bitnami/discourse:3.0.6
|
image: bitnami/discourse:3.1.1
|
||||||
networks:
|
networks:
|
||||||
- proxy
|
- proxy
|
||||||
- internal
|
- internal
|
||||||
|
@ -39,11 +36,6 @@ services:
|
||||||
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
|
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
|
||||||
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
||||||
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
- "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}"
|
|
||||||
- "coop-cloud.${STACK_NAME}.version=0.5.0+3.0.6"
|
|
||||||
# healthcheck:
|
# healthcheck:
|
||||||
# test: ["CMD", "curl", "-f", "http://localhost:3000"]
|
# test: ["CMD", "curl", "-f", "http://localhost:3000"]
|
||||||
# interval: 30s
|
# interval: 30s
|
||||||
|
@ -114,7 +106,7 @@ services:
|
||||||
secrets:
|
secrets:
|
||||||
db_password:
|
db_password:
|
||||||
external: true
|
external: true
|
||||||
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
|
name: ${STACK_NAME}_db_password
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgresql_data:
|
postgresql_data:
|
||||||
|
@ -128,6 +120,6 @@ networks:
|
||||||
|
|
||||||
configs:
|
configs:
|
||||||
db_entrypoint:
|
db_entrypoint:
|
||||||
name: ${STACK_NAME}_db_entrypoint_${DB_ENTRYPOINT_VERSION}
|
name: ${STACK_NAME}_db_entrypoint
|
||||||
file: entrypoint.postgres.sh.tmpl
|
file: entrypoint.postgres.sh.tmpl
|
||||||
template_driver: golang
|
template_driver: golang
|
Loading…
Reference in New Issue