add hedgedoc config

This commit is contained in:
David Kilias 2022-06-26 22:54:00 +02:00
parent 769b5716df
commit f62af6b4e7

View file

@ -20,6 +20,9 @@
shlink_host_port: 8083 shlink_host_port: 8083
shlink_domain_name: sl.n39.eu shlink_domain_name: sl.n39.eu
hedgedoc_host_port: 8084
hedgedoc_image: quay.io/hedgedoc/hedgedoc:1.9.3
roles: roles:
- role: docker_setup - role: docker_setup
vars: vars:
@ -218,6 +221,78 @@
site_name: "{{ shlink_domain_name }}" site_name: "{{ shlink_domain_name }}"
proxy_port: "{{ shlink_host_port }}" proxy_port: "{{ shlink_host_port }}"
- name: Check if hedgedoc data dir exists
ansible.builtin.stat:
path: "/srv/docker/hedgedoc"
register: hedgedoc_dir
- name: Fail if hedgedoc data dir does not exist
ansible.builtin.fail:
msg: "hedgedoc data dir is missing, please restore from the backup!"
when: not hedgedoc_dir.stat.exists
- name: Ensure the hedgedoc directories exist
file:
path: "{{ item }}"
state: directory
with_items:
- "/srv/docker/hedgedoc/data/database"
- "/srv/docker/hedgedoc/data/uploads"
- name: Setup docker network
docker_network:
name: hedgedocnet
state: present
internal: true
- name: Install HedgeDoc database container
docker_container:
name: hedgedocdb
image: "postgres:11.6-alpine"
pull: true
state: started
restart_policy: unless-stopped
detach: yes
env:
POSTGRES_USER: hedgedoc
POSTGRES_PASSWORD: "{{ hedgedoc_postgres_password }}"
POSTGRES_DB: hedgedoc
volumes:
- "/srv/docker/hedgedoc/data/database:/var/lib/postgresql/data"
networks:
- name: hedgedocnet
- name: Ensure container for hedgedoc is running
docker_container:
name: hedgedoc
image: "{{ hedgedoc_image }}"
pull: true
state: started
detach: yes
ports:
- "{{ hedgedoc_host_port }}:3000"
restart_policy: unless-stopped
env:
NODE_ENV: production
CMD_DOMAIN: pad.n39.eu
CMD_URL_ADDPORT: true
CMD_DB_HOST: hedgedocdb
CMD_DB_PORT: 5432
CMD_DB_DIALECT: postgres
CMD_DB_DATABASE: hedgedoc
CMD_DB_USERNAME: hedgedoc
CMD_DB_PASSWORD: "{{ hedgedoc_postgres_password }}"
volumes:
- /srv/docker/hedgedoc/data/uploads:/hedgedoc/public/uploads
networks:
- name: hedgedocnet
- name: Setup proxy site pad.n39.eu
include_role:
name: setup-http-site-proxy
vars:
site_name: pad.n39.eu
proxy_port: "{{ hedgedoc_host_port }}"
handlers: handlers:
- name: restart mosquitto - name: restart mosquitto
docker_container: docker_container: