Continuous Deployment with AWS, Dokku & CircleCI

Get your Dokku server up and running in AWS

Host dokku
User ubuntu
HostName <the elastic ip>
port 22
IdentityFile ~/.ssh/example.pem
ssh dokku
sudo DOKKU_TAG=v0.7.2 bash
# If you don't already have a ssh keypair, you'll need to run this:
# ssh-keygen -t rsa -b 4096 -C ""
cat ~/.ssh/ | ssh dokku sudo dokku ssh-keys:add ubuntu
ssh dokku
dokku apps:create 00-default
sudo dokku plugin:install
dokku letsencrypt:cron-job --add

Deploy a new app

  1. Register the app on the server
ssh dokku
dokku apps:create my-app
dokku ps:set-restart-policy my-app always
  • The npm start script is specified in package.json
  • The server listens on process.env.PORT not a hardcoded port number
cd my-app
git remote add dokku
git push dokku master
ssh dokku
dokku domains:add my-app
dokku config:set --no-restart my-app
dokku letsencrypt my-app

Configure CircleCI

  • Sign in to and click “Add Projects”
  • Find the repo for your app and click “Build project”
ssh dokku
cd ~/.ssh
ssh-keygen -t rsa # save as circleci.id_rsa
sudo dokku ssh-keys:add circleci ./
cat ~/.ssh/circleci.id_rsa
branch: master
- git remote add production
- git push production master




Full Stack JavaScript Engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Reimplementing JavaScript Array methods

Type-checked and maintainable CSS using aphrodite with Next.js —(1)

Two way SSL encryption using nodejs

Gumroad Embeds not working with Cloudflare

Using useContext and useReducer together: Let’s create ‘Redux-like’ global state in React

Function Declarations vs Function Expressions — Summed Up

How to build a web app with GraphQL, Apollo & React (Part I)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Will Schmid

Will Schmid

Full Stack JavaScript Engineer

More from Medium

AWS Dynamo DB Local Development using Localstack and Docker

Two way SSL encryption using nodejs

Serverless framework — manage lambda function package

Mocking an API with Rapidmock