From b0ed3a473b49bc1dfc5335e68edda625b2c3ff3a Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Mon, 7 Oct 2013 21:58:17 +0530 Subject: [PATCH] added a bunch to comments --- resources/install | 12 ++++++++++++ resources/start | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/resources/install b/resources/install index 97f088cb..9cd9d4eb 100755 --- a/resources/install +++ b/resources/install @@ -3,8 +3,10 @@ # 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.7.1.tar.gz" -O - | tar -zxf - --strip=1 -C /home/git/gitlab-shell/ chown -R git:git /home/git/gitlab-shell/ @@ -13,27 +15,34 @@ 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.1.0.tar.gz" -O - | tar -zxf - --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/unicorn.rb.example config/unicorn.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 +# configure git for the 'git' user sudo -u git -H git config --global user.name "GitLab" sudo -u git -H git config --global user.email "gitlab@localhost" sudo -u git -H git config --global core.autocrlf input +# install gems required by gitlab gem install charlock_holmes --version '0.6.9.4' sudo -u git -H bundle install --deployment --without development test postgres aws @@ -51,10 +60,13 @@ production: EOF chmod o-rwx config/database.yml +# make sure everything in /home/git is owned by the git user chown -R git:git /home/git/ +# copy nginx configuration cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab +# create the /var/run/sshd directory (required for sshd to start) mkdir -p /var/run/sshd diff --git a/resources/start b/resources/start index 188981cc..45626176 100755 --- a/resources/start +++ b/resources/start @@ -66,6 +66,7 @@ while true; do esac done +# start mysql server if ${DB_HOST} is localhost if [ -z "${DB_HOST}" ] || [ "${DB_HOST}" == "localhost" ]; then DB_HOST="localhost" DB_USER="root" @@ -80,6 +81,7 @@ if [ -z "${DB_HOST}" ] || [ "${DB_HOST}" == "localhost" ]; then echo 'GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'root'@'localhost';' | mysql -uroot fi +# start ssh server /usr/sbin/sshd redis-server > /dev/null & sleep 3 @@ -95,11 +97,13 @@ sudo -u git -H sed 's/{{DB_NAME}}/'${DB_NAME}'/' -i /home/git/gitlab/config/data sudo -u git -H sed 's/{{DB_USER}}/'${DB_USER}'/' -i /home/git/gitlab/config/database.yml sudo -u git -H sed 's/{{DB_PASSWD}}/'${DB_PASSWD}'/' -i /home/git/gitlab/config/database.yml +# make sure /home/git/repositories/ has the right permissions in case it is mounted as a volume. sudo chmod -R ug+rwX,o-rwx /home/git/repositories/ sudo chmod -R ug-s /home/git/repositories/ find /home/git/repositories/ -type d -print0 | sudo xargs -0 chmod g+s chown -R git:git /home/git/repositories +# make sure /home/git/.ssh/ has the right permissions in case it is mounted as a volume. touch /home/git/.ssh/authorized_keys chmod 700 /home/git/.ssh chmod 600 /home/git/.ssh/authorized_keys @@ -107,14 +111,18 @@ chown -R git:git /home/git/.ssh cd /home/git/gitlab/ +# reset the database if the --db-init switch was given. if [ "$DB_INIT" == "yes" ]; then sudo -u git -H force=yes bundle exec rake gitlab:setup RAILS_ENV=production fi +# start the gitlab application # sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production /etc/init.d/gitlab start sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production +# start the nginx server /etc/init.d/nginx start +# watch the access logs tail -F /var/log/nginx/${SERVER_URL}_access.log