Skip to content

Instantly share code, notes, and snippets.

@fireboy1919
Created August 19, 2014 20:00
Show Gist options
  • Save fireboy1919/39d7f799ef8806bc74b2 to your computer and use it in GitHub Desktop.
Save fireboy1919/39d7f799ef8806bc74b2 to your computer and use it in GitHub Desktop.
gitlab_repo = https://gitlab.com/gitlab-org/gitlab-ce.git gitlab_shell_repo = https://gitlab.com/gitlab-org/gitlab-shell.git
gitlab_development_root = $(shell pwd)
postgres_bin_dir = $(shell pg_config --bindir)
all: gitlab-setup gitlab-shell-setup support-setup
# Set up the GitLab Rails app
gitlab-setup: gitlab/.git gitlab-config gitlab/.bundle
gitlab/.git:
git clone ${gitlab_repo} gitlab
gitlab-config: gitlab/config/gitlab.yml gitlab/config/database.yml gitlab/config/unicorn.rb gitlab/config/resque.yml
gitlab/config/gitlab.yml:
sed "s|/home/git|${gitlab_development_root}|;s|# user: git|user: $(shell whoami)|" gitlab/config/gitlab.yml.example > gitlab/config/gitlab.yml
gitlab/config/database.yml:
sed "s|/home/git|${gitlab_development_root}|" database.yml.example > gitlab/config/database.yml
gitlab/config/unicorn.rb:
cp gitlab/config/unicorn.rb.example.development gitlab/config/unicorn.rb
gitlab/config/resque.yml:
sed "s|/home/git|${gitlab_development_root}|" redis/resque.yml.example > $@
gitlab/.bundle:
cd ${gitlab_development_root}/gitlab && bundle install --without mysql production --jobs 4
# Set up gitlab-shell
gitlab-shell-setup: gitlab-shell/.git gitlab-shell/config.yml gitlab-shell/.bundle
gitlab-shell/.git:
git clone ${gitlab_shell_repo} gitlab-shell
gitlab-shell/config.yml:
sed "s|/home/git|${gitlab_development_root}|;s|:8080/|:3000|;s|/usr/bin/redis-cli|$(shell which redis-cli)|" gitlab-shell/config.yml.example > gitlab-shell/config.yml
gitlab-shell/.bundle:
cd ${gitlab_development_root}/gitlab-shell && bundle install --without production --jobs 4
# Set up supporting services
support-setup: Procfile redis postgresql .bundle
@echo ""
@echo "*********************************************"
@echo "************** Setup finished! **************"
@echo "*********************************************"
@echo "Post install instructions:"
@echo "start Redis & Postgresql by running he command below, and keep it running"
@echo "> 'bundle exec foreman start'"
@echo ""
@echo "Seed the main GitLab database"
@echo "> 'cd gitlab && bundle exec rake db:create dev:setup'"
@echo ""
@echo "Finally, start the main GitLab rails application"
@echo "> 'bundle exec foreman start'"
@echo "***********************************"
Procfile:
sed "s|/home/git|${gitlab_development_root}|g;s|postgres |${postgres_bin_dir}/postgres |" $@.example > $@
redis: redis/redis.conf
redis/redis.conf:
sed "s|/home/git|${gitlab_development_root}|" $@.example > $@
postgresql: postgresql/data/PG_VERSION
postgresql/data/PG_VERSION:
${postgres_bin_dir}/initdb -E utf-8 postgresql/data
.bundle:
bundle install --jobs 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment