From 7a6b7a5c50ee3787c284c8803fdf30dffc10cec1 Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Mon, 12 Mar 2012 14:47:57 +0200 Subject: [PATCH 1/3] added new manual --- doc/installation.md | 249 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 doc/installation.md diff --git a/doc/installation.md b/doc/installation.md new file mode 100644 index 00000000000..5fe52b23e6f --- /dev/null +++ b/doc/installation.md @@ -0,0 +1,249 @@ +Проект gitlab рассчитан на операционную систему Linux. Имеются сведения о успешной установке ее на FreeBSD и Mac OS, однако мы официально не тестируем на этих системах данный проект и не гарантируем его корректной работы. +Данная интсрукция написана для систем Debian/Ubuntu. + +Установка проекта gitlab состоит из 6 частей: + +1. install packeges. +2. install ruby +3. install gitolite +4. install gitlab and configuration. Check status configuration. +5. server up. +6. run resque process (for processing queue). + +Большая просьба - прежде чем составлять отчет об ошибке убедитесь что все шаги вы проделали верно. + +Первые 3 шага возможно проделать автоматически, для этого установите curl: + #для Debian может понадобиться установить утилиту sudo + apt-get install curl sudo + + # 3 step in 1 command + curl http://dl.dropbox.com/u/936096/debian_ubuntu.sh | sh + +Затем можно приступать к установке: + + +# 1. Install packages + +*Имейте ввиду что в debian по умолчанию не установлена утилита sudo. Установите ее от юзера root:* **apt-get update && apt-get upgrade && apt-get install sudo** + + sudo apt-get update + sudo apt-get upgrade + + sudo apt-get install -y git-core wget curl gcc checkinstall libxml2-dev libxslt-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libreadline-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev libicu-dev redis-server openssh-server git-core python-dev python-pip sendmail + +# 2. Install ruby + + wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz + tar xfvz ruby-1.9.2-p290.tar.gz + cd ruby-1.9.2-p290 + ./configure + make + sudo make install + +# 3. Install gitolite + +Create user for git: + + sudo adduser \ + --system \ + --shell /bin/sh \ + --gecos 'git version control' \ + --group \ + --disabled-password \ + --home /home/git \ + git + + + +Create user for gitlab: + # ubuntu/debian + sudo adduser --disabled-login --gecos 'gitlab system' gitlab + +Add your user to git group: + sudo usermod -a -G git gitlab + +Generate key: + sudo -H -u gitlab ssh-keygen -q -N '' -t rsa -f /home/gitlab/.ssh/id_rsa + +получение исходников gitolite: + cd /home/git + sudo -H -u git git clone git://github.com/gitlabhq/gitolite /home/git/gitolite + +Setup: + sudo -u git -H /home/git/gitolite/src/gl-system-install + sudo cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub + sudo chmod 777 /home/git/gitlab.pub + + sudo -u git -H sed -i 's/0077/0007/g' /home/git/share/gitolite/conf/example.gitolite.rc + sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gl-setup -q /home/git/gitlab.pub" +Permissions: + sudo chmod -R g+rwX /home/git/repositories/ + sudo chown -R git:git /home/git/repositories/ + +#### CHECK: Logout & login again to apply git group to your user + + # clone admin repo to add localhost to known_hosts + # & be sure your user has access to gitolite + sudo -u gitlab -H git clone git@localhost:gitolite-admin.git /tmp/gitolite-admin + + # if succeed you can remove it + sudo rm -rf /tmp/gitolite-admin + +Если вам не удалось успешно склонировать репозиторий - вы что-то сделали не так. Перепроверьте предидущие шаги. ДАЛЬНЕЙШАЯ УСТАНОВКА БУДЕТ БЕЗУСПЕШНА. + +# 4. Install gitlab and configuration. Check status configuration. + + sudo gem install charlock_holmes + sudo pip install pygments + sudo gem install bundler + cd /home/gitlab + sudo -H -u gitlab git clone git://github.com/gitlabhq/gitlabhq.git gitlab + cd gitlab + + # Rename config files + sudo -u gitlab cp config/gitlab.yml.example config/gitlab.yml + +#### Select db you want to use + # SQLite + sudo -u gitlab cp config/database.yml.sqlite config/database.yml + + # Or + # Mysql + sudo -u gitlab cp config/database.yml.example config/database.yml + +#### Install gems + sudo -u gitlab -H bundle install --without development test --deployment + +#### Setup DB + sudo -u gitlab bundle exec rake db:setup RAILS_ENV=production + sudo -u gitlab bundle exec rake db:seed_fu RAILS_ENV=production + +Checking status: + sudo -u gitlab bundle exec rake gitlab_status + + + # OUTPUT EXAMPLE + Starting diagnostic + config/database.yml............exists + config/gitlab.yml............exists + /home/git/repositories/............exists + /home/git/repositories/ is writable?............YES + remote: Counting objects: 603, done. + remote: Compressing objects: 100% (466/466), done. + remote: Total 603 (delta 174), reused 0 (delta 0) + Receiving objects: 100% (603/603), 53.29 KiB, done. + Resolving deltas: 100% (174/174), done. + Can clone gitolite-admin?............YES + UMASK for .gitolite.rc is 0007? ............YES + +If you have all YES then go next. +Поздравляем!!! установка завершена. Теперь необходимо запустить сервисы. + +# 5. Server up + +Сервер можно запустить простой командой: + sudo -u gitlab bundle exec rails s -e production +Однако этот способ даст вам только возможность проверить работоспособность сервиса, не более. Чтобы запустить сервис в виде демона, сделайте так + sudo -u gitlab bundle exec rails s -e production -d + + +# 6. Run resque process (for processing queue). + + # Manually + sudo -u gitlab bundle exec rake environment resque:work QUEUE=* RAILS_ENV=production BACKGROUND=yes + + # Gitlab start script + ./resque.sh + +# Nginx && Unicorn + +### Install Nginx + + sudo apt-get install nginx + +## Unicorn + cd /home/gitlab/gitlab + sudo -u gitlab cp config/unicorn.rb.orig config/unicorn.rb + sudo -u gitlab unicorn_rails -c config/unicorn.rb -E production -D + +В nginx.conf добавим блок upstream в секцию http: + upstream gitlab { + server unix:/tmp/gitlab.socket; + } +И добавим virtual host: + + server { + listen 80; + server_name mygitlab.com; + + location / { + + root /home/gitlab/gitlab/public; + + if (!-f $request_filename) { + proxy_pass http://gitlab; + break; + } + } + + } + +mygitlab.com - change to your domain. +Restart nginx: + /etc/init.d/nginx restart +Create init script in /etc/init.d/gitlab: + #! /bin/bash + ### BEGIN INIT INFO + # Provides: unicorn + # Required-Start: $local_fs $remote_fs $network $syslog + # Required-Stop: $local_fs $remote_fs $network $syslog + # Default-Start: 2 3 4 5 + # Default-Stop: 0 1 6 + # Short-Description: starts the unicorn web server + # Description: starts unicorn + ### END INIT INFO + + DAEMON_OPTS="-c /home/gitlab/gitlab/config/unicorn.rb -E production -D" + NAME=unicorn + DESC="Gitlab service" + PID=/home/gitlab/gitlab/tmp/pids/unicorn.pid + + case "$1" in + start) + CD_TO_APP_DIR="cd /home/gitlab/gitlab" + START_DAEMON_PROCESS="bundle exec unicorn_rails $DAEMON_OPTS" + + echo -n "Starting $DESC: " + if [ `whoami` = root ]; then + sudo -u gitlab sh -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS" + else + $CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS + fi + echo "$NAME." + ;; + stop) + echo -n "Stopping $DESC: " + kill -QUIT `cat $PID` + echo "$NAME." + ;; + restart) + echo -n "Restarting $DESC: " + kill -USR2 `cat $PID` + echo "$NAME." + ;; + reload) + echo -n "Reloading $DESC configuration: " + kill -HUP `cat $PID` + echo "$NAME." + ;; + *) + echo "Usage: $NAME {start|stop|restart|reload}" >&2 + exit 1 + ;; + esac + + exit 0 + +When server is rebooted then gitlab must starting: + sudo update-rc.d gitlab defaults + From 23bf72dc48e0ace9ff4de6db9316883287fdaaed Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Mon, 12 Mar 2012 14:51:21 +0200 Subject: [PATCH 2/3] manual: fixed --- doc/installation.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/installation.md b/doc/installation.md index 5fe52b23e6f..d2112d61a5a 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -244,6 +244,9 @@ Create init script in /etc/init.d/gitlab: exit 0 +Adding permission: + sudo chmod +x /etc/init.d/gitlab + When server is rebooted then gitlab must starting: sudo update-rc.d gitlab defaults From 4b4dc9e483521c660da97ce8263a42f45f3dec52 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 Mar 2012 20:19:03 +0200 Subject: [PATCH 3/3] en version --- doc/installation.md | 82 ++++++++++++++++++++++++++++++++------------- 1 file changed, 59 insertions(+), 23 deletions(-) diff --git a/doc/installation.md b/doc/installation.md index d2112d61a5a..3208bf9a30d 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -1,7 +1,31 @@ -Проект gitlab рассчитан на операционную систему Linux. Имеются сведения о успешной установке ее на FreeBSD и Mac OS, однако мы официально не тестируем на этих системах данный проект и не гарантируем его корректной работы. -Данная интсрукция написана для систем Debian/Ubuntu. +## Platform requirements: -Установка проекта gitlab состоит из 6 частей: +**The project is designed for the Linux operating system. ** + +It may work on FreeBSD and Mac OS, but we don't test our application for these systems and can't guarantee stability and full functionality. + +We officially support next Linux Distributions: + +- Ubuntu +- Debian + +It should work on: + +- Fedora +- CentOs +- Red Hat + +It can work on: + + - Mac Os + - FreeBSD + +It 100% **wont** work on Windows + + +## This installation guide created for Debian/Ubuntu and properly tested. + +The installation consists of 6 steps: 1. install packeges. 2. install ruby @@ -10,21 +34,23 @@ 5. server up. 6. run resque process (for processing queue). -Большая просьба - прежде чем составлять отчет об ошибке убедитесь что все шаги вы проделали верно. - -Первые 3 шага возможно проделать автоматически, для этого установите curl: - #для Debian может понадобиться установить утилиту sudo - apt-get install curl sudo - - # 3 step in 1 command - curl http://dl.dropbox.com/u/936096/debian_ubuntu.sh | sh - -Затем можно приступать к установке: +** Before submit an installation issue - please check if you followed all steps ** +> - - - +> First 3 steps can be easily skipped with simply install script: +> +> # Install curl and sudo +> apt-get install curl sudo +> +> # 3 steps in 1 command :) +> curl http://dl.dropbox.com/u/936096/debian_ubuntu.sh | sh +> +> Now you can go to step 4" +> - - - # 1. Install packages -*Имейте ввиду что в debian по умолчанию не установлена утилита sudo. Установите ее от юзера root:* **apt-get update && apt-get upgrade && apt-get install sudo** +*Keep in mind that `sudo` is not installed for debian by default. You should install it with as root:* **apt-get update && apt-get upgrade && apt-get install sudo** sudo apt-get update sudo apt-get upgrade @@ -65,7 +91,7 @@ Add your user to git group: Generate key: sudo -H -u gitlab ssh-keygen -q -N '' -t rsa -f /home/gitlab/.ssh/id_rsa -получение исходников gitolite: +Get gitolite source code: cd /home/git sudo -H -u git git clone git://github.com/gitlabhq/gitolite /home/git/gitolite @@ -89,7 +115,8 @@ Permissions: # if succeed you can remove it sudo rm -rf /tmp/gitolite-admin -Если вам не удалось успешно склонировать репозиторий - вы что-то сделали не так. Перепроверьте предидущие шаги. ДАЛЬНЕЙШАЯ УСТАНОВКА БУДЕТ БЕЗУСПЕШНА. +** IMPORTANT! If you cant clone `gitolite-admin` repository - DONT PROCEED INSTALLATION** + # 4. Install gitlab and configuration. Check status configuration. @@ -110,6 +137,7 @@ Permissions: # Or # Mysql sudo -u gitlab cp config/database.yml.example config/database.yml + # Change username/password of config/database.yml to real one #### Install gems sudo -u gitlab -H bundle install --without development test --deployment @@ -136,16 +164,16 @@ Checking status: Can clone gitolite-admin?............YES UMASK for .gitolite.rc is 0007? ............YES -If you have all YES then go next. -Поздравляем!!! установка завершена. Теперь необходимо запустить сервисы. +If you got all YES - congrats! You can go to next step. # 5. Server up -Сервер можно запустить простой командой: +Application can be started with next command: + # For test purposes sudo -u gitlab bundle exec rails s -e production -Однако этот способ даст вам только возможность проверить работоспособность сервиса, не более. Чтобы запустить сервис в виде демона, сделайте так - sudo -u gitlab bundle exec rails s -e production -d + # As daemon + sudo -u gitlab bundle exec rails s -e production -d # 6. Run resque process (for processing queue). @@ -155,6 +183,10 @@ If you have all YES then go next. # Gitlab start script ./resque.sh + +** Ok - we have a working application now. ** +** But keep going - there are some thing that should be done ** + # Nginx && Unicorn ### Install Nginx @@ -166,11 +198,11 @@ If you have all YES then go next. sudo -u gitlab cp config/unicorn.rb.orig config/unicorn.rb sudo -u gitlab unicorn_rails -c config/unicorn.rb -E production -D -В nginx.conf добавим блок upstream в секцию http: +Edit /etc/nginx/nginx.conf. Add next code to **http** section: + upstream gitlab { server unix:/tmp/gitlab.socket; } -И добавим virtual host: server { listen 80; @@ -189,8 +221,10 @@ If you have all YES then go next. } mygitlab.com - change to your domain. + Restart nginx: /etc/init.d/nginx restart + Create init script in /etc/init.d/gitlab: #! /bin/bash ### BEGIN INIT INFO @@ -250,3 +284,5 @@ Adding permission: When server is rebooted then gitlab must starting: sudo update-rc.d gitlab defaults +Now you can start/restart/stop gitlab like: + sudo /etc/init.d/gitlab restart