Reputation: 5893
I set up Jenkins, pm2 on AWS ubuntu server. I had a website A that built by jenkins. The jenkins then will start that website by pm2 in the configured shell. However, only I start the website by logging on to the ubuntu server manually and run pm2 start A
can make the website running.
The problem seems that pm2 started by user jenkins will not be visible by the outside world. Only started by user ubuntu (via ssh ubuntu@myubuntuserver) can be effectively public.
Why and how can I make jenkins start pm2 automatically?
Upvotes: 3
Views: 1365
Reputation: 31
Its late but just help someone in need:
Issue: pm2 would have been installed with ubuntu user or root, which Jenkins can't access
sudo su jenkins
(if password is required, set
password from root user sudo passwd jenkins
)npm i -g pm2
Now, Jenkins should be able to run pm2
Upvotes: 2
Reputation: 5893
Actually the jenkins has already started pm2 automatically. Why you can't see it via pm2 status
is because you logged in to the server with another user.
By sudo su jenkins
you can switch to the jenkins
user and then you can see them by pm2 status
.
Upvotes: 4