Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating autostart. #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions deployment/roles/payment/tasks/payment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,31 @@
npm:
path: "/srv/{{ server_name }}/"

- name: Run On Startup
command: pm2 startup -u payments && mv /etc/init.d/pm2-init.sh /etc/init.d/pm2-{{ server_id }}.sh
- name: Payments | Startup - remove old script
file:
state: absent
path: /etc/init.d/pm2-init.sh

- name: Payments | Startup - remove old script
file:
state: absent
path: /etc/init.d/pm2-{{ server_id }}.sh

- name: Payments | Run On Startup
command: pm2 startup -u payments
args:
creates: "/etc/init.d/pm2-{{ server_id }}.sh"
chdir: "/srv/{{ server_name }}"
chdir: "/srv/{{server_name}}"

- name: Payments | Rename Startup Script
command: mv /etc/init.d/pm2-init.sh /etc/init.d/pm2-{{ server_id }}.sh

- name: Payments | Removing wrong names
command: bash -c "find . | grep pm2-init | xargs rm"
args:
chdir: "/etc"

- name: Payments | Run on startup
command: update-rc.d pm2-{{ server_id }}.sh defaults

- name: delete existing pm2 processes if running
command: "pm2 delete {{ server_id }}"
Expand All @@ -64,4 +84,3 @@
NODE_ENV: "production"
PORT: "{{payments_port}}"