Commit initial
This commit is contained in:
commit
3c13a4e905
|
@ -0,0 +1,9 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2023 Olivier Navas
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,76 @@
|
|||
# Role : docker_discourse
|
||||
|
||||
## Services fournis
|
||||
|
||||
Installation de discourse sur un serveur docker_host
|
||||
|
||||
## Variables
|
||||
|
||||
Le rôle nécessite que lui soient fournies les informations suivantes :
|
||||
|
||||
```yaml
|
||||
# Le nom de domaine pour lequel le service discourse répond
|
||||
docker_discourse_fqdn: discourse.example.com
|
||||
# La version de l'image docker discourse
|
||||
docker_discourse_version: bitnami/discourse:3.2.0
|
||||
# L'emplacement dans lequel se trouvent les volumes de donnees docker pour le service
|
||||
docker_discourse_data_dir: /data1
|
||||
# Le nom de service souhaité : conditionne le nommage des volumes et le routage par traefik
|
||||
docker_discourse_service_id: discourse_example_com
|
||||
|
||||
# Le nom de la base de données
|
||||
docker_discourse_db_name: discourse
|
||||
# Le nom du user propriétaire de la base de données
|
||||
docker_discourse_db_user: discourse
|
||||
# Le mot de passe du user propriétaire de la base de données
|
||||
docker_discourse_db_password: motdepassebdd
|
||||
|
||||
# Login du compte administrateur
|
||||
docker_discourse_admin_user: admin
|
||||
# Mot de passe du compte administrateur
|
||||
docker_discourse_admin_password: motdepasseadmin
|
||||
# Adresse mail du compte administrateur
|
||||
docker_discourse_admin_email: admin@example.com
|
||||
# Prénom du compte administrateur
|
||||
docker_discourse_admin_first_name: Admin
|
||||
# Nom du compte administrateur
|
||||
docker_discourse_admin_last_name: DuForum
|
||||
|
||||
# FQDN du serveur smtp pour l'envoi de mails
|
||||
docker_discourse_smtp_host: mail.example.com
|
||||
# Numéro de port smtp pour l'envoi de mails
|
||||
docker_discourse_smtp_port: 587
|
||||
# Login de l'utilisateur pour l'envoi de mails par smtp
|
||||
docker_discourse_smtp_user: admin@example.com
|
||||
# Mot de passe de l'utilisateur pour l'envoi de mails par smtp
|
||||
docker_discourse_smtp_password: motdepassesmtp
|
||||
# Protocole pour la communication smtp
|
||||
docker_discourse_smtp_protocol: tls
|
||||
# Type d'authentification sur smtp
|
||||
docker_discourse_smtp_auth: plain
|
||||
```
|
||||
|
||||
|
||||
## Premier démarrage de discourse
|
||||
|
||||
* Le conteneur Discourse est long à démarrer (étape Precompiling assets, this may take some time...") ; compter ~5 minutes.
|
||||
* Une dois démarré, il est possible de se connecter avec le compte admin défini dans les variables
|
||||
* Dans parametres, chercher "notification" et adapter l'adresse d'expédition des courriels pour correspondre à la valeur souhaitée
|
||||
|
||||
|
||||
|
||||
## Ajout d'un plugin
|
||||
|
||||
Exemple ici avec le plugin ldap-auth :
|
||||
```
|
||||
docker compose exec -t -w /opt/bitnami/discourse --env RAILS_ENV=production discourse bundle exec rake plugin:install repo=https://github.com/jonmbake/discourse-ldap-auth.git
|
||||
docker compose exec -t -w /opt/bitnami/discourse --env RAILS_ENV=production discourse bundle exec rake assets:precompile
|
||||
```
|
||||
|
||||
## Suppression d'un plugin
|
||||
|
||||
Exemple ici avec le plugin ldap-auth :
|
||||
```
|
||||
docker compose exec -t -w /bitnami/discourse/plugins/ discourse rm -rf discourse-ldap-auth
|
||||
docker compose exec -t -w /opt/bitnami/discourse --env RAILS_ENV=production discourse bundle exec rake assets:precompile
|
||||
```
|
|
@ -0,0 +1 @@
|
|||
---
|
|
@ -0,0 +1,5 @@
|
|||
- name: docker-compose-up
|
||||
shell: |
|
||||
docker compose up -d
|
||||
args:
|
||||
chdir: /opt/{{ docker_discourse_service_id }}/
|
|
@ -0,0 +1,8 @@
|
|||
galaxy_info:
|
||||
author: Olivier Navas
|
||||
description: Modèle d'installation Libretic pour discourse
|
||||
license: MIT
|
||||
min_ansible_version: 2.9
|
||||
galaxy_tags: []
|
||||
|
||||
dependencies: []
|
|
@ -0,0 +1,18 @@
|
|||
- name: docker directory
|
||||
file:
|
||||
path: /opt/{{ docker_discourse_service_id }}/
|
||||
state: directory
|
||||
|
||||
- name: docker data directory
|
||||
file:
|
||||
path: "{{ docker_discourse_data_dir }}/{{ docker_discourse_service_id }}/"
|
||||
state: directory
|
||||
register: _datadir
|
||||
|
||||
- name: prepare docker-compose.yml and files
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: /opt/{{ docker_discourse_service_id }}/
|
||||
with_items:
|
||||
- docker-compose.yml
|
||||
notify: docker-compose-up
|
|
@ -0,0 +1,101 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
discourse:
|
||||
image: {{ docker_discourse_image_version }}
|
||||
restart: always
|
||||
environment:
|
||||
- DISCOURSE_HOST={{ docker_discourse_fqdn }}
|
||||
- DISCOURSE_DATABASE_HOST=db
|
||||
- DISCOURSE_DATABASE_PORT_NUMBER=5432
|
||||
- DISCOURSE_DATABASE_NAME={{ docker_discourse_db_name }}
|
||||
- DISCOURSE_DATABASE_USER={{ docker_discourse_db_user }}
|
||||
- DISCOURSE_DATABASE_PASSWORD={{ docker_discourse_db_password }}
|
||||
- DISCOURSE_REDIS_HOST=redis
|
||||
- DISCOURSE_REDIS_PORT_NUMBER=6379
|
||||
- DISCOURSE_USERNAME={{ docker_discourse_admin_user }}
|
||||
- DISCOURSE_PASSWORD={{ docker_discourse_admin_password }}
|
||||
- DISCOURSE_EMAIL={{ docker_discourse_admin_email }}
|
||||
- DISCOURSE_FIRST_NAME={{ docker_discourse_admin_first_name }}
|
||||
- DISCOURSE_LAST_NAME={{ docker_discourse_admin_last_name }}
|
||||
- DISCOURSE_SMTP_HOST={{ docker_discourse_smtp_host }}
|
||||
- DISCOURSE_SMTP_PORT={{ docker_discourse_smtp_port }}
|
||||
- DISCOURSE_SMTP_USER={{ docker_discourse_smtp_user }}
|
||||
- DISCOURSE_SMTP_PASSWORD={{ docker_discourse_smtp_password }}
|
||||
- DISCOURSE_SMTP_PROTOCOL={{ docker_discourse_smtp_protocol }}
|
||||
- DISCOURSE_SMTP_AUTH={{ docker_discourse_smtp_auth }}
|
||||
volumes:
|
||||
- {{ docker_discourse_data_dir }}/{{ docker_discourse_service_id }}/discourse-files:/bitnami/discourse
|
||||
labels:
|
||||
traefik.enable: "true"
|
||||
traefik.docker.network: "traefik"
|
||||
traefik.http.routers.{{ docker_discourse_service_id }}.entrypoints: "web"
|
||||
traefik.http.routers.{{ docker_discourse_service_id }}.rule: "Host(`{{ docker_discourse_fqdn }}`)"
|
||||
traefik.http.services.{{ docker_discourse_service_id }}.loadbalancer.server.port: "3000"
|
||||
networks:
|
||||
- traefik
|
||||
- discourse
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
|
||||
db:
|
||||
restart: always
|
||||
image: postgres:16
|
||||
shm_size: 256mb
|
||||
networks:
|
||||
- discourse
|
||||
healthcheck:
|
||||
test: ['CMD', 'pg_isready', '-U', 'postgres']
|
||||
volumes:
|
||||
- {{ docker_discourse_data_dir }}/{{ docker_discourse_service_id }}/db_data:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_DB: "{{ docker_discourse_db_name }}"
|
||||
POSTGRES_USER: "{{ docker_discourse_db_user }}"
|
||||
POSTGRES_PASSWORD: "{{ docker_discourse_db_password }}"
|
||||
|
||||
redis:
|
||||
restart: always
|
||||
image: redis:7-alpine
|
||||
networks:
|
||||
- discourse
|
||||
healthcheck:
|
||||
test: ['CMD', 'redis-cli', 'ping']
|
||||
volumes:
|
||||
- {{ docker_discourse_data_dir }}/{{ docker_discourse_service_id }}/redis_data:/data
|
||||
|
||||
sidekiq:
|
||||
image: {{ docker_discourse_image_version }}
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
- discourse
|
||||
volumes:
|
||||
- {{ docker_discourse_data_dir }}/{{ docker_discourse_service_id }}:/bitnami/discourse
|
||||
command: /opt/bitnami/scripts/discourse-sidekiq/run.sh
|
||||
environment:
|
||||
- DISCOURSE_HOST={{ docker_discourse_fqdn }}
|
||||
- DISCOURSE_DATABASE_HOST=db
|
||||
- DISCOURSE_DATABASE_PORT_NUMBER=5432
|
||||
- DISCOURSE_DATABASE_NAME={{ docker_discourse_db_name }}
|
||||
- DISCOURSE_DATABASE_USER={{ docker_discourse_db_user }}
|
||||
- DISCOURSE_DATABASE_PASSWORD={{ docker_discourse_db_password }}
|
||||
- DISCOURSE_REDIS_HOST=redis
|
||||
- DISCOURSE_REDIS_PORT_NUMBER=6379
|
||||
- DISCOURSE_SMTP_HOST={{ docker_discourse_smtp_host }}
|
||||
- DISCOURSE_SMTP_PORT={{ docker_discourse_smtp_port }}
|
||||
- DISCOURSE_SMTP_USER={{ docker_discourse_smtp_user }}
|
||||
- DISCOURSE_SMTP_PASSWORD={{ docker_discourse_smtp_password }}
|
||||
- DISCOURSE_SMTP_PROTOCOL={{ docker_discourse_smtp_protocol }}
|
||||
networks:
|
||||
- discourse
|
||||
- traefik
|
||||
|
||||
|
||||
networks:
|
||||
traefik:
|
||||
external: true
|
||||
discourse:
|
||||
internal: true
|
Loading…
Reference in New Issue