-
Notifications
You must be signed in to change notification settings - Fork 112
5.0 Install tests
#!/bin/bash
export GL_HOSTNAME=$HOSTNAME
export GL_GIT_BRANCH="5-0-stable"
export RUBY_VERSION="1.9.3-p392"
MYSQL_ROOT_PW=$(cat /dev/urandom | tr -cd [:alnum:] | head -c ${1:-16})
set -e
die() {
retcode=$1 shift printf >&2 "%s\n" "$@" exit $retcode }
echo "### Check OS (we check if the kernel release contains el6)" uname -r | grep "el6" || die 1 "Not RHEL or CentOS 6 (el6)"
yum -y install git
yum -y install http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
yum -y install patch gcc-c++ readline-devel zlib-devel libffi-devel openssl-devel make autoconf automake libtool bison libxml2-devel libxslt-devel libyaml-devel
Install rvm (instructions from https://rvm.io)
curl -L get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm pkg install libyaml
command rvm install $RUBY_VERSION --with-libyaml-dir=/usr/local/rvm/usr rvm use $RUBY_VERSION
gem install bundler
adduser --system --create-home --comment 'GitLab' git
su - git -c "git clone https://github.com/gitlabhq/gitlab-shell.git"
su - git -c "cp gitlab-shell/config.yml.example gitlab-shell/config.yml" sed -i "s/localhost/$GL_HOSTNAME/g" /home/git/gitlab-shell/config.yml
su - git -c "rvm use 1.9.3-p392;gitlab-shell/bin/install"
chmod 600 /home/git/.ssh/authorized_keys chmod 700 /home/git/.ssh
yum -y install redis
service redis start
chkconfig redis on
yum install -y mysql-server
chkconfig mysqld on
service mysqld start
echo "CREATE DATABASE IF NOT EXISTS gitlabhq_production DEFAULT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';" | mysql -u root
echo "UPDATE mysql.user SET Password=PASSWORD('$MYSQL_ROOT_PW') WHERE User='root'; FLUSH PRIVILEGES;" | mysql -u root
##TODO: GitLab-user
su - git -c "git clone https://github.com/gitlabhq/gitlabhq.git gitlab"
su - git -c "cd gitlab;git checkout $GL_GIT_BRANCH"
cd /home/git/gitlab
su git -c "cp config/gitlab.yml.example config/gitlab.yml"
sed -i "s/ host: localhost/ host: $GL_HOSTNAME/g" config/gitlab.yml
sed -i "s/from: gitlab@localhost/from: gitlab@$GL_HOSTNAME/g" config/gitlab.yml TODO: Add variables for email_from and support_email
#su git -c "mkdir /home/git/gitlab-satellites"
#sudo -u git -H mkdir tmp/pids/ #sudo chmod -R u+rwX tmp/pids/
su git -c "cp config/unicorn.rb.example config/unicorn.rb"
sed -i "s/^listen/#listen/g" /home/git/gitlab/config/unicorn.rb sed -i "s/#listen "127.0.0.1:8080"/listen "127.0.0.1:3000"/g" /home/git/gitlab/config/unicorn.rb
su git -c "cp config/database.yml.mysql config/database.yml"
sed -i "s/secure password/$MYSQL_ROOT_PW/g" config/database.yml
yum -y install libicu-devel gem install charlock_holmes --version '0.6.9'
yum -y install mysql-devel su git -c "bundle install --deployment --without development test postgres"
su git -c "bundle exec rake gitlab:setup RAILS_ENV=production" DOIT: Stop: Do you want to continue (yes/no)? yes
curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab-centos chmod +x /etc/init.d/gitlab chkconfig gitlab on
sed -i "17 a source /etc/profile.d/rvm.sh\nrvm use $RUBY_VERSION" /etc/init.d/gitlab service gitlab start
yum -y install httpd chkconfig httpd on
cat > /etc/httpd/conf.d/gitlab.conf << EOF ProxyPass / http://127.0.0.1:3000/ ProxyPassReverse / http://127.0.0.1:3000/ ProxyPreserveHost On EOF
setsebool -P httpd_can_network_connect 1
service httpd start
iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
service iptables save