-
-
Save cristianrasch/2440768 to your computer and use it in GitHub Desktop.
aptitude install -y git curl python-dev python-pip redis-server ruby1.9.1-full rubygems1.9.1 | |
aptitude install -y mysql-server libmysqlclient-dev | |
adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /home/git git | |
adduser --disabled-login --gecos 'gitlab system' gitlab | |
usermod -a -G git gitlab | |
su - gitlab | |
ssh-keygen -q -N '' -t rsa -f /home/gitlab/.ssh/id_rsa | |
aptitude install gitolite | |
cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub | |
su - git | |
cp /etc/gitolite/example.gitolite.rc ~/.gitolite.rc | |
sed -i 's/0077/0007/g' .gitolite.rc | |
gl-setup /home/git/gitlab.pub | |
chmod -R g+rwX /home/git/repositories | |
# test: | |
su - gitlab | |
git clone git@localhost:gitolite-admin.git /tmp/gitolite-admin | |
aptitude install make build-essential libicu-dev libsqlite3-dev | |
gem install bundler | |
pip install pygments | |
su - gitlab | |
git clone git://github.com/gitlabhq/gitlabhq.git gitlab | |
cd gitlab | |
cp config/gitlab.yml.example config/gitlab.yml | |
cp config/database.yml.sqlite config/database.yml | |
# Change username/password in the config/database.yml file | |
bundle install --without development test --deployment | |
bundle exec rake gitlab:app:setup RAILS_ENV=production | |
# test all is set up | |
bundle exec rake gitlab:app:status RAILS_ENV=production | |
bundle exec rails s -e production | |
# start the resque worker | |
./resque.sh | |
aptitude install nginx | |
su - gitlab | |
cd gitlab | |
cp config/unicorn.rb.orig config/unicorn.rb | |
bundle exec unicorn_rails -c config/unicorn.rb -E production -D | |
# append to the http section of the /etc/nginx/nginx.conf file | |
upstream gitlab { | |
server unix:/home/gitlab/gitlab/tmp/sockets/gitlab.socket; | |
} | |
# remove nginx default site | |
rm /etc/nginx/sites-enabled/default | |
editor /etc/nginx/sites-available/gitlab | |
server { | |
server_name localhost; | |
root /home/gitlab/gitlab/public; | |
# individual nginx logs for this gitlab vhost | |
access_log /var/log/nginx/gitlab_access.log; | |
error_log /var/log/nginx/gitlab_error.log; | |
location / { | |
# serve static files from defined root folder;. | |
# @gitlab is a named location for the upstream fallback, see below | |
try_files $uri $uri/index.html $uri.html @gitlab; | |
} | |
# if a file, which is not found in the root folder is requested, | |
# then the proxy pass the request to the upsteam (gitlab unicorn) | |
location @gitlab { | |
proxy_redirect off; | |
# you need to change this to "https", if you set "ssl" directive to "on" | |
proxy_set_header X-FORWARDED_PROTO http; | |
proxy_set_header Host localhost:80; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_pass http://gitlab; | |
} | |
} | |
ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab | |
service nginx restart | |
editor /etc/init.d/gitlab | |
#! /bin/bash | |
### BEGIN INIT INFO | |
# Provides: gitlab | |
# Required-Start: $local_fs $remote_fs $network $syslog redis-server | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: GitLab git repository management | |
# Description: GitLab git repository management | |
### 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 | |
RESQUE_PID=/home/gitlab/gitlab/tmp/pids/resque_worker.pid | |
case "$1" in | |
start) | |
CD_TO_APP_DIR="cd /home/gitlab/gitlab" | |
START_DAEMON_PROCESS="bundle exec unicorn_rails $DAEMON_OPTS" | |
START_RESQUE_PROCESS="sh resque.sh" | |
echo -n "Starting $DESC: " | |
if [ `whoami` = root ]; then | |
sudo -u gitlab sh -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS && $START_RESQUE_PROCESS" | |
else | |
$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS && $START_RESQUE_PROCESS | |
fi | |
echo "$NAME." | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
kill -QUIT `cat $PID` | |
kill -QUIT `cat $RESQUE_PID` | |
echo "$NAME." | |
;; | |
restart) | |
echo -n "Restarting $DESC: " | |
kill -USR2 `cat $PID` | |
kill -USR2 `cat $RESQUE_PID` | |
echo "$NAME." | |
;; | |
reload) | |
echo -n "Reloading $DESC configuration: " | |
kill -HUP `cat $PID` | |
kill -HUP `cat $RESQUE_PID` | |
echo "$NAME." | |
;; | |
*) | |
echo "Usage: $NAME {start|stop|restart|reload}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 | |
chmod +x /etc/init.d/gitlab | |
insserv gitlab | |
service gitlab restart |
The instructions here seam better, but they seam to ignore any possibility of ever using deb packages. Well I guess since ruby needs to be a whopping 1.9.2-p290.
https://github.com/gitlabhq/gitlabhq/blob/stable/doc/installation.md
Gitlab 5 uses gitlab-shell instead of gitolite which after testing runs faster and is more stable. Try adapting the script.
(The install-how-to on gitlabhq is very good and understandable)
Official installation instructions https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md
Please consider using the package for Debian, it installs in 2 minutes https://about.gitlab.com/downloads/
The omnibus sucks as it installs a bunch of non-tracked files and doesn't allow you to use a remote SQL server.
Modules in log:
rake
i18n
multi_json
activesupport
builder
activemodel
erubis
journey
rack
rack-cache
rack-test
hike
tilt
sprockets
actionpack
mime-types
polyglot
treetop
mail
actionmailer
arel
tzinfo
activerecord
activeresource
Using
rack-ssl
json
rdoc
thor
railties
rails
acts-as-taggable-on
acts_as_list
bcrypt-ruby
blankslate
bootstrap-sass
carrierwave
charlock_holmes
chosen-rails
coffee-script-source
execjs
coffee-script
coffee-rails
colored
daemons
orm_adapter
warden
devise
diff-lcs
drapper
escape_utils
eventmachine
Module Package Names:
xargs apt-get -fy -t wheezy install; # Just paste the first line.
(Then paste everything after this line on the next line)
ruby-minitest/wheezy
ruby-arel
ruby1.8-dev=1.8.7.358-4
ruby-treetop
ruby-i18n
rake
libi18n-ruby/wheezy
ruby-builder
ruby-erubis
ruby-journey
ruby-rack
ruby-rack-cache
ruby-rack-test
ruby-hike
ruby-tilt
ruby-sprockets
ruby-mime-types
ruby-polyglot
ruby-treetop
ruby-mail
ruby-arel
ruby-tzinfo
ruby-rack-ssl
ruby-json
ruby-thor
ruby-passenger
ruby-bcrypt
ruby-blankslate
ruby-daemons
ruby-diff-lcs
ruby-eventmachine
ruby-rails-2.3
ruby-activesupport-2.3
ruby-activerecord-2.3
ruby-actionpack-2.3
ruby-actionmailer-2.3
ruby-activeresource-2.3
(hit ctrl-d)
Make sure you don't get ruby1.9.1, it's not ready ATM.