How to run Peatio with pm2?


#1

Sorry if this seems like a dumb question, but I tried to run Peatio as a deamon like so:

$ bundle exec rails server -d

But then I get error 500 Internal Server Error when I visit https://myexchange.com/markets/usdbtc.json

If I run Peatio without the -d option instead I get all the data just fine

Is there a way to run Peatio with pm2 instead of using the rails daemon mode?
If so, can it be easily stoped/restarted using just pm2?


#2

This answer did the trick.

What’s needed to start Peatio in daemon mode is:

bundle exec passenger start -p PORT -d

… and to stop it:

bundle exec passenger stop -p PORT

The port number is not needed for port 3000 (default), but for peatio-trading-ui which uses 4000, it has to be specified in the argument as it’s shown above.


#4

I ended up writing a systemd unit to run Peatio and Peatio Trading UI with Puma, since Passenger is not officially supported, and has some issues with REQUEST_PATH not being passed in the environment vars.