This procedure has been tested on Vultr, and Digital Ocean. In theory it should work on any VPS as long as the linux instance is Ubuntu. There might be some subtle differences for other linux variants.
- Create a new compute instance on Vultr using an 64-bit ubuntu image
- From the available compute instance sizes, pick at a minimum a server with 1024Mb of memory. Compute instances with smaller sizes will fail on deploy
- ssh on to the server root@ipaddress
- If this is your first deploy onto Vultr ensure you've created a ssh key pair firstly. Then add your public key during the compute instance creation procedure
- Now wait for Vultr to provision an instance of your new image
- Install Dokku 0.6.5
- wget https://raw.githubusercontent.com/dokku/dokku/v0.6.5/bootstrap.sh
- sudo DOKKU_TAG=v0.6.5 bash bootstrap.sh
- Test the dokku install
- dokku --help
- dokku apps
- Add dokku to the docker group
- sudo usermod -aG docker dokku
- Create an A record in your dns provider to point to the newly assigned VM's ip address
- On the VM create and app
- dokku apps:create app_name
- On the VM create the postgres database
- sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git
- dokku postgres:create db_name
- docker ps (to check that the postres docker container is up)
- Link the service to the app (by convention our app name and db name will be the same)
- dokku postgres:link db_name app_name
- This will create a config var named DATABASE_URL
- Add any environment variables to the new VM
- dokku config:set storm VAR=VALUE
- Deploy the app (On your dev machine)
- git remote add env dokku@host_name:app_name
- git push env master
- Remap the nginx port mapping for the server
- dokku config:set app_name DOKKU_PROXY_PORT_MAP=http:80:3000
- Run any rails commands to set the app up
- dokku run app_name rake db:migrate
- Scale any present workers
- dokku ps:scale app_name web=1 worker=1
- To expose the postgres database
- dokku postgres:expose app_name
At step 4.
Open the given URL (use your servers ipaddress) in your browser, and then select the appropriate options.