Merge pull request 'add hedgedoc config' (!38) from dkdent/netz39-infra-ansible:hedgedoc into master

Reviewed-on: https://gitea.n39.eu/Netz39_Admin/netz39-infra-ansible/pulls/38
This commit is contained in:
dkdent 2022-06-28 14:01:07 +00:00
commit 235cc19b9b
2 changed files with 82 additions and 0 deletions

View file

@ -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:

View file

@ -17,6 +17,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:
@ -182,4 +185,76 @@
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: