How to deploy Loopback ? Need simple explanation

kartsims picture kartsims · Apr 18, 2016 · Viewed 7.9k times · Source

I have developed a Loopback API and would like to deploy it to a test instance (Heroku or Digital Ocean, probably).

It is quite complicated to understand how to deploy it. There seems to be many solutions out there, from StrongLoop Process Manager to a plain Node.js server... The information is not very digest so could anyone help me out understand what possibilities I have to deploy it and what are the pro/cons of each one.

I am reading some documentation right now but feel a bit lost. Some input from people who have already deployed it would be great, I can't be the only one to feel confused at this point.

Answer

Mikael Jensen picture Mikael Jensen · Apr 21, 2016

First difference is if you are planning to host it on a server (Digital Ocean) or as a hosted node process (Heroku).

On Heroku you need to understand their way of doing it, but once done can save you a lot of worry on infrastructure management. This would not include StrongPM and Heroku is already it's own processmanager. If you have basic understanding of Git and don't use advanced stuff eg. with OS dependencies, this is the easiest in the long run. Don't have experience, but it would seem that Heroku works directly of a Git repository, so working with Git is a requirement for this model.

On a server (eg. digital ocean), you need to decide on an OS and set that up with dependencies, install node, DBs, ect. Once does you can manage your node process with a process manager, eg. StrongPM, though I've had mi battle with it and long ago decided to go with PM2 as process manager, which I found much easier to understand and handle, both initially and in the long run. But the basic is the same as on your local machine, you just need it to run "node server.js", a process manager just gives it some more bells and whistles (auto restart on error, monitoring and repeatable process start, being the main things).