From f62af6b4e7c75aff1088033f6cf7346d1fff342b Mon Sep 17 00:00:00 2001 From: David Kilias Date: Sun, 26 Jun 2022 22:54:00 +0200 Subject: [PATCH] add hedgedoc config --- pottwal.yml | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/pottwal.yml b/pottwal.yml index 0494907..62095fd 100644 --- a/pottwal.yml +++ b/pottwal.yml @@ -20,6 +20,9 @@ shlink_host_port: 8083 shlink_domain_name: sl.n39.eu + hedgedoc_host_port: 8084 + hedgedoc_image: quay.io/hedgedoc/hedgedoc:1.9.3 + roles: - role: docker_setup vars: @@ -218,6 +221,78 @@ site_name: "{{ shlink_domain_name }}" 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: - name: restart mosquitto docker_container: