discuss.afpy.org
This commit is contained in:
parent
b74cc01908
commit
4515f7831f
10
discuss.yml
Normal file
10
discuss.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- hosts: webservers
|
||||||
|
vars:
|
||||||
|
discourse_domain: discuss.afpy.org
|
||||||
|
discourse_admins:
|
||||||
|
- julien@palard.fr
|
||||||
|
- marc@debureaux.fr
|
||||||
|
roles:
|
||||||
|
- discourse
|
3
roles/discourse/meta/main.yml
Normal file
3
roles/discourse/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
dependencies:
|
||||||
|
- role: docker
|
43
roles/discourse/tasks/main.yml
Normal file
43
roles/discourse/tasks/main.yml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Clone the Official Discourse Docker Image
|
||||||
|
git:
|
||||||
|
repo: https://github.com/discourse/discourse_docker.git
|
||||||
|
dest: /var/discourse
|
||||||
|
|
||||||
|
- name: Setup nginx
|
||||||
|
include_role: name=julienpalard.nginx
|
||||||
|
vars:
|
||||||
|
nginx_domain: "{{ discourse_domain }}"
|
||||||
|
nginx_certificates: ["{{ discourse_domain }}"]
|
||||||
|
nginx_conf: |
|
||||||
|
server
|
||||||
|
{
|
||||||
|
listen 80;
|
||||||
|
server_name {{ discourse_domain }};
|
||||||
|
access_log /var/log/nginx/{{ discourse_domain }}-access.log;
|
||||||
|
error_log /var/log/nginx/{{ discourse_domain }}-error.log;
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
server
|
||||||
|
{
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name {{ discourse_domain }};
|
||||||
|
access_log /var/log/nginx/{{ discourse_domain }}-access.log;
|
||||||
|
error_log /var/log/nginx/{{ discourse_domain }}-error.log;
|
||||||
|
include snippets/letsencrypt-{{ discourse_domain }}.conf;
|
||||||
|
location / {
|
||||||
|
proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- name: Setup discourse
|
||||||
|
template:
|
||||||
|
src: app.yml
|
||||||
|
dest: /var/discourse/containers/app.yml
|
60
roles/discourse/templates/app.yml
Normal file
60
roles/discourse/templates/app.yml
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
## this is the all-in-one, standalone Discourse Docker container template
|
||||||
|
##
|
||||||
|
## From:
|
||||||
|
## https://github.com/discourse/discourse_docker/blob/303eb0309c12e2af3da57ee796c5f154c5a9bca7/samples/standalone.yml
|
||||||
|
## then edited to fit AFPy's Ansible install.
|
||||||
|
##
|
||||||
|
## After making changes to this file, you MUST rebuild
|
||||||
|
## /var/discourse/launcher rebuild app
|
||||||
|
##
|
||||||
|
## 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"
|
||||||
|
|
||||||
|
params:
|
||||||
|
db_default_text_search_config: "pg_catalog.french"
|
||||||
|
db_shared_buffers: "256MB"
|
||||||
|
db_work_mem: "40MB"
|
||||||
|
version: tests-passed
|
||||||
|
|
||||||
|
env:
|
||||||
|
LANG: fr_FR.UTF-8
|
||||||
|
DISCOURSE_DEFAULT_LOCALE: fr
|
||||||
|
UNICORN_WORKERS: 2
|
||||||
|
DISCOURSE_HOSTNAME: '{{ discourse_domain }}'
|
||||||
|
DISCOURSE_DEVELOPER_EMAILS: '{{ discourse_admins|join(",") }}'
|
||||||
|
DISCOURSE_SMTP_ADDRESS: 172.17.0.1
|
||||||
|
DISCOURSE_SMTP_PORT: 25
|
||||||
|
DISCOURSE_SMTP_ENABLE_START_TLS: false
|
||||||
|
|
||||||
|
|
||||||
|
## 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='discuss@afpy.org'"
|
||||||
|
- exec: echo "End of custom commands"
|
34
roles/docker/tasks/main.yml
Normal file
34
roles/docker/tasks/main.yml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Add docker apt requisites
|
||||||
|
apt:
|
||||||
|
state: present
|
||||||
|
name:
|
||||||
|
- apt-transport-https
|
||||||
|
- ca-certificates
|
||||||
|
- curl
|
||||||
|
- software-properties-common
|
||||||
|
|
||||||
|
- name: Add docker GPG key
|
||||||
|
apt_key:
|
||||||
|
url: "https://download.docker.com/linux/debian/gpg"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Add docker repository
|
||||||
|
copy:
|
||||||
|
content: "deb [arch=amd64] https://download.docker.com/linux/debian {{ ansible_facts.distribution_release }} stable"
|
||||||
|
dest: /etc/apt/sources.list.d/docker.list
|
||||||
|
register: sources_list
|
||||||
|
|
||||||
|
- name: apt update
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
when: sources_list is changed
|
||||||
|
|
||||||
|
- name: Install docker
|
||||||
|
apt:
|
||||||
|
name: docker-ce
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
|
# Puis à la main: ./launcher rebuild app
|
||||||
|
# Attention ça prend un temps fou.
|
Loading…
Reference in New Issue
Block a user