These directions are based on 'recipes' from the gitorious web site along with other various web sites scattered throughout the internet. It is hoped that these directions will help other sysadmins more easily deploy a gitorious instance on a server. In the following sections you will need to run each command with a sudo prefix so that the commands are run with root privileges. You will also need an internet connection as the packages are downloaded from the internet during most of these steps.
In this section all the prerequisites will be installed. I selected to configure the apache2 web server as that is what we will be running. Note that during the installation a configuration screen will appear for the phpmyadmin package, I also selected to have the data bases configured with dbconfig-common. Also during the process a configuration screen will ask for the MySQL password and it will also want you to create a password for the phpmyadmin account to use. I just re-used the same password for both.
sudo aptitude install -y build-essential apache2 apache2-dev libapache2-mod-xsendfile
sudo aptitude install -y git-core git-doc
sudo aptitude install -y mysql-server mysql-client libmysqlclient15-dev phpmyadmin
sudo aptitude install -y ruby-dev rubygems libopenssl-ruby libdbd-mysql-ruby libmysql-ruby
or if you want to install Enterprise Ruby the you will need a few things first:
sudo echo "rubyee" > /etc/apt/sources.list.d/brightbox-rubyee.list wget http://apt.brightbox.net/release.asc -O - | sudo apt-key add - sudo apt-get update sudo apt-get install -y libruby1.8 irb1.8 libopenssl-ruby1.8 libreadline-ruby1.8 rdoc1.8 ruby1.8 ruby-dev rubygems libdbd-mysql-ruby1.8 libmysql-ruby1.8
sudo aptitude install -y libexpat-dev libcurl4-openssl-dev postfix apg geoip-bin\ libgeoip1 libgeoip-dev imagemagick libmagick++-dev libpcre3 libpcre3-dev\ zlib1g zlib1g-dev zip unzip libyaml-dev libonig-dev memcached irb aspell libaspell-dev aspell-en
DONE:______
This section will install all the ruby gems that are needed for a Ruby on Rails application.
sudo gem install -b --no-ri --no-rdoc rmagick chronic geoip daemons hoe echoe \ ruby-yadis ruby-openid mime-types diff-lcs json ruby-hmac rake \ stompserver passenger rails raspell sudo gem install -b --no-ri --no-rdoc -v 1.0.1 rack sudo gem install -b --no-ri --no-rdoc -v 1.3.1.1 rdiscount sudo gem install -b --no-ri --no-rdoc -v 1.1 stomp sudo ln -s /var/lib/gems/1.8/bin/rake /usr/bin sudo ln -s /var/lib/gems/1.8/bin/stompserver /usr/bin sudo ln -s /usr/bin/ruby1.8 /usr/bin/ruby
DONE:______
Download source from www.sphinxsearch.com
(currently http://sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz)
cd ~/ mkdir src cd src wget http://sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz tar -xvzf sphinx-0.9.8.1.tar.gz cd sphinx-0.9.8.1/ ./configure --prefix=/usr && make all sudo make install
DONE:______
We are going to fetch the Gitorious project from the www.gitorious.com site and configure is as our sysmtem admin user. After we have completed all of the configuration we are going to change all the permissions over to the a system user called 'git' which will be the userid that will actually be running the applications. We are going to clone the gitorious project into the /var/www because that is where all the defauls have us looking for it.
sudo mkdir -p /var/www/gitorious.bluequartz.net sudo chmod ugo+rwx /var/www/gitorious.bluequartz.net cd /var/www/gitorious.bluequartz.net/ git clone git://gitorious.org/gitorious/mainline.git gitorious or git clone http://git.gitorious.org/gitorious/mainline.git gitorious
DONE:______
We are going to now create the /etc/init.d/git-daemon file.
sudo emacs /etc/init.d/git-daemon
Edit the git-daemon file to have the following content:
#! /bin/sh
### BEGIN INIT INFO
# Provides: Gitorious GIT-Daemon
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: GIT-Daemon server daemon
# Description: Starts the GIT-Daemon needed by Gitorious
### END INIT INFO
# Author: Fabio Akita <fabioakita@gmail.com>
RETVAL=0
PROG="git-daemon"
GITORIOUS_ROOT=/var/www/gitorious.bluequartz.net/gitorious
GIT_DAEMON="/usr/bin/ruby $GITORIOUS_ROOT/script/git-daemon -d"
LOCK_FILE=/var/lock/git-daemon
PID_FILE=$GITORIOUS_ROOT/tmp/pids/git-daemon.pid
do_check_pid() {
if [ -f $PID_FILE ]; then
PID=`cat $PID_FILE`
RUNNING=`ps --pid $PID | wc -l`
else
PID=0
RUNNING=0
fi
}
runlevel=`runlevel | awk '{print $2}'`
start()
{
do_check_pid
if [ $RUNNING != 2 ] ; then
echo -n "Starting $PROG: "
/bin/su - git -c "$GIT_DAEMON"
sleep 10
if [ -f $PID_FILE ] ; then
echo "success"
RETVAL=0
else
echo "failure"
RETVAL=1
fi
else
echo -n "$PROG already running"
RETVAL=1
fi
[ "$RETVAL" = 0 ] && touch $LOCK_FILE
echo
}
stop()
{
do_check_pid
echo -n "Stopping $PROG: "
if [ $RUNNING != 2 ] ; then
echo -n "Stopping $PROG"
else
PROGPID=`cat $PID_FILE`
kill -TERM $PROGPID
fi
RETVAL=0
# if we are in halt or reboot runlevel kill all running sessions
# so the TCP connections are closed cleanly
if [ "x$runlevel" = x0 -o "x$runlevel" = x6 ] ; then
PROGPID=`cat $PID_FILE`
kill -9 $PROGPID > /dev/null
fi
[ "$RETVAL" = 0 ] && rm -f $LOCK_FILE && rm -f $PID_FILE
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
condrestart)
if [ -f $LOCK_FILE ] ; then
if [ "$RETVAL" = 0 ] ; then
stop
# avoid race
sleep 10
start
fi
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart}"
RETVAL=1
esac
exit $RETVAL
Create the git-ultrasphinx init file
sudo emacs /etc/init.d/git-ultrasphinx
Edit the /etc/init.d/git-ultrasphinx file to have the following content:
#! /bin/sh
### BEGIN INIT INFO
# Provides: Gitorious Ultrasphinx
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Ultrasphinx daemon
# Description: Starts the Ultrasphinx daemons needed by Gitorious
### END INIT INFO
# Author: Fabio Akita <fabioakita@gmail.com>
RETVAL=0
GITORIOUS_ROOT=/var/www/gitorious.bluequartz.net/gitorious
START_CMD="cd $GITORIOUS_ROOT && rake ultrasphinx:daemon:start RAILS_ENV=production"
STOP_CMD="cd $GITORIOUS_ROOT && rake ultrasphinx:daemon:stop RAILS_ENV=production"
RESTART_CMD="cd $GITORIOUS_ROOT && rake ultrasphinx:daemon:restart RAILS_ENV=production"
STATUS_CMD="cd $GITORIOUS_ROOT && rake ultrasphinx:daemon:status RAILS_ENV=production"
LOCK_FILE=/var/lock/git-ultrasphinx
PID_FILE=$GITORIOUS_ROOT/db/sphinx/log/searchd.pid
case "$1" in
start)
echo `date` " Starting git-ultrasphinx" >> "$GITORIOUS_ROOT/log/git-ultrasphinx.log"
/bin/su -- git -c "$START_CMD"
;;
stop)
echo `date`" Stopping git-ultrasphinx" >> "$GITORIOUS_ROOT/log/git-ultrasphinx.log"
/bin/su -- git -c "$STOP_CMD"
;;
status)
echo `date`" Status For git-ultrasphinx" >> "$GITORIOUS_ROOT/log/git-ultrasphinx.log"
/bin/su -- git -c "$STATUS_CMD"
;;
restart)
echo `date`" ReStarting git-ultrasphinx" >> "$GITORIOUS_ROOT/log/git-ultrasphinx.log"
/bin/su -- git -c "$RESTART_CMD"
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
RETVAL=1
esac
exit $RETVAL
You will also need to copy a file from the gitorious installation into the apsell library directory:
sudo cp /var/www/scm.bluequartz.net/gitorious/vendor/plugins/ultrasphinx/examples/ap.multi /usr/lib/aspell/
DONE:______
Create the file /etc/init.d/git-poller with the following content:
sudo emacs /etc/init.d/git-poller
and the enter the following content. Watch the line wraps below!
#!/bin/sh # 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 GITORIOUS_ROOT=/var/www/gitorious.bluequartz.net/gitorious echo `date` " Starting git-poller" >> "$GITORIOUS_ROOT/log/git-poller.log" /bin/su -- git -c " cd $GITORIOUS_ROOT; RAILS_ENV=production script/poller $@"
DONE:______
Create the file /etc/init.d/stomp with the following content:
sudo emacs /etc/init.d/stomp
and the enter the following content. Watch the line wraps below!
#!/bin/sh
# Start/stop the stompserver
# WATCH THE LINE WRAPPING BELOW
### 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
DONE:______
Based on the gitorious-logrotate from doc/templates/ubuntu we are going to create the file /etc/logrotate.d/gitorious
sudo emacs /etc/logrotate.d/gitorious
Now edit the file to have the following content.
/var/www/gitorious.bluequartz.net/gitorious/log/*log {
missingok
notifempty
sharedscripts
postrotate
/etc/init.d/git-daemon restart > /dev/null 2>/dev/null || true
/etc/init.d/git-ultrasphinx restart > /dev/null 2>/dev/null || true
/bin/touch /var/www/gitorious.bluequartz.net/gitorious/tmp/restart.txt > /dev/null 2>/dev/null || true
endscript
}
DONE:______
Run the following command to create a new "git" user on the server itself.
sudo adduser --system --home /home/git/ --group --shell /bin/bash git sudo chown -R git:git /home/git sudo passwd git # Enter a password for the git user xxxx # On Ubuntu 10.04 you will need to add the www-data user to the "git" Group sudo usermod -a -G git www-data sudo chown -R git:git /var/www/gitorious.bluequartz.net
PASSWORD USED: ____________
DONE:______
Now change the ownership and permissions on the init scripts and other files so they can be run at system startup as the proper user.
cd /var/www/gitorious.bluequartz.net/gitorious sudo chown -R git:git config/environment.rb script/poller log tmp sudo chmod -R g+w config/environment.rb script/poller log tmp sudo chmod ug+x script/poller sudo chown git:git /etc/init.d/git-ultrasphinx sudo chown git:git /etc/init.d/git-daemon sudo chown git:git /etc/init.d/stomp sudo chown git:git /etc/init.d/git-poller sudo chmod 755 /etc/init.d/git-ultrasphinx sudo chmod 755 /etc/init.d/git-daemon sudo chmod 755 /etc/init.d/stomp sudo chmod 755 /etc/init.d/git-poller sudo update-rc.d stomp defaults sudo update-rc.d git-daemon defaults sudo update-rc.d git-ultrasphinx defaults sudo update-rc.d git-poller defaults
DONE:______
We now need to configure the Apache2 Web Server.
Install the Passenger Ruby on Rails Deployment stack
sudo /var/lib/gems/1.8/bin/passenger-install-apache2-module
DONE:______
Create the /etc/apache2/mods-available/passenger.load file with the following configuration. This same information is also printed out by the last command SO MAKE SURE IT MATCHES.
sudo emacs /etc/apache2/mods-available/passenger.load
And place the following content in that file.
# DID YOU VERIFY THIS MATCHES THE VALUES FROM # THE 'sudo /var/lib/gems/1.8/bin/passenger-install-apache2-module' COMMAND? LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so PassengerRoot /var/lib/gems/1.8/gems/passenger-2.2.11 PassengerRuby /usr/bin/ruby1.8
DONE:______
Enable Apache2 modules that are needed for the Ruby on Rails app.
sudo /usr/sbin/a2enmod passenger sudo /usr/sbin/a2enmod rewrite sudo /usr/sbin/a2enmod ssl
DONE:______
Enable the default SSL Web site
sudo /usr/sbin/a2ensite default-ssl
DONE:______
sudo /etc/init.d/apache2 restart * Restarting web server apache2 ... waiting ...done.
DONE:______
Create /etc/apache2/sites-available/gitorious file that contains configuration information about where to find a particular site. The way this is setup I assume that you have full control over your server, web server and web server configuration. We are going to create a few "Virtual Hosts" on the Web server. One to serve our normal static web site at www.bluequartz.net and another to serve the gitorious web site at gitorious.bluequartz.net.
sudo emacs /etc/apache2/sites-available/gitorious
#Edit with the following content
<VirtualHost *:80>
ServerName gitorious.bluequartz.net
DocumentRoot /var/www/gitorious.bluequartz.net/gitorious/public
# Enable X-SendFile for gitorious repo archiving to work
XSendFile on
XSendFileAllowAbove on
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/log/apache2/gitorious_access.log combined
TransferLog /var/log/apache2/gitorious_access.log
ErrorLog /var/log/apache2/gitorious_error.log
</VirtualHost>
DONE:______
Create /etc/apache2/sites-available/gitorious-ssl file which configures the SSL certificates and other SSL related options for the gitorious.bluequartz.net site.
sudo emacs /etc/apache2/sites-available/gitorious-ssl
# Edit with the following content
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
DocumentRoot /var/www/gitorious.bluequartz.net/gitorious/public
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/log/apache2/gitorious_ssl_access.log combined
TransferLog /var/log/apache2/gitorious_ssl_access.log
ErrorLog /var/log/apache2/gitorious_ssl_error.log
</VirtualHost>
</IfModule>
DONE:______
Since we want to keep the normal www.bluequartz.net web site operating AND we do not offer any type of SSL on www.bluequartz.net we only disable the default-ssl web site. If this server was a dedicated Gitorious server where the only thing we ran was gitorious then we would also disable the default web site
# sudo /usr/sbin/a2dissite default sudo /usr/sbin/a2dissite default-ssl sudo /usr/sbin/a2ensite gitorious sudo /usr/sbin/a2ensite gitorious-ssl
DONE:______
We now need to configure the default web site to look in /var/www/htdocs for our 'normal' corporate web site. If your business is large enough you would probably want 2 different servers but since we are small we use a single server for everything. Edit the /etc/apache2/sites-available/default
sudo emacs /etc/apache2/sites-available/default
and fill with this content:
# Edit the file to have the following content
<VirtualHost *:80>
ServerAdmin mike.jackson@bluequartz.net
ServerName www.bluequartz.net
DocumentRoot /var/www/www.bluequartz.net
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/log/apache2/www_access.log combined
TransferLog /var/log/apache2/www_access.log
ErrorLog /var/log/apache2/www_error.log
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
Now create the proper directories for the www web site to reside in:
sudo mkdir -p /var/www/www.bluequartz.net
DONE:______
Note that in the following sections some operations need to be performed as the 'git' user and other operations need to be performed by a user with system administration privileges (either as root or through using the 'sudo' prefix).
# THE FOLLOWING WILL LOG YOU INTO THE MACHINE AS THE git USER su git cd ~ mkdir .ssh touch .ssh/authorized_keys chmod 700 .ssh chmod 600 .ssh/authorized_keys mkdir repositories mkdir tarballs mkdir tarballs-work chmod ug+rwx repositories echo "export PATH=$PATH:/var/www/gitorious.bluequartz.net/gitorious/script" > ~/.bashrc
DONE:______
We are now going to start configuring the actual Gitorious Ruby-on-Rails application settings and environment. First we need to copy some sample config files so that gitorious reads the configuration from those files.
su git cd /var/www/gitorious.bluequartz.net/gitorious mkdir tmp/pids cp config/database.sample.yml config/database.yml cp config/gitorious.sample.yml config/gitorious.yml cp config/broker.yml.example config/broker.yml
Edit the /var/www/gitorious.bluequartz.net/gitorious/config/gitorious.yml file to have the following contents.
emacs /var/www/gitorious.bluequartz.net/gitorious/config/gitorious.yml
and edit to have the following content:
# Remove every section but production
# Be sure if you paste a generated secret key using apg -m 64 that you clean up
# any line breaks. The secret key that is pasted should be on a SINGLE line.
production:
# The session secret key (`apg -m 64` is always useful for this kinda stuff)
cookie_secret: urbecpajicEvpigdiOlqueDracpevyerbEmDecetsendeehur\
EjShucJox8Ojit4WaWrinyienderdalyaifugNeahatdashyunnamFuc
werdolfyedyeactEjEajIb5IksEytkurewsEetAiwirtEkfedtheebyatNoganyoo\
fBabikOcyemEshvovHasojTropsyengyegidzyggEdamCasdijHegdeas
fudCovmenpobdywajcycsuchDabr2NadUlHighEisyoilmojliawgOdAcyimpifCaiW\
umtangEvzueshjajOtFuciddEbWhoivedesjetockVemOdEvnooquon
coapCaQuavnelkoijfudcatfezUlreylbUd
# The path where git repositories are stored. The actual (bare) repositories resides
# in repository_base_path/#{project.slug}/#{repository.name}.git/:
repository_base_path: "/home/git/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 which should be
# the same port that the web server is running on. In Some development
# environments you may see 3000 for the value. For production
# servers you should use the same port as your web server.
gitorious_client_port: 80
# Host the ./script/gitorious script should use:
gitorious_client_host: gitorious.bluequartz.net
# Host which is serving the gitorious app, eg "gitorious.org"
gitorious_host: gitorious.bluequartz.net
# System User which is running git daemon
gitorious_user: git
# Email spam on server errors to:
# You probably want this during development or when you are trying to debug
# an installation that is not working correctly.
exception_notification_emails: mike.jackson@bluequartz.net
# 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-Sendfile)
archive_cache_dir: "/Users/git/tarballs"
# Which directory should we work in when we generate tarballs, before moving
# them to the above dir?
archive_work_dir: "/Users/git/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: false
# Is this gitorious.org? Read: should we have a very flashy homepage?
is_gitorious_dot_org: false
# Pick a default license
#default_license: GNU Affero General Public License (AGPLv3)
Edit the file /var/www/gitorious.bluequartz.net/gitorious/config/database.yml.
emacs /var/www/gitorious.bluequartz.net/gitorious/config/database.yml
# Remove every section but production # Make sure the 'production' section is the following production: adapter: mysql database: gitorious username: git password: [MYSQL PASSWORD GOES HERE] host: localhost encoding: utf8 reconnect = true
DONE:______ PASSWORD USED: ____________
Run the following as the 'git' system user.
su git mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. mysql> CREATE USER 'git'@'localhost' IDENTIFIED BY '********'; mysql> GRANT ALL PRIVILEGES ON * . * TO 'git'@'localhost' IDENTIFIED BY '********' \ WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 \ MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ; mysql> GRANT ALL PRIVILEGES ON `gitorious` . * TO 'git'@'localhost'; mysql> quit
DONE:______
These next commands will create the MySQL databases and then migrate them to the production environment. Configure the ruby scripts to work with your mysql configuration (mind your environment settings!):
su git cd /var/www/gitorious.bluequartz.net/gitorious rake db:create RAILS_ENV=production rake db:migrate RAILS_ENV=production
DONE:______
Create the admin user of the gitorious installation on the gitorious console (which is just a front for the mysql console)
su git cd /var/www/gitorious.bluequartz.net/gitorious env RAILS_ENV=production /usr/bin/ruby1.8 script/create_admin Type in Administrator's e-mail: gitorious-admin@bluequartz.net Type in Administrator's password: ******** Admin user created successfully.
PASSWORD USED: ____________
DONE:______
The database is now more or less set up. It is time to configure the sphinx search daemon. Edit gitorious/config/ultrasphinx/default.base and replace 0.0.0.0 with localhost.
su git cd /var/www/gitorious.bluequartz.net/gitorious/config/ultrasphinx/ emacs default.base
The section to look for will start with the following:
# Daemon options
searchd
{
# What interface the search daemon should listen on and where to store its logs
address = 0.0.0.0
port = 3312
.......
and now change the address key to have a value of localhost
# Daemon options
searchd
{
# What interface the search daemon should listen on and where to store its logs
address = localhost
port = 3312
.......
Next load these configurations into the ruby files
su git cd /var/www/gitorious.bluequartz.net/gitorious rake ultrasphinx:bootstrap RAILS_ENV=production # This will configure the correct spelling support for the 'aspell' library rake ultrasphinx:spelling:build RAILS_ENV=production
Set the permissions again, just to make sure:
# Login as an admin user or user with 'sudo' priviledges. cd /var/www/gitorious.bluequartz.net/gitorious sudo chown -R git:git config/environment.rb script/poller log tmp sudo chmod -R g+w config/environment.rb script/poller log tmp sudo chmod ug+x script/poller
Run the following command to secure the MySQL installation for production use.
sudo /usr/bin/mysql_secure_installation
Create a cron job to run the ultrasphinx indexer at regular intervals.
su git
crontab -e
* */1 * * * cd /var/www/gitorious.bluequartz.net/gitorious && \
rake ultrasphinx:index RAILS_ENV=production
1.6.3