hackmd: upgrade to HedgeDoc 1.7.1

This commit is contained in:
Markus 2020-12-28 17:53:02 +01:00
parent 15fbe6c29c
commit ac892a93cb
4 changed files with 31 additions and 21 deletions

View File

@ -1,4 +1,4 @@
---
hackmd_version: 1.5.0
hackmd_archive: https://github.com/codimd/server/archive/{{ hackmd_version }}.tar.gz
hackmd_version: 1.7.1
hackmd_archive: https://github.com/hedgedoc/hedgedoc/archive/{{ hackmd_version }}.tar.gz

View File

@ -38,34 +38,30 @@
- yarn
- name: Unpack hackmd
unarchive: src={{ hackmd_archive }} dest=/opt owner=hackmd group=hackmd remote_src=yes creates=/opt/codimd-{{ hackmd_version }}
unarchive: src={{ hackmd_archive }} dest=/opt owner=hackmd group=hackmd remote_src=yes creates=/opt/hedgedoc-{{ hackmd_version }}
register: hackmd_unarchive
- name: Rename hackmd
command: mv /opt/server-{{ hackmd_version }} /opt/codimd-{{ hackmd_version }}
when: hackmd_unarchive.changed
- name: Create hackmd upload path
file: path=/opt/codimd/uploads state=directory recurse=yes owner=hackmd group=hackmd
file: path=/opt/hedgedoc/uploads state=directory recurse=yes owner=hackmd group=hackmd
- name: Remove old hackmd upload path
file: path=/opt/codimd-{{ hackmd_version }}/public/uploads state=absent force=yes
file: path=/opt/hedgedoc-{{ hackmd_version }}/public/uploads state=absent force=yes
- name: Link hackmd upload path
file: path=/opt/codimd-{{ hackmd_version }}/public/uploads src=/opt/codimd/uploads state=link owner=hackmd group=hackmd
file: path=/opt/hedgedoc-{{ hackmd_version }}/public/uploads src=/opt/hedgedoc/uploads state=link owner=hackmd group=hackmd
- name: Setup hackmd
command: bin/setup chdir=/opt/codimd-{{ hackmd_version }} creates=/opt/codimd-{{ hackmd_version }}/config.json
command: bin/setup chdir=/opt/hedgedoc-{{ hackmd_version }} creates=/opt/hedgedoc-{{ hackmd_version }}/config.json
become: true
become_user: hackmd
- name: Configure hackmd
template: src=config.json.j2 dest=/opt/codimd-{{ hackmd_version }}/config.json owner=hackmd
template: src=config.json.j2 dest=/opt/hedgedoc-{{ hackmd_version }}/config.json owner=hackmd
register: hackmd_config
notify: Restart hackmd
- name: Build hackmd frontend
command: /usr/bin/npm run build chdir=/opt/codimd-{{ hackmd_version }}
command: /usr/bin/yarn run build chdir=/opt/hedgedoc-{{ hackmd_version }}
become: true
become_user: hackmd
when: hackmd_unarchive.changed or hackmd_config.changed
@ -81,10 +77,10 @@
become_user: postgres
- name: Configure sequelize
template: src=_sequelizerc.j2 dest=/opt/codimd-{{ hackmd_version }}/.sequelizerc owner=hackmd
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/codimd-{{ hackmd_version }}
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

View File

@ -4,10 +4,10 @@ After=network.target
[Service]
Environment=NODE_ENV=production
WorkingDirectory=/opt/codimd-{{ hackmd_version }}
WorkingDirectory=/opt/hedgedoc-{{ hackmd_version }}
Type=simple
User=hackmd
ExecStart=/usr/bin/node /opt/codimd-{{ hackmd_version }}/app.js
ExecStart=/usr/bin/node /opt/hedgedoc-{{ hackmd_version }}/app.js
Restart=on-failure
[Install]

View File

@ -1,3 +1,8 @@
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
@ -27,12 +32,21 @@ server {
client_max_body_size 8M;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-Proto $scheme;
}
location /socket.io/ {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}