Commit initial
This commit is contained in:
commit
4e9072a8a1
6 changed files with 157 additions and 0 deletions
61
README.md
Normal file
61
README.md
Normal file
|
@ -0,0 +1,61 @@
|
|||
# Role : docker_mobilizon
|
||||
|
||||
## Services fournis
|
||||
|
||||
- main.yml : Installation de mobilizon sur un serveur docker_host
|
||||
|
||||
|
||||
## Variables
|
||||
|
||||
Fournir les variables suivantes. Par exemple :
|
||||
|
||||
```yaml
|
||||
docker_mobilizon_fqdn: mobilizon.example.com
|
||||
docker_mobilizon_version: 2.1.0
|
||||
docker_mobilizon_data_dir: /data1
|
||||
docker_mobilizon_service_id: mobilizon
|
||||
docker_mobilizon_db_password: mot_de_passe
|
||||
docker_mobilizon_instance_name: "{{ docker_mobilizon_fqdn }}"
|
||||
docker_mobilizon_email_from: expediteur@example.com
|
||||
docker_mobilizon_secret_key_base: un_secret
|
||||
docker_mobilizon_secret_key: un_secret
|
||||
docker_mobilizon_smtp_server: mail.example.com
|
||||
```
|
||||
|
||||
| Option | Valeur par défaut | Description |
|
||||
|-------------------------------------|-------------------|--------------------------------------------------------------------------------------------|
|
||||
| docker_mobilizon_fqdn | | Le fqdn pour accéder à mobilizon |
|
||||
| docker_mobilizon_version | | Version de l'image mobilizon |
|
||||
| docker_mobilizon_data_dir | | L'emplacement dans lequel se trouvent les volumes de donnees docker pour le service |
|
||||
| docker_mobilizon_service_id | | Le nom de service souhaité : conditionne le nommage des dossiers et le routage par traefik |
|
||||
| docker_mobilizon_db_name | mobilizon | Le nom souhaité pour la base de données |
|
||||
| docker_mobilizon_db_user | mobilizon | Le nom souhaité pour le proprietaire de la base |
|
||||
| docker_mobilizon_db_password | | Le mot de passe du proprietaire de la base |
|
||||
| docker_mobilizon_instance_name | | Nom de l'instance mobilizon |
|
||||
| docker_mobilizon_email_from | | Adresse d'émetteur des courriels envoyés par mobilizon |
|
||||
| docker_mobilizon_secret_key_base | | Générer un secret avec `gpg --gen-random --armor 1 50` |
|
||||
| docker_mobilizon_secret_key | | Générer un secret avec `gpg --gen-random --armor 1 50` |
|
||||
| docker_mobilizon_smtp_server | | Adresse du serveur smtp |
|
||||
| docker_mobilizon_smtp_port | 25 | |
|
||||
| docker_mobilizon_smtp_username | "" | Renseigner si nécessaire pour s'authentifier auprès du serveur smtp |
|
||||
| docker_mobilizon_smtp_password | "" | Renseigner si nécessaire pour s'authentifier auprès du serveur smtp |
|
||||
| docker_mobilizon_registrations_open | "true" | Précise si le serveur est ouvert aux inscriptions |
|
||||
| docker_mobilizon_custom_config | false | Si true, prepare docker-compose pour un fichier config.exs spécifique |
|
||||
|
||||
|
||||
# Premier démarrage
|
||||
|
||||
docker-compose exec mobilizon mobilizon_ctl users.new "admin@email.com" --admin --password "Y0urP4ssw0rd"
|
||||
|
||||
# Configuration spécifique
|
||||
|
||||
docker cp mobilizon_mobilizon_1:/etc/mobilizon/config.exs .
|
||||
|
||||
docker_mobilizon_custom_config: true
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
7
defaults/main.yml
Normal file
7
defaults/main.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
docker_mobilizon_db_name: mobilizon
|
||||
docker_mobilizon_db_user: mobilizon
|
||||
docker_mobilizon_smtp_port: 25
|
||||
docker_mobilizon_smtp_username: ""
|
||||
docker_mobilizon_smtp_password: ""
|
||||
docker_mobilizon_registrations_open: "true"
|
||||
docker_mobilizon_custom_config: false
|
5
handlers/main.yml
Normal file
5
handlers/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
- name: docker-compose-up
|
||||
shell: |
|
||||
docker-compose up -d
|
||||
args:
|
||||
chdir: /opt/{{ docker_mobilizon_service_id }}/
|
8
meta/main.yml
Normal file
8
meta/main.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
galaxy_info:
|
||||
author: Olivier Navas
|
||||
description: Modèle d'installation Libretic pour mobilizon
|
||||
license: GPL-3.0-only
|
||||
min_ansible_version: 2.9
|
||||
galaxy_tags: []
|
||||
|
||||
dependencies: []
|
14
tasks/main.yml
Normal file
14
tasks/main.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
- name: docker directory
|
||||
file:
|
||||
path: /opt/{{ docker_mobilizon_service_id }}/
|
||||
state: directory
|
||||
|
||||
- name: prepare docker-compose.yml
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: /opt/{{ docker_mobilizon_service_id }}/
|
||||
with_items:
|
||||
- docker-compose.yml
|
||||
notify: docker-compose-up
|
||||
|
||||
|
62
templates/docker-compose.yml
Normal file
62
templates/docker-compose.yml
Normal file
|
@ -0,0 +1,62 @@
|
|||
# {{ ansible_managed }}
|
||||
version: '3.5'
|
||||
|
||||
services:
|
||||
mobilizon:
|
||||
image: framasoft/mobilizon:{{ docker_mobilizon_version }}
|
||||
restart: always
|
||||
environment:
|
||||
MOBILIZON_INSTANCE_NAME: "{{ docker_mobilizon_instance_name }}"
|
||||
MOBILIZON_INSTANCE_HOST: "{{ docker_mobilizon_fqdn }}"
|
||||
MOBILIZON_INSTANCE_EMAIL: "{{ docker_mobilizon_email_from }}"
|
||||
MOBILIZON_REPLY_EMAIL: "{{ docker_mobilizon_email_from }}"
|
||||
MOBILIZON_INSTANCE_REGISTRATIONS_OPEN: "{{ docker_mobilizon_registrations_open }}"
|
||||
MOBILIZON_DATABASE_USERNAME: "{{ docker_mobilizon_db_user }}"
|
||||
MOBILIZON_DATABASE_PASSWORD: "{{ docker_mobilizon_db_password }}"
|
||||
MOBILIZON_DATABASE_DBNAME: "{{ docker_mobilizon_db_name }}"
|
||||
MOBILIZON_DATABASE_HOST: db
|
||||
MOBILIZON_INSTANCE_SECRET_KEY_BASE: "{{ docker_mobilizon_secret_key_base }}"
|
||||
MOBILIZON_INSTANCE_SECRET_KEY: "{{ docker_mobilizon_secret_key }}"
|
||||
MOBILIZON_SMTP_SERVER: "{{ docker_mobilizon_smtp_server }}"
|
||||
MOBILIZON_SMTP_PORT: "{{ docker_mobilizon_smtp_port }}"
|
||||
MOBILIZON_SMTP_USERNAME: "{{ docker_mobilizon_smtp_username }}"
|
||||
MOBILIZON_SMTP_PASSWORD: "{{ docker_mobilizon_smtp_password }}"
|
||||
volumes:
|
||||
- {{ docker_mobilizon_data_dir }}/{{ docker_mobilizon_service_id }}/uploads:/var/lib/mobilizon/uploads
|
||||
{% if docker_mobilizon_custom_config is true %}
|
||||
- ./config.exs:/etc/mobilizon/config.exs:ro
|
||||
{% endif %}
|
||||
# - ${PWD}/GeoLite2-City.mmdb:/var/lib/mobilizon/geo_db/GeoLite2-City.mmdb
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.docker.network=traefik"
|
||||
- "traefik.http.routers.{{ docker_mobilizon_service_id }}.entrypoints=web"
|
||||
- "traefik.http.routers.{{ docker_mobilizon_service_id }}.rule=Host(`{{ docker_mobilizon_fqdn }}`)"
|
||||
- "traefik.http.services.{{ docker_mobilizon_service_id }}.loadbalancer.server.port=4000"
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- traefik
|
||||
- mobilizon
|
||||
|
||||
db:
|
||||
restart: always
|
||||
image: postgis/postgis:14-master
|
||||
shm_size: 256mb
|
||||
networks:
|
||||
- mobilizon
|
||||
healthcheck:
|
||||
test: "pg_isready -U {{ docker_mobilizon_db_user }} && psql -U {{ docker_mobilizon_db_user }} --list"
|
||||
volumes:
|
||||
- {{ docker_mobilizon_data_dir }}/{{ docker_mobilizon_service_id }}/db_data:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_DB: "{{ docker_mobilizon_db_name }}"
|
||||
POSTGRES_USER: "{{ docker_mobilizon_db_user }}"
|
||||
POSTGRES_PASSWORD: "{{ docker_mobilizon_db_password }}"
|
||||
|
||||
networks:
|
||||
traefik:
|
||||
external: true
|
||||
mobilizon:
|
||||
internal: true
|
Loading…
Reference in a new issue