Si vous avez utilisé chef, vous vous rendez bien vite compte qu'il faut un répertoire "maître" de travail, à jour et bien rangé.
Afin que tout le monde dispose de ce même dossier à jour, il convient de le stocker sur un "gestionnaire de version". Opscode nous propose Github, mais celui-ci reste payant si l'on veut des "repository" privés. La solution ? --> GitLab.
Nous allons donc
Je considère que chef-server est déjà installé et configuré sur la machine.
######### Gitlab 6 integrated with chef ###### #### Dependances #### ## Install epel-release yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm ## 'Additional Development' yum -y groupinstall 'Development Tools' yum -y install vim-enhanced httpd readline readline-devel ncurses-devel gdbm-devel glibc-devel \ tcl-devel openssl-devel curl-devel expat-devel db4-devel byacc \ sqlite-devel gcc-c++ libyaml libyaml-devel libffi libffi-devel \ libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel \ system-config-firewall-tui python-devel redis sudo wget \ crontabs logwatch logrotate sendmail-cf qtwebkit qtwebkit-devel \ perl-Time-HiRes perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker yum remove -y git #### PhpPgAdmin #### #(interface monitoring postgreSQL) yum install http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-sl92-9.2-8.noarch.rpm yum install phpPgAdmin # Modification du port 80 -> 8080 nano /etc/httpd/conf/httpd.conf #listen 80 -> 8080 # Autorisations nano /etc/httpd/conf.d/phpPgAdmin.conf ## Order deny,allow # Allow from all # # Allow from .example.com # #### GitLab User #### adduser --system --shell /bin/bash --create-home --comment 'GitLab' git ### start redis ### service redis start #### PostgreSQL configuration #### #Créer le role 'git' + BDD 'gitlabhq_production' + droits par l'interface web ... # http://SERVEUR:8080/phpPgAdmin/ # l'identifiant de connection est 'opscode_chef' le mot de passe de connection se trouve ici : # nano /etc/chef-server/chef-server-secrets.json #### Install git 1.8.1.2 #### wget -O v1.8.1.2.tar.gz https://github.com/git/git/archive/v1.8.1.2.tar.gz tar -xzvf ./v1.8.1.2.tar.gz cd git-1.8.1.2/ make prefix=/usr/local all make prefix=/usr/local install #### Ruby && rubygems #### # Versions de chef export PATH=$PATH:/opt/chef-server/embedded/bin/ #### Install core gems #### gem install bundler #### GitLab shell #### cd /home/git/ ## Clone GitLab su - git -c "git clone https://github.com/gitlabhq/gitlab-shell.git" ## Checkout su - git -c "cd gitlab-shell;git checkout v1.7.1" ## configure su - git -c "cp /home/git/gitlab-shell/config.yml.example /home/git/gitlab-shell/config.yml" ##change http://localhost/ # sed -i "s|gitlab_url: http://localhost/|gitlab_url: http://GL_HOSTNAME/|" /home/git/gitlab-shell/config.yml ## Run setup su - git -c "/home/git/gitlab-shell/bin/install" #### Gitlab #### su - git -c "git clone https://github.com/gitlabhq/gitlabhq.git /home/git/gitlab" ## Checkout su - git -c "cd gitlab;git checkout $GL_GIT_BRANCH" ### Copy the example GitLab config su git -c "cp /home/git/gitlab/config/gitlab.yml.example /home/git/gitlab/config/gitlab.yml" ### Change gitlabhq hostname #sed -i "s|host: localhost|host: GL_HOSTNAME|" /home/git/gitlab/config/gitlab.yml ### Change the from email address #sed -i "s|email_from: gitlab@localhost|email_from: gitlab@arkea.com|" /home/git/gitlab/config/gitlab.yml ## and support too #sed -i "s|support_email: gitlab@localhost|support_email: gitlab@arkea.com|" /home/git/gitlab/config/gitlab.yml ## Make sure GitLab can write to the log/ and tmp/ directories chown -R git /home/git/gitlab/log/ chown -R git /home/git/gitlab/tmp/ chmod -R u+rwX /home/git/gitlab/log/ chmod -R u+rwX /home/git/gitlab/tmp/ #### Gitlab satellites #### su git -c "mkdir /home/git/gitlab-satellites" # Create directories for sockets/pids and make sure GitLab can write to them su git -c "mkdir /home/git/gitlab/tmp/pids/" su git -c "mkdir /home/git/gitlab/tmp/sockets/" chmod -R u+rwX /home/git/gitlab/tmp/pids/ chmod -R u+rwX /home/git/gitlab/tmp/sockets/ # Create public/uploads directory otherwise backup will fail su git -c "mkdir /home/git/gitlab/public/uploads" chmod -R u+rwX /home/git/gitlab/public/uploads #### Unicorn #### su git -c "cp /home/git/gitlab/config/unicorn.rb.example /home/git/gitlab/config/unicorn.rb" ##Editer #listen 8080 en listen 8082 #### Copy database configuration #### su git -c "cp /home/git/gitlab/config/database.yml.postgresql /home/git/gitlab/config/database.yml" ### Set PostgreSQL username and password in configuration file sed -i "s|username: root|username: git|" /home/git/gitlab/config/database.yml sed -i "s|password: |password: gitlab|" /home/git/gitlab/config/database.yml #### Install Charlock holmes #### yum -y install libicu-devel gem install charlock_holmes --version '0.6.9.4' #### bundle install #### cd /home/git/gitlab/ su git -c "bundle install --deployment --without development test mysql" #### Setup and Initialise Database #### # Force it to be silent (issue 31) export force=yes su git -c "bundle exec rake gitlab:setup RAILS_ENV=production" #### Install init script #### curl https://raw.github.com/gitlabhq/gitlab-recipes/master/init/sysvinit/centos/gitlab-unicorn > /etc/init.d/gitlab chmod +x /etc/init.d/gitlab #### Nginx #### usermod -a -G git chef_server chmod g+rx /home/git/ ##Editer /var/opt/chef-server/nginx/etc/nginx.conf et rajouter à la fin ## # #Git lab # include /var/opt/chef-server/nginx/etc/gitlab.conf; ## gitlab.conf cp /home/git/gitlab/lib/support/nginx/gitlab /var/opt/chef-server/nginx/etc/gitlab.conf #Puis editer /var/opt/chef-server/nginx/etc/gitlab.conf pour changer le port # sed -i "s|listen *:80|listen *:8081|" /var/opt/chef-server/nginx/etc/gitlab.conf ## et le nom du serveur # sed -i "s|server_name YOUR_SERVER_FQDN;|server_name SERVEUR;|" /var/opt/chef-server/nginx/etc/gitlab.conf #### SMALL FIX #### ##Starting unicorn: bash: bundle: command not found #Editer /etc/init.d/gitlab : #Restore original $PATH #PATH=$ORIGINAL_PATH:/opt/chef-server/embedded/bin/ ##Unicorn failed " upstream client closed connection ..." sed -i "s|timeout 30|timeout 60|" /home/git/gitlab/config/unicorn.rb ##Redemarrage services et config chkconfig chkconfig --add redis chkconfig --add gitlab chkconfig redis on chkconfig gitlab on service redis restart
Aucun commentaire:
Enregistrer un commentaire