Install needed packages and gems
- aptitude update
- aptitude install apache2 ruby rubygems git-core git-doc libmysql-ruby mysql-server mysql-client libmysqlclient15-dev phpmyadmin libdbd-mysql-ruby build-essential cron rake wget
- aptitude install zlib1g-dev tcl-dev libexpat-dev libcurl4-openssl-dev postfix apg geoip-bin libgeoip1 libgeoip-dev sqlite3 libsqlite3-dev imagemagick libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev apache2-dev libonig-dev ruby-dev libopenssl-ruby libmagick++-dev zip unzip memcached git-svn git-cvs irb
- gem install -b --no-ri --no-rdoc passenger rake
- gem install -b --no-ri --no-rdoc rmagick chronic geoip daemons hoe echoe ruby-yadis \ ruby-openid mime-types diff-lcs json rack ruby-hmac stompserver
- gem install -b --no-ri --no-rdoc -v 1.3.1.1 rdiscount
- gem install -b --no-ri --no-rdoc -v 1.1 stomp
- ln -s /var/lib/gems/1.8/bin/rake /usr/bin
- ln -s /var/lib/gems/1.8/bin/stompserver /usr/bin
- cd /tmp
- wget http://sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz
- gunzip sphinx-0.9.8.1.tar.gz && tar xvf sphinx-0.9.8.1.tar
- cd sphinx-0.9.8.1
- ./configure --prefix=/usr && make all install
- git clone http://git.gitorious.org/gitorious/mainline.git /var/www/gitorious
- ln -s /var/www/gitorious/script/gitorious /usr/bin
This step will create the "git" user for the system and also the ssh keyring which is used to identify other users.
- adduser --system --home /var/www/gitorious/ --no-create-home --group --shell /bin/bash git
- chown -R git:git /var/www/gitorious
- su - git
- mkdir .ssh
- touch .ssh/authorized_keys
- chmod 700 .ssh
- chmod 600 .ssh/authorized_keys
- mkdir tmp/pids
- mkdir repositories
- mkdir tarballs
- exit
- Copy attached file gitorious.yml to /var/www/gitorious/config. Change gitorious_client_host and gitorious_host to the system hostname or IP address.
- cp /var/www/gitorious/config/broker.yml.example /var/www/gitorious/broker.yml
- cp /var/www/gitorious/doc/templates/ubuntu/git-ultrasphinx /etc/init.d/
- sed -e "s/opt\/ruby-enterprise\/bin\/ruby/usr\/bin\/ruby/" /var/www/gitorious/doc/templates/ubuntu/git-daemon > /etc/init.d/git-daemon
- chmod 755 /etc/init.d/git-daemon
- Copy attached stomp file to /etc/init.d.
- Copy attached git-poller file to /etc/init.d
- cp /var/www/gitorious/doc/templates/ubuntu/gitorious-logrotate /etc/logrotate.d/gitorious
- chmod 755 /etc/init.d/git-ultrasphinx /etc/init.d/git-daemon /etc/init.d/stomp /etc/init.d/git-poller
- update-rc.d stomp defaults
- update-rc.d git-daemon defaults
- update-rc.d git-ultrasphinx defaults
- update-rc.d git-poller defaults
- /var/lib/gems/1.8/bin/passenger-install-apache2-module
- Copy attached file passenger.load to /etc/apache2/mods-available/passenger.load.
- a2enmod passenger
- a2enmod rewrite
- a2enmod ssl
- a2ensite default-ssl
- ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
- Copy attached gitorious.conf file to /etc/apache2/conf.d/gitorious.conf.
- /etc/init.d/apache2 restart
Create database and database user
- mysql -p
- create user 'git'@'localhost' identified by '[password]';
- grant all privileges on * . * to 'git'@'localhost' identified by '[password]';
- grant all privileges on `gitorious_production` . * to 'git'@'localhost' with grant option ;
- Copy attached file database.yml to /var/www/gitorious/config/database.yml. Change the password to the one you selected in previous step.
- cd /var/www/gitorious
- export RAILS_ENV="production"
- rake db:create
- rake db:migrate
- rake ultrasphinx:bootstrap
- Add this to crontab: * * * * * cd /var/www/gitorious && /usr/bin/rake ultrasphinx:index RAILS_ENV="production"
- /etc/init.d/apache2 restart
- ruby /var/www/create_admin
Attachments
gitorious.yml:
production:
# The session secret key (`apg -m 64` is always useful for this kinda stuff)stomp:
cookie_secret: ssssht
# The path where git repositories are stored. The actual (bare) repositories $
# in repository_base_path/#{project.slug}/#{repository.name}.git/:
repository_base_path: "/var/www/gitorious/repositories"
# Stuff that's in the html head. custom stats javascript code etc
extra_html_head_data:
# System message that will appear on all pages if present
system_message:
# Port the ./script/gitorious script should use:
gitorious_client_port: 80
# Host the ./script/gitorious script should use:
gitorious_client_host: HOSTNAME
# Host which is serving the gitorious app, eg "gitorious.org"
gitorious_host: HOSTNAME
# User which is running git daemon
gitorious_user: git
# Email spam on server errors to:
exception_notification_emails:
# Mangle visible e-mail addresses (spam protection)
mangle_email_addresses: true
# Enable or Disable Public Mode (true) or Private Mode (false)
public_mode: true
# Define your locale
locale: en
# Where should we store generated tarballs?
# (should be readable by webserver, since we tell it to send the file using X$
archive_cache_dir: "/var/www/gitorious/tarballs"
# Which directory should we work in when we generate tarballs, before moving
# them to the above dir?
archive_work_dir: "/tmp/tarballs-work"
# is it only site admins who can create new projects?
only_site_admins_can_create_projects: false
# Should we hide HTTP clone urls?
hide_http_clone_urls: true
# Is this gitorious.org? Read: should we have a very flashy homepage?
is_gitorious_dot_org: false
#!/bin/shgit-poller:
# Start/stop the stompserver
#
### BEGIN INIT INFO
# Provides: stomp
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: Stomp
# Description: Stomp
### END INIT INFO
test -f /usr/bin/stompserver || exit 0
. /lib/lsb/init-functions
case "$1" in
start) log_daemon_msg "Starting stompserver" "stompserver"
start-stop-daemon --start --name stompserver --startas /usr/bin/stompserver --background --user git
log_end_msg $?
;;
stop) log_daemon_msg "Stopping stompserver" "stompserver"
start-stop-daemon --stop --name stompserver
log_end_msg $?
;;
restart) log_daemon_msg "Restarting stompserver" "stompserver"
start-stop-daemon --stop --retry 5 --name stompserver
start-stop-daemon --start --name stompserver --startas /usr/bin/stompserver --background --user git
log_end_msg $?
;;
status)
status_of_proc /usr/bin/stompserver stompserver && exit 0 || exit $?
;;
*) log_action_msg "Usage: /etc/init.d/stomp {start|stop|restart|status}"
exit 2
;;
esac
exit 0
#!/bin/shpassenger.load:
# Start/stop the git poller
#
### BEGIN INIT INFO
# Provides: git-poller
# Required-Start: stomp
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: Gitorious poller
# Description: Gitorious poller
### END INIT INFO
/bin/su -- git -c "cd /var/www/gitorious;RAILS_ENV=production script/poller $@"
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.2.4/ext/apache2/mod_passenger.sogitorious.conf:
PassengerRoot /var/lib/gems/1.8/gems/passenger-2.2.4
PassengerRuby /usr/bin/ruby1.8
Alias /gitorious /var/www/gitorious/publicdatabase.yml:
<directory /var/www/gitorious/public>
PassengerAppRoot /var/www/gitorious
RailsBaseURI /gitorious
</directory>
production:
adapter: mysql
database: gitorious_production
username: git
password: [PASSWORD]
host: localhost
encoding: utf8

6 comments: