Amélioration

This commit is contained in:
Benoît S. 2016-11-24 15:35:59 +01:00
parent 93dba9c963
commit fb75f8d40b

View file

@ -53,6 +53,8 @@ Créer un compte UNIX « gitlab-demo00 ».
# adduser --disabled-login --gecos 'GitLab instance demo00' gitlab-demo00 # adduser --disabled-login --gecos 'GitLab instance demo00' gitlab-demo00
> **Note** : Assurez-vous d'avoir `DIR_MODE=0755` dans `/etc/adduser.conf`. Cela sera nécessaire pour nginx.
## Base de données ## Base de données
GitLab recommande fortement PostgreSQL. On utilisera donc la version 9.4 de Debian Jessie. GitLab recommande fortement PostgreSQL. On utilisera donc la version 9.4 de Debian Jessie.
@ -226,7 +228,9 @@ $ chmod -R u+rwX shared/artifacts/
``` ```
$ cp config/unicorn.rb{.example,} $ cp config/unicorn.rb{.example,}
$ sed -i -e "s/worker_processes 3/worker_processes $(nproc)/" \ $ sed -i -e "s/worker_processes 3/worker_processes $(nproc)/" \
-e 's#/home/git#/home/gitlab-demo00#g' config/unicorn.rb -e 's#/home/git#/home/gitlab-demo00#g' \
-e 's/listen "127.0.0.1:8080", :tcp_nopush => true/#listen "127.0.0.1:8080", :tcp_nopush => true/' \
config/unicorn.rb
``` ```
### Configuration de Rack attack ### Configuration de Rack attack
@ -249,12 +253,14 @@ $ sed -i 's/redis.sock/gitlab-demo00.sock/' config/resque.yml
### Configuration des paramètres de connexion à la base ### Configuration des paramètres de connexion à la base
``` ```
$cp config/database.yml{.postgresql,} $ cp config/database.yml{.postgresql,}
$ sed -i -e 's/database: gitlabhq_production/database: gitlab-demo00/' \ $ sed -i -e 's/database: gitlabhq_production/database: gitlab-demo00/' \
-e 's/# username: git/username: gitlab-demo00/' \ -e 's/# username: git/username: gitlab-demo00/' \
-e 's/# password:/password: VotreMDP/' config/database.yml -e 's/# password:/password: VotreMDP/' config/database.yml
$ chmod o-rwx config/database.yml $ chmod o-rwx config/database.yml
``` ```
> **Note** : Conservez l'espace devant le sed pour ne pas enregistrer le mot de passe dans l'historique bash.
### Installation des Gems ### Installation des Gems
> **Important**: Votre `/home` ne doit pas être monté avec l'option `noexec`. > **Important**: Votre `/home` ne doit pas être monté avec l'option `noexec`.
@ -268,9 +274,9 @@ $ bundle install -j$(nproc) --deployment --without development test mysql aws ke
``` ```
$ bundle exec rake gitlab:shell:install REDIS_URL=unix:/var/run/redis/gitlab-demo00.sock RAILS_ENV=production SKIP_STORAGE_VALIDATION=true $ bundle exec rake gitlab:shell:install REDIS_URL=unix:/var/run/redis/gitlab-demo00.sock RAILS_ENV=production SKIP_STORAGE_VALIDATION=true
$ sed ca_file? $ sed ca_file?
$ chmod -R ug+rwX,o-rwx /home/gitlab-demo00/repositories/ $ chmod -R ug+rwX,o-rwx ~/repositories/
$ chmod -R ug-s /home/gitlab-demo00/repositories/ $ chmod -R ug-s ~/repositories/
$ chmod g+s /home/gitlab-demo00/repositories/ $ chmod g+s ~/repositories/
``` ```
### Install gitlab-workhorse ### Install gitlab-workhorse
@ -279,7 +285,7 @@ $ chmod g+s /home/gitlab-demo00/repositories/
$ cd $ cd
$ git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git $ git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git
$ cd gitlab-workhorse $ cd gitlab-workhorse
$ git checkout v0.8.5 $ git checkout v$(cat ~/gitlab/GITLAB_WORKHORSE_VERSION)
$ make $ make
``` ```
@ -288,7 +294,7 @@ TODO: Config mode multi instance ?
### Création de la BDD ### Création de la BDD
``` ```
$ cd /home/gitlab-demo00/gitlab $ cd ~/gitlab
$ bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=yourpassword GITLAB_ROOT_EMAIL=youremail $ bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=yourpassword GITLAB_ROOT_EMAIL=youremail
``` ```
@ -306,7 +312,10 @@ Le fichier `secrets.yml` contient les clés de chiffrements pour les sessions et
GitLab ne supporte pas officiellement systemd… On doit donc encore passer pas un script d'init classique. GitLab ne supporte pas officiellement systemd… On doit donc encore passer pas un script d'init classique.
``` ```
# sed -i s'/app_user="git"/app_user="gitlab-demo00"/' /home/gitlab-demo00/gitlab/lib/support/init.d/gitlab # sed -i -e \
's/app_user="git"/app_user="gitlab-demo00"/' \
-e 's/# Provides: .*gitlab/# Provides: gitlab-demo00/' \
/home/gitlab-demo00/gitlab/lib/support/init.d/gitlab
# install -m 755 /home/gitlab-demo00/gitlab/lib/support/init.d/gitlab /etc/init.d/gitlab-demo00 # install -m 755 /home/gitlab-demo00/gitlab/lib/support/init.d/gitlab /etc/init.d/gitlab-demo00
# systemctl enable gitlab-demo00 # systemctl enable gitlab-demo00
# sed -i 's#script_path = "/etc/init.d/gitlab"#script_path = "/etc/init.d/gitlab-demo00"#g' /home/gitlab-demo00/gitlab/lib/tasks/gitlab/check.rake # sed -i 's#script_path = "/etc/init.d/gitlab"#script_path = "/etc/init.d/gitlab-demo00"#g' /home/gitlab-demo00/gitlab/lib/tasks/gitlab/check.rake
@ -319,7 +328,7 @@ $ git commit -a -m 'change default user'
``` ```
# install -m 644 /home/gitlab-demo00/gitlab/lib/support/logrotate/gitlab /etc/logrotate.d/gitlab-demo00 # install -m 644 /home/gitlab-demo00/gitlab/lib/support/logrotate/gitlab /etc/logrotate.d/gitlab-demo00
# sed -i 's#/home/git/#/home/gitlab-demo00/#g' # sed -i 's#/home/git/#/home/gitlab-demo00/#g' /etc/logrotate.d/gitlab-demo00
``` ```
### Vérifier l'état de l'installation ### Vérifier l'état de l'installation
@ -355,6 +364,8 @@ On utilise Nginx car c'est le seul serveur web supporté officiellement par GitL
# sed -i -e 's#/home/git/#/home/gitlab-demo00/#g' \ # sed -i -e 's#/home/git/#/home/gitlab-demo00/#g' \
-e 's/YOUR_SERVER_FQDN/demo00.gitlab.example.com/g' \ -e 's/YOUR_SERVER_FQDN/demo00.gitlab.example.com/g' \
-e 's#/var/log/nginx/gitlab#/var/log/nginx/gitlab-demo00#g' \ -e 's#/var/log/nginx/gitlab#/var/log/nginx/gitlab-demo00#g' \
-e 's/upstream gitlab-workhorse/upstream gitlab-demoOO-workhorse/' \
-e 's#http://gitlab-workhorse#http://gitlab-demo00-workhorse#' \
/etc/nginx/sites-available/gitlab-demo00 /etc/nginx/sites-available/gitlab-demo00
# ln -s /etc/nginx/sites-available/gitlab-demo00 /etc/nginx/sites-enabled/ # ln -s /etc/nginx/sites-available/gitlab-demo00 /etc/nginx/sites-enabled/
# /etc/init.d/nginx restart # /etc/init.d/nginx restart