Skip to content

Instantly share code, notes, and snippets.

@mraaroncruz
Last active December 8, 2017 11:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mraaroncruz/ff0b73733add72ac44e37822e325b320 to your computer and use it in GitHub Desktop.
Save mraaroncruz/ff0b73733add72ac44e37822e325b320 to your computer and use it in GitHub Desktop.
Some docker

Deploy to Dokku Steps

  • Create droplet on DIGIOCEAN
  • Update DNS
  • install dokku
wget https://raw.githubusercontent.com/dokku/dokku/v0.10.5/bootstrap.sh;
sudo DOKKU_TAG=v0.10.5 bash bootstrap.sh
  • Copy over deploy key
cat /path/to/public_key | ssh root@yourdokkuinstance "sudo sshcommand acl-add dokku [description]"
  • Go to your droplet's IP address and set the virtual host name and save
  • Create app on dokku
dokku apps:create your_app_name
  • Create web app
  • Create Dockerfile
FROM ruby:2.2

RUN curl -sL https://deb.nodesource.com/setup | bash - && \
  apt-get install -yq nodejs build-essential libpq-dev && \
  apt-get update

RUN mkdir /app
WORKDIR /app

ENV RACK_ENV "production"
ENV PORT 5000

COPY . .

RUN gem install bundler

USER root

# EXPOSE $PORT

ENTRYPOINT ["./startup.sh"]
  • Add startup.sh to your project's root
#!/bin/bash

# Contents of startup.sh

bundle check || bundle install --without development,test

bundle exec rake assets:precompile

bundle exec rake db:migrate

bundle exec puma -e production
  • Set DB to ENV var
  • Set secretkeybase
  • Install postgres plugin
dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
dokku postgres:create the_db
dokku postgres:link the_db my_app
  • Install letsencrypt plugin
dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
dokku letsencrypt my_app
  • push app
  • setup database
  • add letsencrypt email
  • Get letsencrypt cert
#!/bin/bash
bundle check || bundle install --without development,test
bundle exec rake assets:precompile
bundle exec rake db:migrate
bundle exec puma -e production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment