Skip to content

Instantly share code, notes, and snippets.

@pfaffman
Created February 6, 2020 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfaffman/33aa73b2b7058d28f64452d04d547876 to your computer and use it in GitHub Desktop.
Save pfaffman/33aa73b2b7058d28f64452d04d547876 to your computer and use it in GitHub Desktop.
# this is the base templates used, you can cut it down to include less functionality per container
templates:
- "templates/web.template.yml"
- "templates/web.ratelimited.template.yml"
# which ports to expose?
expose:
- "8080:80"
links:
- link:
name: data
alias: data
params:
# git revision to run
version: tests-passed
upload_size: 320m
db_shared_buffers: "1024MB"
env:
UNICORN_WORKERS: 4
ENABLE_LOGRAGE: 1
## TODO: configure connectivity to the databases
DISCOURSE_DB_SOCKET: ''
DISCOURSE_DB_PASSWORD: "strong_password"
DISCOURSE_DB_HOST: data
DISCOURSE_REDIS_HOST: data
DISCOURSE_DEVELOPER_EMAILS: 'jay@literatecomputing.com'
DISCOURSE_HOSTNAME: 'support.literatecomputing.com'
DISCOURSE_SMTP_ADDRESS: smtp.mailgun.org
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: postmaster@literatecomputing.com
DISCOURSE_SMTP_PASSWORD: xxxx
DISCOURSE_AKISMET_API_KEY: xxxx
DISCOURSE_S3_ENDPOINT: ''
DISCOURSE_MAXIMUM_BACKUPS: 14
DISCOURSE_BACKUP_FREQUENCY: 1
DISCOURSE_AUTOMATIC_BACKUPS_ENABLED: true
DISCOURSE_S3_ACCESS_KEY_ID: 'key'
DISCOURSE_S3_SECRET_ACCESS_KEY: 'secrety'
DISCOURSE_BACKUP_LOCATION: 's3'
DISCOURSE_S3_BACKUP_BUCKET: 'my/backups'
DISCOURSE_S3_UPLOAD_BUCKET: 'my/uploads'
DISCOURSE_S3_CDN_URL: https://abedmulti-92e2.kxcdn.com/uploads
DISCOURSE_ENABLE_S3_UPLOADS: 'true'
DISCOURSE_S3_REGION: 'us-east-1'
DISCOURSE_BACKUP_UPLOADS_TO_S3_ENABLED: false
DISCOURSE_BACKUP_UPLOADS_TO_S3_BUCKET: my/support-uploads
DISCOURSE_BACKUP_UPLOADS_TO_S3_ACCESS_KEY_ID: keyid
DISCOURSE_BACKUP_UPLOADS_TO_S3_SECRET_ACCESS_KEY: secret
DISCOURSE_BACKUP_UPLOADS_TO_S3_REGION: 'us-east-1'
DISCOURSE_BACKUP_UPLOADS_TO_S3_ENCRYPTION_KEY: lock
DISCOURSE_MAXMIND_LICENSE_KEY: max
DISCOURSE_CDN_URL: https://lcsupport-92e2.kxcdn.com
# These containers are stateless, all the data is stored in /shared
volumes:
- volume:
host: /var/discourse/shared/webmulti
guest: /shared
- volume:
host: /var/discourse/shared/webmulti/log/var-log
guest: /var/log
# you may use the docker manager to upgrade and monitor your docker image
# UI will be visible at http://yoursite.com/admin/docker
hooks:
after_code:
- exec:
cd: /var/www/discourse/plugins
cmd:
- mkdir -p plugins
- git clone https://github.com/discourse/discourse-oauth2-basic.git
- git clone https://github.com/discourse/discourse-backup-uploads-to-s3.git
- git clone https://github.com/discourse/discourse-spoiler-alert.git
- git clone https://github.com/discourse/discourse-voting.git
- git clone https://github.com/discourse/discourse-akismet.git
- git clone https://github.com/discourse/discourse-solved.git
- git clone https://github.com/discourse/discourse-data-explorer.git
- git clone https://github.com/discourse/discourse-patreon.git
- git clone https://github.com/discourse/discourse-user-notes.git
- git clone https://github.com/discourse/discourse-assign.git
- git clone https://github.com/literatecomputing/discourse-prometheus.git
- git clone https://github.com/discourse/discourse-canned-replies.git
after_db_migrate:
- exec: cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate
before_bundle_exec:
- file:
path: /var/www/discourse/config/multisite.yml
contents: |
old:
adapter: postgresql
database: discourse_forum
password: strong_password
pool: 25
host: data
db_id: 2
host_names:
- forum.literatecomputing.com
go:
adapter: postgresql
database: g
password: strong_password
pool: 25
host: data
db_id: 6
host_names:
- forum.y.com
k:
adapter: postgresql
database: k
password: strong_password
pool: 25
host: data
db_id: 8
host_names:
- forums.x.com
r:
adapter: postgresql
database: r
password: strong_password
pool: 25
host: data
db_id: 13
host_names:
- www.r.com
#after_bundle_exec:
#- exec: cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate
after_bundle_exec:
# This is the magic to get IP numbers transmitted to Discourse
# See https://meta.discourse.org/t/last-ip-address-and-action-dispatch-trusted-proxies/50098/3?u=pfaffman
- exec: cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate
- replace:
filename: /etc/nginx/conf.d/discourse.conf
from: "types {"
to: |
set_real_ip_from 192.168.1.0/24;
set_real_ip_from 172.18.0.0/24;
set_real_ip_from 172.17.0.0/24;
real_ip_recursive on;
real_ip_header X-Forwarded-For;
types {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment