Skip to content
This repository was archived by the owner on Apr 3, 2018. It is now read-only.
amtrack edited this page Sep 20, 2014 · 1 revision

dokku

Required dokku plugins

Checkout gitlabhq

$ git clone https://github.com/gitlabhq/gitlabhq.git
$ cd gitlabhq

Prepare your application for deploying to dokku

$ git checkout -b deployment
$ echo -e "https://github.com/amtrack/buildpack-gitlab.git\nhttps://github.com/heroku/heroku-buildpack-ruby.git" > .buildpacks
$ git add .buildpacks
$ git commit -m "prepare for dokku"

Create a dokku application on the server

$ git remote add dokku <your-dokku-url>
$ git push dokku deployment:master # will fail

Configure the app on your dokku server

root@vps:$ dokku config:set gitlab BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
root@vps:$ dokku config:set gitlab CURL_TIMEOUT=120
root@vps:$ dokku mariadb:create gitlab
root@vps:$ dokku redis:create gitlab

Push the application

$ git push dokku deployment:master

Seed the database

root@vps:$ dokku run gitlab bundle exec rake db:setup RAILS_ENV=production
root@vps:$ dokku run gitlab bundle exec rake db:seed_fu RAILS_ENV=production

Test the deployment

root@vps:$ dokku run gitlab bundle exec rake gitlab:check RAILS_ENV=production

Open https://gitlab.YOURDOMAIN in your browser.

Advanced usage

Persistent storage

It is highly recommended to run these steps as early as possible after having deployed gitlab.

Create some folders for persistent storage:

root@vps:$ test -d /opt/gitlab/repositories || sudo mkdir -p /opt/gitlab/repositories; sudo chown -R dokku:dokku /opt/gitlab/repositories
root@vps:$ test -d /opt/gitlab/gitlab-satellites || sudo mkdir -p /opt/gitlab/gitlab-satellites; sudo chown -R dokku:dokku /opt/gitlab/gitlab-satellites
root@vps:$ test -d /opt/gitlab/log || sudo mkdir -p /opt/gitlab/log; sudo chown -R dokku:dokku /opt/gitlab/log
root@vps:$ test -d /opt/gitlab/.ssh || sudo mkdir -p /opt/gitlab/.ssh; sudo chown -R dokku:dokku /opt/gitlab/.ssh

Set some docker options for persistent storage:

root@vps:$ dokku docker-options:add gitlab "-v /opt/gitlab/repositories:/home/git/repositories"
root@vps:$ dokku docker-options:add gitlab "-v /opt/gitlab/gitlab-satellites:/home/git/gitlab-satellites"
root@vps:$ dokku docker-options:add gitlab "-v /opt/gitlab/log:/app/log"
root@vps:$ dokku docker-options:add gitlab "-v /opt/gitlab/.ssh:/home/git/.ssh"

Rebuild the app to apply the docker options:

root@vps:$ dokku rebuild gitlab

Exposing the SSH port to access the git repositories (work in progress)

You will need to make some changes in the config/gitlab.yml file (see instruction at GitLab Installation Guide) and expose the containers port 22 to the host port 2222 (for example).

First tell dokku to expose the port when the app is build again

root@vps:$ dokku docker-options:add gitlab "-p 2222:22"

Then create the config based on the example config file

$ cp config/gitlab.yml.example config/gitlab.yml
$ git add -f config/gitlab.yml
$ git commit -am "force add config/gitlab.yml"

Make the following changes

* gitlab.host: gitlab.YOURDOMAIN
* gitlab_shell.ssh_port: 2222

Commit and push the changes

$ git commit -am "expose repositories on port 2222 via SSH"
$ git push dokku deployment:master