Skip to content

Commit fd8a1ff

Browse files
committed
Enable PM2 to auto restart applications after a reboot
1 parent 6f1b738 commit fd8a1ff

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All changes that impact users of this module are documented in this file, in the [Common Changelog](https://common-changelog.org) format with some additional specifications defined in the CONTRIBUTING file. This codebase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5+
## Unreleased [minor]
6+
7+
> Development of this release was supported by the [French Ministry for Foreign Affairs](https://www.diplomatie.gouv.fr/fr/politique-etrangere-de-la-france/diplomatie-numerique/) through its ministerial [State Startups incubator](https://beta.gouv.fr/startups/open-terms-archive.html) under the aegis of the Ambassador for Digital Affairs.
8+
9+
### Added
10+
11+
- Enable PM2 to automatically restart Open Terms Archive applications after a reboot
12+
513
## 2.0.2 - 2024-06-12
614

715
_Full changeset and discussions: [#46](https://github.com/OpenTermsArchive/deployment/pull/46)._

roles/pm2/manage/tasks/main.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
- restart
2424
- start
2525

26+
- name: Generate and enable PM2 startup script
27+
ansible.builtin.command:
28+
cmd: sudo env PATH=$PATH:/usr/bin pm2 startup systemd -u {{ ansible_user }} --hp /home/{{ ansible_user }}
29+
tags:
30+
- restart
31+
- start
32+
2633
- name: Start Open Terms Archive applications
2734
ansible.builtin.command:
2835
cmd: pm2 startOrRestart pm2.config.cjs
@@ -32,3 +39,12 @@
3239
tags:
3340
- restart
3441
- start
42+
43+
- name: Save PM2 process list for auto-restart
44+
ansible.builtin.command:
45+
cmd: pm2 save
46+
chdir: /home/{{ ansible_user }}/{{ ota_directory }}
47+
tags:
48+
- restart
49+
- start
50+
- stop

0 commit comments

Comments
 (0)