On the previous article we’ve been discussed about
how to create Vanity name server using digital ocean
Now, we move on to the next step.
Dokku is a mini-Heroku powered by Docker written in less than 100 lines of Bash. Once it’s set up on a host, you can push Heroku-compatible applications to it via Git. They’ll build using Heroku buildpacks and then run in isolated containers. The end result is your own, single-host version of Heroku.
Dokku is under 100 lines because it’s built out of several components that do most of the heavy lifting: Docker, Buildstep, and gitreceive.
- Docker is a container runtime for Linux. This is a high-level container primitive that gives you a similar technology to what powers Heroku Dynos. It provides the heart of Dokku.
- Buildstep uses Heroku’s open source buildpacks and is responsible for building the base images that applications are built on. You can think of it as producing the “stack” for Dokku, to borrow a concept from Heroku.
- Gitreceive is a project that provides you with a git user that you can push repositories to. It also triggers a script to handle that push. This provides the push mechanism that you might be familiar with from Heroku.
- after you have create a vanity nameserver you can install dokku on your server
- based on dokku documentation you can bootstraping dokku stable version with command wget -qO- https://raw.github.com/progrium/dokku/v0.2.3/bootstrap.sh | sudo DOKKU_TAG=v0.2.3 bash
- Update buildstep
- git clone https://github.com/progrium/buildstep.git
- cd buildstep
- git pull origin master
- nano stack/packages.txt
- sudo make build
- install postgresql plugin
- cd /var/lib/dokku/plugins
- git clone https://github.com/Kloadut/dokku-pg-plugin postgresql
- dokku plugins-install
- Update docker.conf
- cd ~/
- sudo wget -O /etc/init/docker.conf https://raw.github.com/dotcloud/docker/master/contrib/init/upstart/docker.conf
- sudo service docker restart
- Add your local ssh_key to your dokku server
- cat ~/.ssh/id_rsa.pub | ssh root@your_dokku_server_domain.com “sudo sshcommand acl-add dokku ssh_key_name”
- push your first project
- add dokku remote
git remote add remote_name dokku@your_dokku_server_domain.com:app_name
- git push remote_name master
- create database for your app
- ssh dokku@your_dokku_server_domain.com postgresql:create app_name #from your local
- link database for your app
- ssh root@your_dokku_server_domain.com
dokku postgresql:link app_name database_name
- run migration
- dokku run app_name rake db:migrate
- now try to visit “app_name.your_dokku_server_domain.com”,
you should see your app there
- install dokku-custom-domain plugin
- git clone https://github.com/neam/dokku-custom-domains.git /var/lib/dokku/plugins/custom-domains
- dokku plugins-install
- add your custom domain
- dokku domains:set app_name domain1.com www.domain1.com domain2.com (Server side)
- ssh dokku@your_dokku_server_domain.com domains:set app_name domain1.com www.domain1.com domain2.com (Client side)
Installing Dokku as your own PaaS
Credits To : Muhammad Bayu