Skip to content

Commit 5248773

Browse files
committed
On utilise la même version de zmarkdown que zds-site
- On utilise le package.json de zds-site - On utilise la version de pm2 installée dans node_modules - Le dossier de travail est /opt/zds/app/zmd et non plus /opt/zmd - Quelques modifications cosmétiques
1 parent 95faf8b commit 5248773

File tree

5 files changed

+17
-59
lines changed

5 files changed

+17
-59
lines changed

roles/zmd/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
zmarkdown_version: 9.1.3
21
zmarkdown_sentry_dsn: ""
2+
zmarkdown_dir: "{{ appdir }}/zmd"

roles/zmd/handlers/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- name: restart zmd
1+
- name: restart zmarkdown service
22
systemd:
33
name: zmd
44
state: restarted

roles/zmd/tasks/main.yml

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,13 @@
44
tags:
55
- bootstrap
66

7-
- name: install pm2 globally
8-
npm:
9-
name: pm2
10-
global: yes
11-
tags:
12-
- bootstrap
13-
14-
- name: create zmd home directory
15-
file:
16-
state: directory
17-
path: /opt/zmd
18-
owner: zds
19-
group: zds
20-
mode: 0755
21-
tags:
22-
- bootstrap
23-
24-
- name: add server package.json
25-
template:
26-
src: package.json.j2
27-
dest: /opt/zmd/package.json
28-
register: zmd_package
29-
notify: restart zmd
30-
tags:
31-
- bootstrap
32-
- upgrade
33-
347
- name: install zmarkdown
8+
become: true
9+
become_user: zds
3510
npm:
36-
name: zmarkdown
37-
path: /opt/zmd
38-
when: zmd_package.changed
11+
path: "{{ zmarkdown_dir }}"
12+
production: yes
13+
notify: restart zmarkdown service
3914
tags:
4015
- bootstrap
4116
- upgrade
@@ -44,22 +19,22 @@
4419
template:
4520
src: zmd.service.j2
4621
dest: /etc/systemd/system/zmd.service
47-
notify: restart zmd
22+
notify: restart zmarkdown service
4823
tags:
4924
- bootstrap
5025
- upgrade
5126

52-
- name: ensure zmd is running.
27+
- name: start zmarkdown service
5328
service:
5429
name: zmd
55-
state: started
30+
state: restarted
5631
enabled: yes
57-
register: zmd_service
32+
daemon_reload: true
5833
tags:
5934
- bootstrap
6035
- upgrade
6136

62-
- name: check that zmd is running
37+
- name: check that zmarkdown is running
6338
uri:
6439
url: http://localhost:27272/
6540
return_content: yes

roles/zmd/templates/package.json.j2

Lines changed: 0 additions & 17 deletions
This file was deleted.

roles/zmd/templates/zmd.service.j2

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ LimitNOFILE=infinity
1111
LimitNPROC=infinity
1212
LimitCORE=infinity
1313
Environment=PATH=/usr/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
14-
Environment=PM2_HOME=/opt/zmd/.pm2
14+
Environment=PM2_HOME={{ zmarkdown_dir }}/.pm2
1515
Environment=SENTRY_DSN={{ zmarkdown_sentry_dsn }}
1616
Environment=ZDS_ENVIRONMENT={{ env }}
17-
PIDFile=/opt/zmd/.pm2/pm2.pid
17+
PIDFile={{ zmarkdown_dir }}/.pm2/pm2.pid
1818

19-
ExecStart=/usr/lib/node_modules/pm2/bin/pm2 start -f /opt/zmd/node_modules/zmarkdown/server/index.js -i 3 --max-memory-restart 150M
20-
ExecReload=/usr/lib/node_modules/pm2/bin/pm2 reload all
21-
ExecStop=/usr/lib/node_modules/pm2/bin/pm2 kill
19+
ExecStart={{ zmarkdown_dir }}/node_modules/pm2/bin/pm2 start -f {{ zmarkdown_dir }}/node_modules/zmarkdown/server/index.js -i 3 --max-memory-restart 150M
20+
ExecReload={{ zmarkdown_dir }}/node_modules/pm2/bin/pm2 reload all
21+
ExecStop={{ zmarkdown_dir }}/node_modules/pm2/bin/pm2 kill
2222

2323
[Install]
2424
WantedBy=multi-user.target

0 commit comments

Comments
 (0)