Keep plumber up and running

Hello,

I am trying to push our R project from local to a production server using Digital Ocean. I've created a droplet, ssh into the server, installed R and plumber, and when I run the plumber command, I can access the endpoint via URL in browser. However, when I close the ssh session, the R/plumber stops servicing. How do I make it so that it is running 24/7 even if I am not ssh into the server like how nginx or apache serves in the background?

Thank you.

Seong

Make it into a service?

When you run it from your ssh session, the process is tied to your ssh session.

1 Like

Meztez,

That’s what I noticed. Is there a way to make it run in the background so that it is not tied to user’s current session?

Seong

Hi Seong! Yep, there are a couple of ways to achieve this, documented at https://www.rplumber.io/articles/hosting.html

I haven't used DigitalOcean but the DigitalOcean section on that page points to @meztez's {plumberDeploy} package. I tend to use the pm2 solution.

1 Like

Hi bearloga,

Thank you for the reply! I've seen that plumber page on hosting but didn't read it full. This time, I read the entire page and, yes, it looks like I can use pm2 to persist the service. I'll give that a try.

Seong

I was able to get the API up and running in the background. The documentation suggested pm2 but I used the supervisor tool instead and it worked out. The documentation could be updated to include supervisor. It was easier to work with without having to install node and npm.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.