Deployment options: Netlify + Dokku on DigitalOcean vs now.sh, GitHub Pages, Heroku and AWS
Tags: deployment, showdev, hosting, stack
Published: 2018-10-05 12:06:09

---
title: Deployment options: Netlify + Dokku on DigitalOcean vs now.sh, GitHub Pages, Heroku and AWS
published: true
tags: deployment, showdev, hosting, stack
canonical_url: https://codewithhugo.com/deployment-options-netlify---dokku-on-digitalocean-vs-now.sh-github-pages-heroku-and-aws/
---

> Settling on a [Netlify](https://www.netlify.com/) + [Dokku](https://github.com/dokku/dokku) on [DigitalOcean](https://m.do.co/c/4ee8b2d1adb4) deployment stack for JavaScript and Node.

Over the last few years I’ve never quite settled on a goto deployment strategy for my apps and projects. Technology-wise it has settled towards Vue or static site generators for the frontend with Node on the backend, whether that’s for API servers or handling rendering through handlebars.

What I’ve finally settled on is [Netlify](https://www.netlify.com/) + [Dokku](https://github.com/dokku/dokku) on [DigitalOcean](https://m.do.co/c/4ee8b2d1adb4). Netlify for anything static (and more with forms, CMS and lambda). Dokku, “The smallest PaaS implementation you’ve ever seen.“ for any backend apps and databases. This is what I’ve used to deploy my latest projects [Post Frequency](https://accountableblogging.com/post-frequency) and [Accountable Blogging](https://accountableblogging.com/post-frequency), tools to quantify and improve your blogging output.

This is a long list of pros/cons for a bunch of services:

- 👍 → pro
- 👎 → con
- 🤔 → undecided
- 🚨 → deal-breaker for me
- 🤓 → nice-to-have

My past deployment experiences

  - now.sh
  - GitHub Pages
  - Heroku
  - AWS
  - DigitalOcean
  - Vultr

The stack moving forward

  - Netlify
  - Dokku on DigitalOcean


## My past deployment experiences

For these purposes I’ve leaned towards the following deployment options:

### [now.sh](https://now.sh)

- 👍 does static hosting
- 👍 does app hosting
- 👍 can build your static site/frontend
- 👎 no database hosting
- 🤔 built-in DNS
- 🚨 I didn’t use it to full capacity (only ever had 2 deployments instead of the limit of 5)

### [GitHub Pages](https://pages.github.com/)

- 👍 free
- 👍 baked into your GitHub repos (as simple as pushing to `gh-pages` branch)
- 👍 static hosting
- 👎 can’t build your app itself
- 👎 for the longest time was difficult to have SSL for (had to pair it with Cloudflare)
- 👎 dealing with domain names

### [Heroku](https://www.heroku.com/)

- 👍 app hosting
- 👍 database hosting (with a generous free tier)
- 👍 `git push heroku master` deploys
- 👍 addons system
  - 👍 things like logging aggregation, monitoring are just a click away
- 👍 buildpack system
- 👍 easy domain management
- 👎 🤑 per app/dyno pricing
- 🚨 it’s just not worth it for low traffic apps
- 🚨 Scaling Node apps involves increasing the number of processes + a Node process is not very resource intensive, which is not a great use of resources/cost (not that I’ve ever needs to scale my personal apps)

### AWS

- 👍 has everything you could think of
- 👎 dashboard UI
- 🚨 pricing once the free tier expires (1 year) is steep even for the smallest instances

### [DigitalOcean](https://m.do.co/c/4ee8b2d1adb4)

- 👍 dashboard UI
- 👍 competitive pricing
- 👎 managing the server
  - ssh-ing to install databases, and runtime requirements (Node, pm2)
  - deployment over ssh (or at least ssh to `git pull`
- 👎 setting up nginx 😛
  - _I secretly love dealing with nginx configuration, just not at the cost of shipping some code_

\*\* I won’t mention one-click deploys here because I hadn’t used them before deciding to give Dokku a try\*

### [Vultr](https://www.vultr.com/)

- 👍 cheapest VPS I could find at the time ($2.50)
  - caveat: the machine specs are what you pay for, which is enough to host a university final year project API + React app
- 👎 managing the server (see DigitalOcean)

## The stack moving forward

### [Netlify](https://www.netlify.com/)

- 👍 free tier (beyond generous)
- 👍 static hosting
- 👍 can build your static site/frontend
- 🤔 lambda ❤
  - 👍 having a backend (that isn’t a backend) for some stuff is cool
  - 👎 dealing with a bundler for backend code
  - 👎 debugging minified backend code
  - 🤔 lambda startup time (can be fine if you have an SPA on the frontend that puts a nice loading state while you wait)
- 👍 forms
  - trivial to integrate
  - no need to prematurely add a second service eg. to collect email addresses on a landing page
- 👍 Netlify CMS + identity
- 🤔 CDN baked in
- 👍 DNS
- 👍 automatic SSL
- 🤓 preview apps
- 👍 nice GitHub integration

### [Dokku](https://github.com/dokku/dokku) on [DigitalOcean](https://m.do.co/c/4ee8b2d1adb4)

- 👍 as expensive as necessary
  - can have as many apps as you want as long as it doesn’t max out your CPU/RAM
  - easy to scale up
  - starting for $5/mo
- 👍 [DigitalOcean](https://m.do.co/c/4ee8b2d1adb4)’s [“Dokku one-click deploy”](https://www.digitalocean.com/products/one-click-apps/dokku/)

Dokku pros and cons (regardless of [DigitalOcean](https://m.do.co/c/4ee8b2d1adb4))

- 👍 `git push dokku master` deploys
- 👍 management from the command line
- 👎 no UI by default although [https://github.com/palfrey/wharf](https://github.com/palfrey/wharf) could be cool
- 👍 easy SSL
- 👍 easy domain management
- 👍 application hosting
- 👍 database hosting
- 🤔 multiple apps on one instance
  - if the droplet goes down 2-3 apps go down (I don’t think anyone cares about this)
  - a single high traffic app can eat resources (when apps get traffic, move them somewhere else)
- 🤔 still self-hosting
  - Except now I need to be able to manage Docker/Dokku stuff

## Setting Dokku up

- 👍 [one-click deploy droplet](http://dokku%20domains:add%20feed-accountable-blogging%20feed.accountableblogging.com) on [DigitalOcean](https://m.do.co/c/4ee8b2d1adb4)
- 👎 there isn’t a definitive guide to setting up a DNS record for a subdomain for the Dokku instance
  - here’s my shot at it:
  - find out the server’s IP
  - create an A record
    1. for `*.deploy.yourdomain.tld` and `deploy.yourdomain.tld` (feel free to replace `deploy` with whatever subdomain), for me that was `deploy.codewithhugo.com`
    2. point the record to the IP address
  - (if you’re on CloudFlare or anything else that can proxy): **don’t use the CDN/proxy feature**
  - To check it works, ssh `deploy.yourdomain.tld`
- 🤔 no local CLI (everything is done over SSH)
  - add `alias dokku="ssh -t dokku@deploy.yourdomain.tld"` to your `.bashrc`/`.zshrc`
  - then use `dokku <command>` as you would on the remote server
- 👎 same situation for custom domains for apps
  - again, my take on it
  - `dokku domains:add your-app-name subdomain.domain.tld`
  - Create a CNAME record
    1. name: `subdomain`
    2. value: `your-app-name.deploy.yourdomain.tld`
- 👍 easy letsencrypt ([https://github.com/dokku/dokku-letsencrypt](https://github.com/dokku/dokku-letsencrypt))
  - ssh into the server
  - `sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git`
  - Add letsencrypt to an app
  - `dokku letsencrypt app-name`
  - Add letsencrypt certificate auto-renewal CRON job:
  - `dokku letsencrypt:cron-job --add`

## Parting thoughts

My migration of a couple of apps off of now.sh wasn’t to go from bad to good, but rather from good to better (for my needs).

[<svg xmlns="http://www.w3.org/2000/svg" style="height:12px;width:auto;position:relative;vertical-align:middle;top:-1px;fill:white" viewbox="0 0 32 32"><title>unsplash-logo</title>
<path d="M20.8 18.1c0 2.7-2.2 4.8-4.8 4.8s-4.8-2.1-4.8-4.8c0-2.7 2.2-4.8 4.8-4.8 2.7.1 4.8 2.2 4.8 4.8zm11.2-7.4v14.9c0 2.3-1.9 4.3-4.3 4.3h-23.4c-2.4 0-4.3-1.9-4.3-4.3v-15c0-2.3 1.9-4.3 4.3-4.3h3.7l.8-2.3c.4-1.1 1.7-2 2.9-2h8.6c1.2 0 2.5.9 2.9 2l.8 2.4h3.7c2.4 0 4.3 1.9 4.3 4.3zm-8.6 7.5c0-4.1-3.3-7.5-7.5-7.5-4.1 0-7.5 3.4-7.5 7.5s3.3 7.5 7.5 7.5c4.2-.1 7.5-3.4 7.5-7.5z"></path></svg>Bill Jelen](https://unsplash.com/@billjelen?utm_medium=referral&utm_campaign=photographer-credit&utm_content=creditBadge "Download free do whatever you want high-resolution photos from Bill Jelen")