-
Create one-click install Dokku droplet don't associate any ssh keys on this step
-
Enter ssh-keygen -t rsa on your local machine and follow instructions
-
Enable ssh access to remote server without password from your machine: cat ~/.ssh/id_rsa.pub | ssh [email protected] "sudo sshcommand acl-add dokku dokku"
-
Login to remote server ssh root@YOUR_SERVER_IP
-
Create new Dokku app: dokku apps:create myapp
-
Install psql Dokku plugin: before install set postgres version to 9.4: dokku config:set --global PSQL_SC_IMAGE=postgres:9.4 dokku plugin:install https://github.com/Flink/dokku-psql-single-container
-
Create postgres database: dokku psql:create myapp
-
Display database connection info 'dokku config myapp'(keep this window opened or copy info to clipboard), setup existing ssh key for Dokku: cat /root/.ssh/authorized_keys | sshcommand acl-add dokku dokku
-
On local machine create new Rails app: rails new myapp --database=postgresql && cd myapp
-
Init new git repository in app directory and add remote: git init && git remote add dokku [email protected]:myapp
-
Open gemfile and add: gem 'rails_12factor', group: :production
-
Run 'bundle install' in your rails app directory
-
Open config/database.yml and setup database connection for production (You can find necessary information in step 8). For example: production: <<: *default url: <%= ENV['YOUR_URL_HERE'] %> database: db_myapp username: db_myapp password: YOUR_PASSWORD_HERE host: postgres
-
Save all edited files
-
Commit changes: git add . && git commit -m 'your commit information'
-
Deploy your app: git push dokku master
PROFIT!11
And some usage tips:
- Use 'ssh dokku@YOUR_SERVER_IP run myapp rake db:migrate' for database migrations