Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rafaelmotta/f51dd371d9221163fe4335c38e211c9c to your computer and use it in GitHub Desktop.
Save rafaelmotta/f51dd371d9221163fe4335c38e211c9c to your computer and use it in GitHub Desktop.
Deploy ruby on rails application with Dokku on Digital Ocean
1) Create a droplet on Digital Ocean
1.1 cloud.digitalocean.com/droplets/new;
1.2 In choose an image click on "One-click apps" and choose Dokku Image;
1.3 After choose the size, datacenter region, add your SSH Keys¹ and choose a hostname;
1.4 Create.
¹ - Find your SSH Keys in ~/.ssh/id_rsa.pub
2) SSH connection
2.1 Add your ssh key for Dokku with the command: cat ~/.ssh/id_rsa.pub | ssh root@yourdokkuinstance "sudo sshcommand acl-add dokku laptop"
2.2 ssh root@host
3) Deploy
3.1 From your local machine clone your project
3.2 On your Dokku host: dokku apps:create your-app
3.3 Install the postgres plugin: sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git
3.4 Create a postgres service with the name rails-database: dokku postgres:create your-rails-database
3.5 Link database and your app: dokku postgres:link your-rails-database your-app
3.6 git remote add dokku dokku@host:your-app
3.7 git push dokku master
4) Migrate your database
4.1 ssh root@host dokku run your-app rake db:migrate
4.2 ssh root@host dokku run your-app rake db:seed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment