DEV Community

Sebastian Ślęczka
Sebastian Ślęczka

Posted on

Selfhosted heroku alternative

Hey #devs! I'm looking for an alternative to my node.js application to serve API on my own server in a similar way as using Heroku.

I know that I could just start the application, but for me it's important that the application starts automatically when the server restarts or when new changes are merged to branch in gitlab / github.

Have a nice day!

Top comments (4)

Collapse
 
azrikahar profile image
Azri Kahar • Edited

Docker seems to fit your need here.

application starts automatically when the server restarts

Once u enabled docker service to start on server boot (systemctl enable docker) and adding a restart policy to your nodejs container, you are good to go :) a restart policy in Docker just means when should the container restart, more info in the official docs

when new changes are merged to branch in gitlab / github.

Once you update a branch, you can use Gitlab CI or GitHub Actions to build a new container image to your image registry of choice (Dockerhub, Gitlab has container registry for each repo from what I heard/seen online, Github has Github Packages) and instruct your pipeline to issue commands to your server to do a docker pull to get latest image, then docker-compose up to run the new image. If you want to simplify the steps, there is also the Watchtower container that will monitor for new images you pushed to your container registry of choice and renew the nodejs container automatically for you.

Collapse
 
sevastijan profile image
Sebastian Ślęczka

Fantastic! Thank you for the trail, I will certainly verify it!

Collapse
 
devgraph profile image
DevGraph

Engine Yard is no doubt the best alternative for Heroku. Although both of these platforms offer similar solutions, it is important to consider finer aspects of the features, functionality and support to understand which one reigns over the other. In that respect, I think Engine Yard surely has an upper hand over Heroku.
So, first let’s see the disadvantage of Heroku and then see some crucial features of Engine Yard which Heroku does not offer.

Disadvantages of Heroku:

• Low network performance
• Inbound and outbound latency is high
• Heroku does not allow you to run any other services on dynos
• Heroku’s dynos are frequently unreachable
• Not an ideal choice when it comes to working with third party tools and custom libraries.

Engine Yard features (which Heroku does not offer):

• Automated backups
• Sysadmin and DBA support
• Enterprise grade DevOps team
• App monitoring
Autoscaling
Highly scalable pricing
• Engine Yard also gives you the ability to deploy to any AWS zone, which is absent in Heroku.

So, Engine Yard is clearly a much better alternative for Heroku. engineyard.com/heroku-alternative/

Collapse
 
mhrsntrk profile image
mhrsntrk

The thing that you are looking for is Caprover. caprover.com/