Gitlab development environment docker image
A docker image to run Gitlab development environment based on Fedora.
Based on: iconoeugen/ruby-dev
Using: gdk
Environment Variables
- gitlab_repo: Gitlab fork repository url. If left empty then the official repository will be cloned (Defaults: "")
- gitlab_shell_repo: Gitlab Shell fork repository url. If left empty then the official repository will be cloned (Defaults: "")
- gitlab_workhorse_repo: Gitlab Workhorse fork repository url. If left empty then the official repository will be cloned (Defaults: "")
Usage example
After configuring the development environment as described in iconoeugen/fedora-dev, you can start a development container as:
dev run iconoeugen/gitlab-dev
Working on a fork for example:
dev -e gitlab_repo=https://gitlab.com/myproject/gitlab-ce.git iconoeugen/gitlab-dev
Prepare development environemnt
Export the following environment variables (change the values to match your envionment) to easily make use of commands copy-paste in following sections:
export GITLAB_WORK_DIR=~/work/gitlab/hvlad/gitlab-development-kit
export GITLAB_REPO=https://gitlab.com/hvlad/gitlab-ce.gitPrepare the development environment on the host system:
mkdir ${GITLAB_WORK_DIR}Run the development container that will also attach an interactive console to the running container:
dev run -d ${GITLAB_WORK_DIR} -e gitlab_repo="${GITLAB_REPO}" iconoeugen/gitlab-devDevelopment URL: (http://localhost:3000)
Development admin account: root / 5iveL!fe
More interactive consoles
If you want to start more interactive consoles that attache to the already running container use the command:
dev exec -d ${GITLAB_WORK_DIR} iconoeugen/gitlab-devGitlab App
To execute any of the following command you have to open a development console that is attached to the already running container:
dev exec -d ${GITLAB_WORK_DIR} iconoeugen/gitlab-devRun DB only
To start the Postgresql and Redis servers:
cd /workspace/gitlab-development-kit
gdk run dbUpdate development environment
If the configuration files provided with Gitlab development kit you have to regenerate all config file:
cd /workspace/gitlab-development-kit
make updateDelete and regenerate all config files created by GDK
If the configuration files provided with Gitlab development kit you have to regenerate all config file:
cd /workspace/gitlab-development-kit
gdk reconfigureCompile
This is an extra dependency for openid connect:
echo "gem 'omniauth-openid-connect',:git => 'https://github.com/iconoeugen/omniauth-openid-connect.git', :branch => 'upstream_forks'" >> /workspace/gitlab-development-kit/gitlab/GemfileInstall gem dependencies:
cd /workspace/gitlab-development-kit/gitlab
bundle install --without mysql production --jobs 4Start
Development Procfile mappings to production:
- rails-background-jobs => sidekiq
- rails-web => unicorn
- gitlab-workhorse => gitlab-workhorse
cd /workspave/gitlab-development-kit
./run appCheck running app
Navigate in a browser to Gitlab homepage: (http://localhost:3000/)
## Test
- RSpec: https://www.jetbrains.com/help/ruby/8.0/using-rspec-in-ruby-projects.html
## Using RubyMine
RubyMine is comercial Cross-platform intelligent IDE for productive Ruby / Rails development that allows a trial phase
of 30 days or requires a license to activate.
### Install IDE
Inside development container:
``` bash
export RUBYMINE_VERSION="2017.1.2"
curl -L https://download-cf.jetbrains.com/ruby/RubyMine-${RUBYMINE_VERSION}.tar.gz | tar xvz -C ~/
unlink ~/RubyMine
ln -s ~/RubyMine-${RUBYMINE_VERSION} ~/RubyMine
Start IDE
Start RubyMine inside development container:
/home/default/RubyMine/bin/rubymine.shConfigure IDE
Open new project
Open a new project located at:
/workspace/gitlab-development-kit/gitlabConfigure
-
Configure DB
Edit file
/workspce/gitlab-development-kit/Procfilethepostgresql:line:sed -e "s/-h ''/-h '0.0.0.0'/" -i /workspace/gitlab-development-kit/Procfile #sed -e "s|/home/git|/workspace/gitlab-development-kit" -i Procfile
Enable Database Tools:
Menu -> View -> Tool Windows -> Database:- Open Properties dialog for
Rails gitlab: development: - Import drivers from Drivers -> PostgreSQL tab (on left side)
- Configure Imported Data Source and test connection
- Host:
localhost - Port:
5432 - Database:
gitlabhq_development - User:
<shell_user_name> - Password:
<empty>
- Open Properties dialog for
-
Debug gitlab unicorn
Comment out the
rails-weblines in/workspace/Procfileto avoid./run appstarting unicorn.sed -e "s/rails-web:/#rails-web:/" -i /workspace/gitlab-development-kit/ProcfileEdit run configuration:
Menu -> Run -> Edit Configurations:- Open Properties dialog for
Rails -> Development: gitlab - Select Configuration Tab
- Server:
Unicorn - IP addr:
0.0.0.0 - Port:
3001 - Server args:
-c /workspace/gitlab-development-kit/gitlab/config/unicorn.rb - Environment:
development - Dummy app:
test/dummy - Run browser:
Unchecked-http://localhost:3001-UncheckedStart Javascript debuger
- Bundler Tab
- Run the script in context of the bundle:
Checked
- Open Properties dialog for
Run Debug
Edit run configuration: `Menu -> Run -> Debug Development: gitlab