DEV Community

Discussion on: Selfhosted heroku alternative

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!