DEV Community

Cover image for The Best Way to Deploy Your Own Apps
Federico Ramirez
Federico Ramirez

Posted on

The Best Way to Deploy Your Own Apps

I've used Heroku in the past for a few hobby projects, but their pricing always kept me from considering it for serious projects.

For tiny projects I know for certain they won't scale, Heroku was great, but for serious projects, its way cheaper to just get your own VPS and do everything yourself, although of course, it's much more work!

With services like Heroku you end up paying for management, which is a perfectly fine approach sometimes. I'm no stranger to configuring my own server, but still, I'd rather avoid it if I can.

Since Heroku removed their free tier, I've been migrating my little Discord bot from server to server. My latest server was Railway, but given they were also removing their free tier, and I couldn't find anything I liked, I just bit the bullet and set up my own VPS.

I ended up deciding on Hostinger, because not only they give me more bang for my buck (2 vCPUs, 8GB RAM and 100GB SSD for $6.99 a month is not bad at all) but also they provide built-in weekly backups, unlike most other services that you must pay separately for that feature. They also have been in the hosting business since forever so it's a solid choice.

With a VPS in place, I could certainly just manually set up everything I need, but that's just what I wanted to avoid by using services like Heroku and Railway. Then, I remembered Dokku and decided to give it a shot.

I used Vagrant to try it locally, and I was surprised just how easy it was to set everything up! Just two commands and it's up:

wget -NP . https://dokku.com/install/v0.30.9/bootstrap.sh
sudo DOKKU_TAG=v0.30.9 bash bootstrap.sh
Enter fullscreen mode Exit fullscreen mode

It uses Docker under the hood, so you can deploy your Dockerized apps very easily, and if your app doesn't use Docker, no worries! Dokku is great at just guessing your app's Buildpack. It "just works" for most languages, such as Node.js, Ruby, Python and PHP.

Setting up Dokku in my VPS only took a couple of minutes following their documentation. Getting my bot up there was as easy as just setting up the environment variables with dokku config:set and doing a git push.

What's so great about Dokku is that you can host several apps on the same server if you want. That's great for hobby projects. Create databases and apps on the fly, remove them, play with them, and don't worry about pricing. It's all included in the fixed price you pay for your VPS.

If you ever need more power you can always move that app outside to either it's own Dokku server with more resources, or something like AWS to take full advantage of horizontal scaling. You can even use a mixed solution by having a few workers for your web server and a managed database on AWS with unlimited scaling. The good thing is that, by then, you'll know for certain how much resources your app consumes and what you'll need, so you can take a better informed decision.

I was just blown away by how easy it was to set everything up! You can even limit resources for some of your apps, limiting things like CPU and RAM.

All in all, I really recommend trying out Dokku if you are a developer interested in hosting your own projects. It makes it super easy to get everything you need to get up and running without having to worry about the specifics. And the price is impossible to beat!

Give it a shot locally! It's so easy it feels like cheating.

Top comments (0)