From 170bc02e39c81ce50a6ec5c7864ca6bcedb322d4 Mon Sep 17 00:00:00 2001 From: "Luke \"Jared\" Bennett" Date: Fri, 24 Jun 2016 17:45:20 +0000 Subject: [PATCH 01/11] Updated README.md to include 'Local Network Binding' development information. --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index e2a890d..98d8ac9 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ sockets to avoid port conflicts. - [Running the tests](#running-the-tests) - [Simulating Broken Storage Devices](#simulating-broken-storage-devices) - [Simulating Slow Filesystems](#simulating-slow-filesystems) + - [Local Network Binding](#local-network-binding) - [Update gitlab and gitlab-shell repositories](#update-gitlab-and-gitlab-shell-repositories) - [Update configuration files created by gitlab-development-kit](#update-configuration-files-created-by-gitlab-development-kit) - [PostgreSQL replication](#postgresql-replication) @@ -383,6 +384,17 @@ script can be used to mount a local directory via SSHFS and slow down access to the files in this directory. For more information see [mount-slow-fs](#mount-slow-fs). +### Local Network Binding + +The default host binding for the rails application is `localhost`, if you +would like to use other devices on your local network to test the rails +application then run: + +``` +./run db & cd gitlab && rails s -binding=192.XXX.X.ZZ +``` + + ## Update gitlab and gitlab-shell repositories When working on a new feature, always check that your `gitlab` repository is up From 5663f4ba00690436b4e6d83ac9ec7c1fbcb3dc54 Mon Sep 17 00:00:00 2001 From: "Luke \"Jared\" Bennett" Date: Thu, 28 Jul 2016 17:01:54 +0000 Subject: [PATCH 02/11] Improved the "Local Network Binding" commands thanks to @jacobvosmaer-gitlab. --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 98d8ac9..9be7856 100644 --- a/README.md +++ b/README.md @@ -391,9 +391,16 @@ would like to use other devices on your local network to test the rails application then run: ``` -./run db & cd gitlab && rails s -binding=192.XXX.X.ZZ +echo 0.0.0.0 > host +./run ``` +If you would like to revert back to the `localhost` network then run: + +``` +rm host +./run +``` ## Update gitlab and gitlab-shell repositories From c65d0044fbcf8a1a0f7cedb88bc5dfb87a13625d Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 29 Jul 2016 14:51:54 +0200 Subject: [PATCH 03/11] Document how to use Pry --- Procfile.example | 1 + doc/howto/pry.md | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 doc/howto/pry.md diff --git a/Procfile.example b/Procfile.example index f15d3e0..44002c6 100644 --- a/Procfile.example +++ b/Procfile.example @@ -4,6 +4,7 @@ postgresql: support/postgresql-signal-wrapper postgres -D /home/git/postgresql/d #openldap: cd gitlab-openldap && libexec/slapd -F slapd.d -d2 -h "ldap://127.0.0.1:3890" gitlab-workhorse: PATH=/home/git/gitlab-workhorse:$PATH gitlab-workhorse -authSocket /home/git/gitlab.socket -listenAddr $host:$port -documentRoot /home/git/gitlab/public -developmentMode rails-web: RAILS_ENV=development support/exec-cd gitlab bin/web start_foreground +#rails-web: RAILS_ENV=development support/exec-cd gitlab bundle exec thin --socket=/home/git/gitlab.socket start rails-background-jobs: SIDEKIQ_LOG_ARGUMENTS=1 RAILS_ENV=development support/exec-cd gitlab bin/background_jobs start_foreground #influxdb: influxdb/bin/influxd -config influxdb/influxdb.conf #grafana: support/wait-postgresql-ready support/exec-cd grafana bin/grafana-server -config grafana.ini diff --git a/doc/howto/pry.md b/doc/howto/pry.md new file mode 100644 index 0000000..bdf7ad3 --- /dev/null +++ b/doc/howto/pry.md @@ -0,0 +1,19 @@ +# Debugging with Pry + +[Pry](http://pryrepl.org/) allows you to set breakpoints in Ruby code +for interactive debugging. Just drop in the magic word `binding.pry`. + +When running tests Pry's interactive debugging prompt appears in the +terminal window where you start your test command (`rake`, `rspec` +etc.). + +If you want to get a debugging prompt while browsing on your local +development server (localhost:3000) you need to make a change to the +Procfile in your GDK root directory because Unicorn is not compatible +with Pry. + +There are two `rails-web` lines in the Procfile, one containing +`bin/web` and one containing `thin`. Comment out the line containing +`bin/web` and uncomment the line containing `thin`. Now when you start +GDK with `./run` or `./run app` the Rails web application runs in Thin +instead of Unicorn. From ace42d95d644dbd2b5ff80a0d2e1e328f8b79814 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 1 Aug 2016 11:28:56 +0200 Subject: [PATCH 04/11] More exec wrappers --- Procfile.example | 4 ++-- support/path-unshift | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100755 support/path-unshift diff --git a/Procfile.example b/Procfile.example index f15d3e0..34321dd 100644 --- a/Procfile.example +++ b/Procfile.example @@ -1,8 +1,8 @@ redis: redis-server /home/git/redis/redis.conf postgresql: support/postgresql-signal-wrapper postgres -D /home/git/postgresql/data -k /home/git/postgresql -h '' #postgresql-replica: support/postgresql-signal-wrapper postgres -D /home/git/postgresql-replica/data -k /home/git/postgresql-replica -h '' -#openldap: cd gitlab-openldap && libexec/slapd -F slapd.d -d2 -h "ldap://127.0.0.1:3890" -gitlab-workhorse: PATH=/home/git/gitlab-workhorse:$PATH gitlab-workhorse -authSocket /home/git/gitlab.socket -listenAddr $host:$port -documentRoot /home/git/gitlab/public -developmentMode +#openldap: support/exec-cd gitlab-openldap libexec/slapd -F slapd.d -d2 -h "ldap://127.0.0.1:3890" +gitlab-workhorse: support/path-unshift /home/git/gitlab-workhorse gitlab-workhorse -authSocket /home/git/gitlab.socket -listenAddr $host:$port -documentRoot /home/git/gitlab/public -developmentMode rails-web: RAILS_ENV=development support/exec-cd gitlab bin/web start_foreground rails-background-jobs: SIDEKIQ_LOG_ARGUMENTS=1 RAILS_ENV=development support/exec-cd gitlab bin/background_jobs start_foreground #influxdb: influxdb/bin/influxd -config influxdb/influxdb.conf diff --git a/support/path-unshift b/support/path-unshift new file mode 100755 index 0000000..074397a --- /dev/null +++ b/support/path-unshift @@ -0,0 +1,4 @@ +#!/bin/sh +path=$1 +shift +exec /usr/bin/env PATH="$path:$PATH" "$@" From 4857872df2738bd2ee80fb47725808294de55fbd Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 1 Aug 2016 13:29:07 +0200 Subject: [PATCH 05/11] Install bundler automatically --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 03cc1d6..f46e728 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ all: gitlab-setup gitlab-shell-setup gitlab-workhorse-setup support-setup # Set up the GitLab Rails app -gitlab-setup: gitlab/.git gitlab-config .gitlab-bundle +gitlab-setup: gitlab/.git gitlab-config bundler .gitlab-bundle gitlab/.git: git clone ${gitlab_repo} gitlab @@ -40,9 +40,13 @@ gitlab/config/resque.yml: cd ${gitlab_development_root}/gitlab && bundle install --without mysql production --jobs 4 touch $@ +.PHONY: bundler +bundler: + command -v $@ > /dev/null || gem install $@ + # Set up gitlab-shell -gitlab-shell-setup: gitlab-shell/.git gitlab-shell/config.yml .gitlab-shell-bundle +gitlab-shell-setup: gitlab-shell/.git gitlab-shell/config.yml bundler .gitlab-shell-bundle gitlab-shell/.git: git clone ${gitlab_shell_repo} gitlab-shell From 7be8c0e40f6ebe06dcd36e7ad9a7116a2d3fc130 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 1 Aug 2016 14:14:39 +0200 Subject: [PATCH 06/11] Use exec for clean foreman shutdowns --- Procfile.example | 28 ++++++++++++++++------------ support/path-unshift | 4 ---- 2 files changed, 16 insertions(+), 16 deletions(-) delete mode 100755 support/path-unshift diff --git a/Procfile.example b/Procfile.example index abc6669..9208d13 100644 --- a/Procfile.example +++ b/Procfile.example @@ -1,12 +1,16 @@ -redis: redis-server /home/git/redis/redis.conf -postgresql: support/postgresql-signal-wrapper postgres -D /home/git/postgresql/data -k /home/git/postgresql -h '' -#postgresql-replica: support/postgresql-signal-wrapper postgres -D /home/git/postgresql-replica/data -k /home/git/postgresql-replica -h '' -#openldap: support/exec-cd gitlab-openldap libexec/slapd -F slapd.d -d2 -h "ldap://127.0.0.1:3890" -gitlab-workhorse: support/path-unshift /home/git/gitlab-workhorse gitlab-workhorse -authSocket /home/git/gitlab.socket -listenAddr $host:$port -documentRoot /home/git/gitlab/public -developmentMode -rails-web: RAILS_ENV=development support/exec-cd gitlab bin/web start_foreground -#rails-web: RAILS_ENV=development support/exec-cd gitlab bundle exec thin --socket=/home/git/gitlab.socket start -rails-background-jobs: SIDEKIQ_LOG_ARGUMENTS=1 RAILS_ENV=development support/exec-cd gitlab bin/background_jobs start_foreground -#influxdb: influxdb/bin/influxd -config influxdb/influxdb.conf -#grafana: support/wait-postgresql-ready support/exec-cd grafana bin/grafana-server -config grafana.ini -#sshd: /usr/sbin/sshd -e -D -f /home/git/openssh/sshd_config -#nginx: nginx -p /home/git/nginx -c conf/nginx.conf \ No newline at end of file +# GDK Procfile rules to help foreman shut down services: +# - all commands must start with 'exec' +# - no inline shell scripts ('&&' or ';') +# +redis: exec redis-server /home/git/redis/redis.conf +postgresql: exec support/postgresql-signal-wrapper postgres -D /home/git/postgresql/data -k /home/git/postgresql -h '' +#postgresql-replica: exec support/postgresql-signal-wrapper postgres -D /home/git/postgresql-replica/data -k /home/git/postgresql-replica -h '' +#openldap: exec support/exec-cd gitlab-openldap libexec/slapd -F slapd.d -d2 -h "ldap://127.0.0.1:3890" +gitlab-workhorse: exec /usr/bin/env PATH=/home/git/gitlab-workhorse:$PATH gitlab-workhorse -authSocket /home/git/gitlab.socket -listenAddr $host:$port -documentRoot /home/git/gitlab/public -developmentMode +rails-web: exec /usr/bin/env RAILS_ENV=development support/exec-cd gitlab bin/web start_foreground +#rails-web: exec /usr/bin/env RAILS_ENV=development support/exec-cd gitlab bundle exec thin --socket=/home/git/gitlab.socket start +rails-background-jobs: exec /usr/bin/env SIDEKIQ_LOG_ARGUMENTS=1 RAILS_ENV=development support/exec-cd gitlab bin/background_jobs start_foreground +#influxdb: exec influxdb/bin/influxd -config influxdb/influxdb.conf +#grafana: exec support/wait-postgresql-ready support/exec-cd grafana bin/grafana-server -config grafana.ini +#sshd: exec /usr/sbin/sshd -e -D -f /home/git/openssh/sshd_config +#nginx: exec nginx -p /home/git/nginx -c conf/nginx.conf diff --git a/support/path-unshift b/support/path-unshift deleted file mode 100755 index 074397a..0000000 --- a/support/path-unshift +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -path=$1 -shift -exec /usr/bin/env PATH="$path:$PATH" "$@" From 03e364d2b3ea61df27152f847999a9c5d3ad9bec Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 2 Aug 2016 19:15:21 +0200 Subject: [PATCH 07/11] Replace post-install message with HELP cheat sheet --- HELP | 11 +++++++++++ Makefile | 2 +- README.md | 8 ++------ 3 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 HELP diff --git a/HELP b/HELP new file mode 100644 index 0000000..2cb6544 --- /dev/null +++ b/HELP @@ -0,0 +1,11 @@ +# GitLab Development Kit cheat sheet + +./run # Start everything +./run db # Start enough to run tests +./run app # Start GitLab, need './run db' + +make gitlab_repo=https://my-fork # Install everything +make update # Pull application changes from Git +make clean-config all # Delete and regenerate all config files created by GDK + +# Development admin account: root / 5iveL!fe diff --git a/Makefile b/Makefile index f46e728..bed388f 100644 --- a/Makefile +++ b/Makefile @@ -99,7 +99,7 @@ support-setup: .ruby-version foreman Procfile redis postgresql openssh-setup ngi @echo "*********************************************" @echo "************** Setup finished! **************" @echo "*********************************************" - @sed -n '/^## Post-installation/,/^END Post-installation/p' README.md + cat HELP @echo "*********************************************" Procfile: diff --git a/README.md b/README.md index 589b5e7..d731ca3 100644 --- a/README.md +++ b/README.md @@ -312,15 +312,11 @@ You can override the port used by this GDK with a 'port' file. echo 4000 > port -If you want to work on GitLab CI you will need to install [GitLab Runner](https://gitlab.com/gitlab-org/gitlab-ci-multi-runner). +If you want to work on GitLab CI you will need to install [GitLab +Runner](https://gitlab.com/gitlab-org/gitlab-ci-multi-runner). To enable the OpenLDAP server, see the OpenLDAP instructions in this readme. -END Post-installation - -Please do not delete the 'END Post-installation' line above. It is used to -print the post-installation message from the `Makefile`. - ## Development When doing development, you will need one shell session (terminal window) From d12b12c7ee0c9c6c263ff0a662cabcc72bf83bfa Mon Sep 17 00:00:00 2001 From: Gokmen Goksel Date: Tue, 2 Aug 2016 20:30:02 +0300 Subject: [PATCH 08/11] Add .koding.yml for testing GitLab on Koding --- .koding.yml | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .koding.yml diff --git a/.koding.yml b/.koding.yml new file mode 100644 index 0000000..32d51df --- /dev/null +++ b/.koding.yml @@ -0,0 +1,77 @@ +koding: + buildDuration: 720 # ~12 min. + +provider: + aws: + access_key: '${var.aws_access_key}' + secret_key: '${var.aws_secret_key}' + +resource: + aws_instance: + gdk-instance: + root_block_device: + volume_size: 30 + instance_type: c3.xlarge + ami: '' + tags: + Name: '${var.koding_user_username}gitlab' + user_data: | + + # define variables: + export KODING_USER=${var.koding_user_username} + export KODING_USER_EMAIL=${var.koding_user_email} + export USER_HOME=/home/$KODING_USER + export GITLAB_BOOTSTRAP=$USER_HOME/gitlab-bootstrap.sh + + echo _KD_NOTIFY_@Updating package repository...@ + # add lxc repo + apt-add-repository -y ppa:ubuntu-lxc/lxd-stable + apt-get update -y + + echo _KD_NOTIFY_@Installing base requirements...@ + # install base requirements + apt-get install -y software-properties-common python-software-properties git postgresql postgresql-contrib libpq-dev phantomjs redis-server libicu-dev cmake g++ nodejs libkrb5-dev golang ed pkg-config + + # set overcommit_memory + echo "vm.overcommit_memory = 1" | tee -a /etc/sysctl.conf + sysctl vm.overcommit_memory=1 + + cat > $GITLAB_BOOTSTRAP < Date: Tue, 2 Aug 2016 19:44:24 +0200 Subject: [PATCH 09/11] Use spaces for vertical alignment --- HELP | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/HELP b/HELP index 2cb6544..ca4583e 100644 --- a/HELP +++ b/HELP @@ -1,11 +1,11 @@ # GitLab Development Kit cheat sheet -./run # Start everything -./run db # Start enough to run tests -./run app # Start GitLab, need './run db' +./run # Start everything +./run db # Start enough to run tests +./run app # Start GitLab, need './run db' -make gitlab_repo=https://my-fork # Install everything -make update # Pull application changes from Git -make clean-config all # Delete and regenerate all config files created by GDK +make gitlab_repo=https://my-fork # Install everything +make update # Pull application changes from Git +make clean-config all # Delete and regenerate all config files created by GDK # Development admin account: root / 5iveL!fe From 25ab84e6b4d07c62692cec7f3dc2152a886ce36f Mon Sep 17 00:00:00 2001 From: Gokmen Goksel Date: Wed, 3 Aug 2016 19:04:07 +0000 Subject: [PATCH 10/11] Set the host instead --- .koding.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.koding.yml b/.koding.yml index 32d51df..2aa6bc2 100644 --- a/.koding.yml +++ b/.koding.yml @@ -54,7 +54,7 @@ resource: git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git # force to use 0.0.0.0 for localhost - touch gitlab-development-kit/.vagrant_enabled + echo "0.0.0.0" > gitlab-development-kit/host echo _KD_NOTIFY_@Compiling GitLab...@ cd gitlab-development-kit From db1a3d1e3e4e7c4621def328a89e5a105ce5c580 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 4 Aug 2016 13:48:28 +0200 Subject: [PATCH 11/11] Create a "run thin" command (avoid foreman) --- Procfile.example | 1 - doc/howto/pry.md | 14 ++++++-------- run | 9 ++++++++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Procfile.example b/Procfile.example index 9208d13..2b35b9b 100644 --- a/Procfile.example +++ b/Procfile.example @@ -8,7 +8,6 @@ postgresql: exec support/postgresql-signal-wrapper postgres -D /home/git/postgre #openldap: exec support/exec-cd gitlab-openldap libexec/slapd -F slapd.d -d2 -h "ldap://127.0.0.1:3890" gitlab-workhorse: exec /usr/bin/env PATH=/home/git/gitlab-workhorse:$PATH gitlab-workhorse -authSocket /home/git/gitlab.socket -listenAddr $host:$port -documentRoot /home/git/gitlab/public -developmentMode rails-web: exec /usr/bin/env RAILS_ENV=development support/exec-cd gitlab bin/web start_foreground -#rails-web: exec /usr/bin/env RAILS_ENV=development support/exec-cd gitlab bundle exec thin --socket=/home/git/gitlab.socket start rails-background-jobs: exec /usr/bin/env SIDEKIQ_LOG_ARGUMENTS=1 RAILS_ENV=development support/exec-cd gitlab bin/background_jobs start_foreground #influxdb: exec influxdb/bin/influxd -config influxdb/influxdb.conf #grafana: exec support/wait-postgresql-ready support/exec-cd grafana bin/grafana-server -config grafana.ini diff --git a/doc/howto/pry.md b/doc/howto/pry.md index bdf7ad3..5d7500f 100644 --- a/doc/howto/pry.md +++ b/doc/howto/pry.md @@ -8,12 +8,10 @@ terminal window where you start your test command (`rake`, `rspec` etc.). If you want to get a debugging prompt while browsing on your local -development server (localhost:3000) you need to make a change to the -Procfile in your GDK root directory because Unicorn is not compatible -with Pry. +development server (localhost:3000) you need to comment out the +`rails-web:` line in the Procfile in your GDK root directory because +Unicorn is not compatible with Pry. -There are two `rails-web` lines in the Procfile, one containing -`bin/web` and one containing `thin`. Comment out the line containing -`bin/web` and uncomment the line containing `thin`. Now when you start -GDK with `./run` or `./run app` the Rails web application runs in Thin -instead of Unicorn. +Then launch GDK as usual (e.g. with `./run`) and in a separate +terminal run: `./run thin`. Your Pry prompts will appear in the window +that runs Thin. diff --git a/run b/run index 261f0d2..c7fe3f7 100755 --- a/run +++ b/run @@ -62,12 +62,16 @@ grafana() { foreman_start -c all=0,grafana=1 } +thin() { + exec /usr/bin/env RAILS_ENV=development support/exec-cd gitlab bundle exec thin --socket=$(pwd)/gitlab.socket start +} + all() { print_port foreman_start } -case x$1 in +case "x$1" in xdb) db ;; @@ -77,6 +81,9 @@ xapp) xgrafana) grafana ;; +xthin) + thin + ;; x*) all ;;