From f62af6b4e7c75aff1088033f6cf7346d1fff342b Mon Sep 17 00:00:00 2001 From: David Kilias Date: Sun, 26 Jun 2022 22:54:00 +0200 Subject: [PATCH 1/2] 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: From 7b06ea8c6c13ae10c03da7ae6146db880168905c Mon Sep 17 00:00:00 2001 From: David Kilias Date: Mon, 27 Jun 2022 23:59:00 +0200 Subject: [PATCH 2/2] add hedgedoc postgres password to inventory --- inventory | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/inventory b/inventory index bca588c..e4a7743 100644 --- a/inventory +++ b/inventory @@ -76,6 +76,13 @@ all: 31356239323439666632333033616366663762646366343839663463633665333863343437343334 3665386538393066380a383366346235343531306561643534663035646537666534383536333230 34613761363237633865306332653631323366343232353666343165666664343838 + hedgedoc_postgres_password: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 66333336393263316230626630626234383238343238396463373331633738343663376439653963 + 3536656431633631396634383137323938313663363665370a366132323464373731323564386239 + 38656238663565386631306263333166633064313762343139373735626439666665356530383363 + 3134373261386435310a626461376537643937643838636638313033383463356663396464643361 + 36333766383139376331336633646633396430323663366636616431643134666536 unicorn.n39.eu: server_admin: "admin+unicorn@netz39.de" platon.n39.eu: