Skip to content

Instantly share code, notes, and snippets.

@pfaffman
Created May 10, 2017 21:21
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/0dd2aa5848c59c1ffdef3348fa403d28 to your computer and use it in GitHub Desktop.
Save pfaffman/0dd2aa5848c59c1ffdef3348fa403d28 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/cron.template.yml"
- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/sshd.template.yml"
- "templates/web.template.yml"
# which ports to expose?
expose:
- "8888:80"
params:
# git revision to run
version: tests-passed
env:
UNICORN_WORKERS: 8
db_shared_buffers: "1G"
db_work_mem: "40MB"
DISCOURSE_DEVELOPER_EMAILS: 'pfaffman@gmail.com'
DISCOURSE_HOSTNAME: 'support.literatecomputing.com'
DISCOURSE_SMTP_ADDRESS: smtp.mailgun.org
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: postmaster@example.com
DISCOURSE_SMTP_PASSWORD: notarealpassword
# These containers are stateless, all the data is stored in /shared
volumes:
- volume:
host: /var/discourse/shared/standalone
guest: /shared
# 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_postgres:
- exec: sudo -u postgres createdb goketowithcasey || exit 0
- exec:
stdin: |
grant all privileges on database goketowithcasey to discourse;
cmd: sudo -u postgres psql goketowithcasey
raise_on_fail: false
- exec: /bin/bash -c 'sudo -u postgres psql goketowithcasey <<< "alter schema public owner to discourse;"'
- exec: /bin/bash -c 'sudo -u postgres psql goketowithcasey <<< "create extension if not exists hstore;"'
- exec: /bin/bash -c 'sudo -u postgres psql goketowithcasey <<< "create extension if not exists pg_trgm;"'
- exec: sudo -u postgres createdb discourse_forum|| exit 0
- exec:
stdin: |
grant all privileges on database discourse_forum to discourse;
cmd: sudo -u postgres psql discourse_forum
raise_on_fail: false
- exec: sudo -u postgres createdb discourse_trena || exit 0
- exec:
stdin: |
grant all privileges on database discourse_trena to discourse;
cmd: sudo -u postgres psql discourse_trena
raise_on_fail: false
- exec: /bin/bash -c 'sudo -u postgres psql discourse_forum <<< "alter schema public owner to discourse;"'
- exec: /bin/bash -c 'sudo -u postgres psql discourse_forum <<< "create extension if not exists hstore;"'
- exec: /bin/bash -c 'sudo -u postgres psql discourse_forum <<< "create extension if not exists pg_trgm;"'
- exec: /bin/bash -c 'sudo -u postgres psql discourse_trena <<< "alter schema public owner to discourse;"'
- exec: /bin/bash -c 'sudo -u postgres psql discourse_trena <<< "create extension if not exists hstore;"'
- exec: /bin/bash -c 'sudo -u postgres psql discourse_trena <<< "create extension if not exists pg_trgm;"'
- exec: sudo -u postgres createdb discourse_adams || exit 0
- exec:
stdin: |
grant all privileges on database discourse_adams to discourse;
cmd: sudo -u postgres psql discourse_adams
raise_on_fail: false
- exec: /bin/bash -c 'sudo -u postgres psql discourse_adams <<< "alter schema public owner to discourse;"'
- exec: /bin/bash -c 'sudo -u postgres psql discourse_adams <<< "create extension if not exists hstore;"'
- exec: /bin/bash -c 'sudo -u postgres psql discourse_adams <<< "create extension if not exists pg_trgm;"'
- exec: sudo -u postgres createdb discourse_luke || exit 0
- exec:
stdin: |
grant all privileges on database discourse_luke to discourse;
cmd: sudo -u postgres psql discourse_luke
raise_on_fail: false
- exec: /bin/bash -c 'sudo -u postgres psql discourse_luke <<< "alter schema public owner to discourse;"'
- exec: /bin/bash -c 'sudo -u postgres psql discourse_luke <<< "create extension if not exists hstore;"'
- exec: /bin/bash -c 'sudo -u postgres psql discourse_luke <<< "create extension if not exists pg_trgm;"'
after_code:
after_code:
- exec:
cd: /var/www/discourse/plugins
cmd:
- mkdir -p plugins
- git clone https://github.com/discourse/docker_manager.git
- git clone https://github.com/discourse/discourse-bbcode-color.git
- git clone https://github.com/discourse/discourse-spoiler-alert.git
- git clone https://github.com/discourse/discourse-tagging.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-narrative-bot.git
- git clone https://github.com/discourse/discourse-data-explorer.git
- git clone https://github.com/discourse/discourse-patreon.git
before_bundle_exec:
- file:
path: /var/www/discourse/config/multisite.yml
contents: |
discourse_instance2:
adapter: postgresql
database: discourse_forum
pool: 25
timeout: 5000
db_id: 2
host_names:
- forum.literatecomputing.com
discourse_instance3:
adapter: postgresql
database: discourse_trena
pool: 25
timeout: 5000
db_id: 3
host_names:
- trena.literatecomputing.com
discourse_instance4:
adapter: postgresql
database: discourse_adams
pool: 25
timeout: 5000
db_id: 4
host_names:
- adams.literatecomputing.com
discourse_instance5:
adapter: postgresql
database: discourse_luke
pool: 25
timeout: 5000
db_id: 5
host_names:
- happyphysicsplace.literatecomputing.com
goketowithcasey:
adapter: postgresql
database: goketowithcasey
pool: 25
timeout: 5000
db_id: 6
host_names:
- forum.goketowithcasey.com
after_bundle_exec:
- exec: cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate
# Remember, this is YAML syntax - you can only have one block with a name
run:
- exec: awk -F\# '{print $1;}' ~/.ssh/authorized_keys | awk 'BEGIN { print "Authorized SSH keys for this container:"; } NF>=2 {print $NF;}'
- exec: rails r "SiteSetting.notification_email='pfaffman@literatecomputing.com'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment