Actualités

GITLAB et RBENV Round 1
clockEcrit par e2ly | clock2014-01-10 19:33:56

Ce tutoriel a été testé sur Ubuntu 12.04 (mais il n'y a pas de raison que ce soit différent pour une ubuntu 13.xx 14.xx)

  • Installer GIT 1.8 (passer cette étape en Ubuntu 14.xx)
apt-get update
apt-get install python-software-properties
add-apt-repository ppa:git-core/ppa
apt-get update
apt-get install git
  • Installer les dépendances
apt-get install zlib1g-dev openssl libopenssl-ruby1.9.1 libssl-dev libicu48 libicu-dev libxml2 libxml2-dev libxslt1-dev libxslt1.1 redis-server
 
  • Créer l'utilisateur applicatif
adduser --disabled-login --gecos 'GitLab' git
  • Installer rbenv et configurer un environnement Ruby 2.1.0
su - git
git clone git://github.com/sstephenson/rbenv.git .rbenv
mv ~/.bashrc ~/.bashrc.old
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
cat ~/.bashrc.old >>  ~/.bashrc
exec $SHELL
mkdir -p ~/.rbenv/plugins
cd ~/.rbenv/plugins
git clone git://github.com/sstephenson/ruby-build.git
rbenv install 2.1.0
rbenv rehash
rbenv global 2.1.0
gem install bundler --no-ri --no-rdoc
# gem install bundle # to validate if needed
  • Déployer gitlab-shell
cd
git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.8.0
cd gitlab-shell
sed -e "s/localhost/$(hostname -f)/g" config.yml.example > config.yml
./bin/install
  • Préparer la base de donnée
# W user root
exit
mysql -u root -p -e "
CREATE USER 'git'@'localhost' IDENTIFIED BY 'MY_PASSWORD';
CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'git'@'localhost';
"
  • Passer à l'installation de GitLab; la version 6.4 est bugguée, si la 6.5 est sortie, tentez ... sinon prendre les derniers DEV en cours
su - git
# take latest commit because 6.4 bug with gon 5.0.0 (5.0.1 is working)
git clone https://gitlab.com/gitlab-org/gitlab-ce.git gitlab
cd /home/git/gitlab
sed -e "s/host: localhost/host: $(hostname -f)/g" /
    -e "s/enabled: true/enabled: false/g" config/gitlab.yml.example > config/gitlab.yml
 
mkdir /home/git/gitlab-satellites /home/git/gitlab/tmp/pids/ /home/git/gitlab/tmp/sockets/ /home/git/gitlab/public/uploads
 
cp /home/git/gitlab/config/unicorn.rb.example  /home/git/gitlab/config/unicorn.rb
cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
cp config/database.yml.mysql config/database.yml
chmod o-rwx config/database.yml
 
bundle install --no-deployment --without development test postgres aws
 
bundle exec rake gitlab:setup RAILS_ENV=production
  • Noter les identifiants
# Get Login
# login.........admin@local.host
# password......QSDAZeqsd
  • Gérer les services et la rotation des logs
# W user root
exit
cp /home/git/gitlab/lib/support/init.d/gitlab /etc/init.d/gitlab
cp /home/git/gitlab/lib/support/init.d/gitlab.default.example /etc/default/gitlab
update-rc.d gitlab defaults 21
cp /home/git/gitlab/lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
  • Il faut charger l'environnement rbenv au démarrage de gitlab
 
echo 'export PATH="/home/${app_user}/.rbenv/bin:$PATH"
eval "$(rbenv init -)"' >> /etc/default/gitlab
  • Un petit coup de rake
su - git
cd gitlab
 
# Check
bundle exec rake gitlab:env:info RAILS_ENV=production
bundle exec rake assets:precompile RAILS_ENV=production
  • Installer NGinX
# W user root
exit
apt-get install -y nginx
sed -e "s/YOUR_SERVER_FQDN/$(hostname -f)/g" /home/git/gitlab/lib/support/nginx/gitlab > /etc/nginx/sites-available/gitlab
ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
vim /etc/nginx/sites-available/gitlab
service nginx restart
  • Corriger le Hook qui ne charge pas l'environnement rbenv et qui empêche les merges & co
mv /home/git/gitlab-shell/hooks{,.rb}
  • Créer le fichier /home/git/gitlab-shell/hooks/update contenant :
#!/bin/bash
 
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
 
$HOME/gitlab-shell/hooks/update.rb $*

Et voilà, un beau GitLab chez vous !

Source :
https://raw.github.com/gitlabhq/gitlabhq/master/doc/install/installation.md (mod pour RBENV)
https://raw.github.com/gitlabhq/gitlabhq/master/doc/install/databases.md

Commentaires

Aucun commentaire
Développé par Poil - Graphismes de DarkDaV - Icônes sous licence Creative Commons (famfam, nuovo ...)
Durée de génération : 1.2163479328156 secondes