data.coop-ansible/roles/docker/tasks/services/writefreely.yml

65 lines
1.7 KiB
YAML

# vim: ft=yaml.ansible
---
- name: Create volume folder for MariaDB data
file:
name: "{{ services.writefreely.volume_folder }}/mariadb_data"
state: directory
- name: Upload config.ini
template:
src: "writefreely/config.ini.j2"
dest: "{{ services.writefreely.volume_folder }}/config.ini"
- name: setup writefreely containers
docker_compose:
project_name: "writefreely"
pull: "yes"
definition:
version: "3.6"
networks:
external_services:
external: true
internal_writefreely:
internal: true
services:
writefreely-web:
container_name: "writefreely-web"
image: "writeas/writefreely:{{ services.writefreely.version }}"
volumes:
- "{{ services.writefreely.volume_folder }}/config.ini:/go/config.ini"
networks:
- "internal_writefreely"
- "external_services"
ports:
- "8080:8080"
depends_on:
- "writefreely-db"
environment:
VIRTUAL_HOST: "{{ services.writefreely.domain }}"
LETSENCRYPT_HOST: "{{ services.writefreely.domain }}"
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
restart: unless-stopped
writefreely-db:
container_name: "writefreely-db"
image: "mariadb:{{ services.writefreely.mariadb_version }}"
volumes:
- "{{ services.writefreely.volume_folder }}/mariadb_data:/var/lib/mysql/data"
networks:
- "internal_writefreely"
environment:
- MYSQL_DATABASE=writefreely
- MYSQL_ROOT_PASSWORD={{ writefreely_secrets.db_password }}
restart: unless-stopped