Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ment-kit into reorganize-readme

 Conflicts:
	Makefile
	README.md
  • Loading branch information
jacobvosmaer committed Aug 5, 2016
2 parents f991ade + 3583a2a commit 80998b6
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 15 deletions.
77 changes: 77 additions & 0 deletions .koding.yml
Original file line number Diff line number Diff line change
@@ -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 <<EOF
#!/bin/bash
echo _KD_NOTIFY_@Installing RVM and Ruby...@
# install rvm
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable --ruby=2.1.8
source $USER_HOME/.rvm/scripts/rvm
echo _KD_NOTIFY_@Installing bundler...@
# install bundler
gem install bundler
echo _KD_NOTIFY_@Cloning GitLab repository...@
# clone and run gitlab
git clone https://gitlab.com/gitlab-org/gitlab-development-kit.git
# force to use 0.0.0.0 for localhost
echo "0.0.0.0" > gitlab-development-kit/host
echo _KD_NOTIFY_@Compiling GitLab...@
cd gitlab-development-kit
make
EOF
chown $KODING_USER: $GITLAB_BOOTSTRAP
chmod +x $GITLAB_BOOTSTRAP
su - $KODING_USER -c $GITLAB_BOOTSTRAP
echo ""
echo "Now launch a new terminal and do;"
echo " $ cd gitlab-development-kit"
echo " $ ./run"
echo ""
echo _KD_DONE_
11 changes: 11 additions & 0 deletions HELP
Original file line number Diff line number Diff line change
@@ -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
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -95,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' doc/set-up-gdk.md
cat HELP
@echo "*********************************************"

Procfile:
Expand Down
26 changes: 15 additions & 11 deletions Procfile.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
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
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
#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
# 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-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
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Configure and manage a [GitLab](https://about.gitlab.com) development environmen
- [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)
- [MySQL](#mysql)
Expand Down Expand Up @@ -138,6 +139,24 @@ 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:

```
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

When working on a new feature, always check that your `gitlab` repository is up
Expand Down
17 changes: 17 additions & 0 deletions doc/howto/pry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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 comment out the
`rails-web:` line in the Procfile in your GDK root directory because
Unicorn is not compatible with Pry.

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.
9 changes: 8 additions & 1 deletion run
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
Expand All @@ -77,6 +81,9 @@ xapp)
xgrafana)
grafana
;;
xthin)
thin
;;
x*)
all
;;
Expand Down

0 comments on commit 80998b6

Please sign in to comment.