From 66ee1f011e7492834b9bf946f541d37fe672004f Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Tue, 11 May 2021 17:04:32 +0200 Subject: [PATCH] hackmd: bump to version 1.8.1 --- roles/hackmd/defaults/main.yml | 2 +- roles/hackmd/tasks/main.yml | 19 ++++++++----------- roles/hackmd/templates/_sequelizerc.j2 | 8 -------- roles/hackmd/templates/hackmd.service.j2 | 2 +- 4 files changed, 10 insertions(+), 21 deletions(-) delete mode 100644 roles/hackmd/templates/_sequelizerc.j2 diff --git a/roles/hackmd/defaults/main.yml b/roles/hackmd/defaults/main.yml index e0cfd05..2a3fd50 100644 --- a/roles/hackmd/defaults/main.yml +++ b/roles/hackmd/defaults/main.yml @@ -1,4 +1,4 @@ --- -hackmd_version: 1.7.2 +hackmd_version: 1.8.1 hackmd_archive: https://github.com/hedgedoc/hedgedoc/archive/{{ hackmd_version }}.tar.gz diff --git a/roles/hackmd/tasks/main.yml b/roles/hackmd/tasks/main.yml index a9aba06..82c6d5a 100644 --- a/roles/hackmd/tasks/main.yml +++ b/roles/hackmd/tasks/main.yml @@ -10,7 +10,7 @@ apt_key: url="https://deb.nodesource.com/gpgkey/nodesource.gpg.key" - name: Enable nodesource repository - apt_repository: repo="deb https://deb.nodesource.com/node_8.x/ {{ ansible_distribution_release }} main" + apt_repository: repo="deb https://deb.nodesource.com/node_14.x/ {{ ansible_distribution_release }} main" - name: Enable yarnpkg apt-key apt_key: url="https://dl.yarnpkg.com/debian/pubkey.gpg" @@ -60,8 +60,14 @@ register: hackmd_config notify: Restart hackmd +- name: Install hackmd frontend deps + command: /usr/bin/yarn install chdir=/opt/hedgedoc-{{ hackmd_version }} + become: true + become_user: hackmd + when: hackmd_unarchive.changed or hackmd_config.changed + - name: Build hackmd frontend - command: /usr/bin/yarn run build chdir=/opt/hedgedoc-{{ hackmd_version }} + command: /usr/bin/yarn build chdir=/opt/hedgedoc-{{ hackmd_version }} become: true become_user: hackmd when: hackmd_unarchive.changed or hackmd_config.changed @@ -76,15 +82,6 @@ become: true become_user: postgres -- name: Configure sequelize - template: src=_sequelizerc.j2 dest=/opt/hedgedoc-{{ hackmd_version }}/.sequelizerc owner=hackmd - -- name: Upgrade database schema - command: node_modules/.bin/sequelize db:migrate chdir=/opt/hedgedoc-{{ hackmd_version }} - become: true - become_user: hackmd - when: hackmd_unarchive.changed or hackmd_config.changed - - name: Ensure certificates are available command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ hackmd_domain }}.key -out /etc/nginx/ssl/{{ hackmd_domain }}.crt -days 730 -subj "/CN={{ hackmd_domain }}" creates=/etc/nginx/ssl/{{ hackmd_domain }}.crt notify: Restart nginx diff --git a/roles/hackmd/templates/_sequelizerc.j2 b/roles/hackmd/templates/_sequelizerc.j2 deleted file mode 100644 index 50cc8cc..0000000 --- a/roles/hackmd/templates/_sequelizerc.j2 +++ /dev/null @@ -1,8 +0,0 @@ -var path = require('path'); - -module.exports = { - 'config': path.resolve('config.json'), - 'migrations-path': path.resolve('lib', 'migrations'), - 'models-path': path.resolve('lib', 'models'), - 'url': 'postgres://{{ hackmd_dbuser }}:{{ hackmd_dbpass }}@localhost:5432/{{ hackmd_dbname }}' -} diff --git a/roles/hackmd/templates/hackmd.service.j2 b/roles/hackmd/templates/hackmd.service.j2 index 86f7f44..57b55aa 100644 --- a/roles/hackmd/templates/hackmd.service.j2 +++ b/roles/hackmd/templates/hackmd.service.j2 @@ -7,7 +7,7 @@ Environment=NODE_ENV=production WorkingDirectory=/opt/hedgedoc-{{ hackmd_version }} Type=simple User=hackmd -ExecStart=/usr/bin/node /opt/hedgedoc-{{ hackmd_version }}/app.js +ExecStart=/usr/bin/yarn start Restart=on-failure [Install]