1
0
forked from infra/ansible

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_version: 1.7.1
hackmd_archive: https://github.com/codimd/server/archive/{{ hackmd_version }}.tar.gz hackmd_archive: https://github.com/hedgedoc/hedgedoc/archive/{{ hackmd_version }}.tar.gz

View File

@ -38,34 +38,30 @@
- yarn - yarn
- name: Unpack hackmd - 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 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 - 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 - 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 - 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 - 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: true
become_user: hackmd become_user: hackmd
- name: Configure 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 register: hackmd_config
notify: Restart hackmd notify: Restart hackmd
- name: Build hackmd frontend - 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: true
become_user: hackmd become_user: hackmd
when: hackmd_unarchive.changed or hackmd_config.changed when: hackmd_unarchive.changed or hackmd_config.changed
@ -81,10 +77,10 @@
become_user: postgres become_user: postgres
- name: Configure sequelize - 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 - 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: true
become_user: hackmd become_user: hackmd
when: hackmd_unarchive.changed or hackmd_config.changed when: hackmd_unarchive.changed or hackmd_config.changed

View File

@ -4,10 +4,10 @@ After=network.target
[Service] [Service]
Environment=NODE_ENV=production Environment=NODE_ENV=production
WorkingDirectory=/opt/codimd-{{ hackmd_version }} WorkingDirectory=/opt/hedgedoc-{{ hackmd_version }}
Type=simple Type=simple
User=hackmd 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 Restart=on-failure
[Install] [Install]

View File

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