Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add discourse deployment playbook #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ansible/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.retry
*.retry
.passwd
1 change: 1 addition & 0 deletions ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[defaults]
roles_path=roles/
vault_password_file = .passwd
18 changes: 18 additions & 0 deletions ansible/group_vars/all/discourse_secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$ANSIBLE_VAULT;1.1;AES256
36366165303533363865653535633937636234633366623939343632386238623038313663393366
6661346130396236653032623731393864393638323236380a363939303530653234643232366565
33396564356162633561633337623561373335656638333064323363653531336631633636386562
6133653538333461640a346335653365393132323166346534363563363261313865396532633765
64353631353962633361316532373964313362653634326663646430636132306264333736316565
32633537663731373362643863616361626439613832303261313966373439313761626436303137
64643833353663666432363261633139396231363131356436316130623739343362316436633361
35623965336131333363643666303633393666643637343930363732326538353062323830643865
39386462393536656531646137326463653463396238626237366166663737376361613063353832
65353430343232626137363661356432383039306239633239363065666663646332333964623734
33326138303232643732633164366339366632393062376232646639356464333831386463393630
62616633616137333565656636663336333864663964303165396339346336306336646161326637
36333837376164313636396534336232623738393732626634636238386230376135656466663431
36336162653238353239313132363161333038653838376635333435636262323133656265643630
30633562646136343165623036353533376337343230383666353063353736633135363634343938
61326430383937303439653963643263383735336166333265363132373865316162623065303831
37393630333733313531313066613237333433663936313235643262626437633139
22 changes: 22 additions & 0 deletions ansible/playbooks/30-discourse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
- hosts: tachikoma
become: yes
tasks:
- name: Install Docker
apt:
name: docker.io
state: present
- name: Clone discourse git repo
git:
repo: https://github.com/discourse/discourse_docker.git
dest: /var/discourse
- name: Copy discourse configuration
template:
src: discourse/app.yml
rubicae marked this conversation as resolved.
Show resolved Hide resolved
dest: /var/discourse/containers/app.yml
notify: rebuild discourse
handlers:
- name: rebuild discourse
shell: /var/discourse/launcher rebuild app
args:
chdir: /var/discourse
90 changes: 90 additions & 0 deletions ansible/playbooks/discourse/app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{{ ansible_managed | comment }}
## this is the all-in-one, standalone Discourse Docker container template
##
## After making changes to this file, you MUST rebuild
## /var/discourse/launcher rebuild app
##
## BE *VERY* CAREFUL WHEN EDITING!
## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
## visit http://www.yamllint.com/ to validate this file as needed

templates:
- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
- "templates/web.ratelimited.template.yml"
- "templates/web.socketed.template.yml"

# No tcp ports since we're using a socket:
expose:
# - "80:80" # http
# - "443:443" # https

params:
db_default_text_search_config: "pg_catalog.english"

## Set db_shared_buffers to a max of 25% of the total memory.
## will be set automatically by bootstrap based on detected RAM, or you can override
#db_shared_buffers: "2048MB"

## can improve sorting performance, but adds memory usage per-connection
#db_work_mem: "40MB"

## Which Git revision should this container use? (default: tests-passed)
#version: tests-passed

env:
LANG: en_US.UTF-8
# DISCOURSE_DEFAULT_LOCALE: en

## How many concurrent web requests are supported? Depends on memory and CPU cores.
## will be set automatically by bootstrap based on detected CPUs, or you can override
UNICORN_WORKERS: 8

## TODO: The domain name this Discourse instance will respond to
## Required. Discourse will not work with a bare IP number.
DISCOURSE_HOSTNAME: discourse.queeriouslabs.com

## Uncomment if you want the container to be started with the same
## hostname (-h option) as specified above (default "$hostname-$config")
#DOCKER_USE_HOSTNAME: true

## TODO: List of comma delimited emails that will be made admin and developer
## on initial signup example '[email protected],[email protected]'
DISCOURSE_DEVELOPER_EMAILS: '{{ discourse_developer_email }}'

DISCOURSE_SMTP_ADDRESS: {{ discourse_smtp_server }}
DISCOURSE_SMTP_PORT: {{ discourse_smtp_port }}
DISCOURSE_SMTP_USER_NAME: {{ discourse_smtp_username }}
DISCOURSE_SMTP_PASSWORD: "{{ discourse_smtp_password }}"
#DISCOURSE_SMTP_ENABLE_START_TLS: true # (optional, default true)

## The CDN address for this Discourse instance (configured to pull)
## see https://meta.discourse.org/t/14857 for details
#DISCOURSE_CDN_URL: //discourse-cdn.example.com

## The Docker container is stateless; all data is stored in /shared
volumes:
- volume:
host: /var/discourse/shared/standalone
guest: /shared
- volume:
host: /var/discourse/shared/standalone/log/var-log
guest: /var/log

## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- git clone https://github.com/discourse/docker_manager.git

## Any custom commands to run after building
run:
- exec: echo "Beginning of custom commands"
## If you want to set the 'From' email address for your first registration, uncomment and change:
## After getting the first signup email, re-comment the line. It only needs to run once.
#- exec: rails r "SiteSetting.notification_email='[email protected]'"
- exec: echo "End of custom commands"