#!/bin/bash # export http_proxy=http://192.168.1.1:3128 # export ftp_proxy=http://192.168.1.1:3128 # add git user adduser --disabled-login --gecos 'GitLab' git # install gitlab-shell sudo -u git -H mkdir -p /home/git/gitlab-shell wget "https://github.com/gitlabhq/gitlab-shell/archive/v1.8.0.tar.gz" -O - | tar -zvxf - --strip=1 -C /home/git/gitlab-shell/ chown -R git:git /home/git/gitlab-shell/ cd /home/git/gitlab-shell sudo -u git -H cp -a config.yml.example config.yml sudo -u git -H ./bin/install # install gitlab sudo -u git -H mkdir -p /home/git/gitlab wget "https://github.com/gitlabhq/gitlabhq/archive/v6.3.1.tar.gz" -O - | tar -zvxf - --strip=1 -C /home/git/gitlab/ chown -R git:git /home/git/gitlab/ cd /home/git/gitlab # copy default configurations sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml sudo -u git -H cp config/resque.yml.example config/resque.yml sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb # create required tmp and log directories sudo -u git -H mkdir -p tmp/pids/ tmp/sockets/ chmod -R u+rwX log tmp # create uploads directory sudo -u git -H mkdir -p public/uploads chmod -R u+rwX public/uploads # create satellites directory sudo -u git -H mkdir -p /home/git/gitlab-satellites # create production log sudo -u git -H touch log/production.log # install gems required by gitlab if [ -d "/gitlab/setup/cache" ]; then # offline gem installation mv /gitlab/setup/cache vendor/ chown -R git:git vendor/cache sudo -u git -H bundle install --local --deployment --without development test postgres aws else # online gem installation sudo -u git -H bundle install --deployment --without development test postgres aws fi # add database.yml template sudo -u git -H cat > config/database.yml < config/sidekiq.yml < /etc/logrotate.d/supervisord <> /etc/nginx/nginx.conf cat > /etc/supervisor/conf.d/nginx.conf < /etc/supervisor/conf.d/openssh-server.conf < /etc/supervisor/conf.d/cron.conf <