---
dependencies:

  # install nodejs
  - role: stable/nodejs

  # install postgres
  # and create an etherpad user and db
  - role: stable/postgresql
    vars:
      username: etherpad
      password: "{{ database_password }}"
      database: etherpad

  # install certbot nginx and configure it as reverse proxy
  - role: stable/nginx
    when: with_nginx | bool
    vars:
      with_certbot: true
      proxy_pass: http://localhost:8001

  # backup etherpad database
  - role: stable/restic
    when: with_backup | bool
    vars:
      restic_databases:
        - {name: 'etherpad', dump_command: sudo -Hiu postgres pg_dump -Fc etherpad}