Gitorious is a project mainly written in ..., based on the AGPL-3.0 license.
mirror of gitorious, with private repositories and projects.
Please see HACKING
Please see the LICENSE file
Also see the files in the doc/ folder, they contain further detailed information about setting up the application for specific linux distributions such as CentOS and Ubuntu/Debian
You may want to make separate directories, away from everything, to hold the site code and the git repository respectively. In production, you'll be setting up a special user account too, but don't worry about that yet.
For this intro we're going to use, as examples,
All of these can be adjusted to suit: specifically, dirs within your home directory are fine, and (though MySQL has the best development coverage), the website code should be free of mysql-isms/quirks.
First of all, we assume you have a working Ruby on Rails installation on your machine. The Rails project has several resources about getting up and running with Rails, have a look at getting started on rubyonrails.org. Please ensure you're able to create a Rails project that uses your database of choice; this guide assumes your machine is ready to run Rails.
Gitorious itself runs on either Ruby 1.8 or 1.9. Gitorious.org itself uses Ruby 1.9 and we recommend you do the same.
First, install each of these Libraries/applications:
An ActiveMessaging (http://code.google.com/p/activemessaging/wiki/Installation) compatible queue server. Gitorious.org runs ActiveMQ and STOMP, stompserver might be a nice flyweight alternative for your needs
Next, get the gitorious code itself:
Now you need edit a couple of configuration files.
This file contains settings for the databases used for Gitorious. The Gitorious distribution provides a sample config file - database.sample.yml - that you could copy to config/database.yml.
Gitorious should be database agnostic, so feel free to use your database of choice. Gitorious.org uses MySQL, but there shouldn't be any MySQL specific code in Gitorious, so use whatever you're most comfortable with.
This file holds Gitorious specific configuration for each Rails environment. There's a sample file in config/gitorious.sample.yml that describes what each instruction means. Do make sure you have a section for each Rails environment, especially if you're upgrading an existing Gitorious installation.
Create a directory to hold project files
Add the path to this directory under repository_base_path in gitorious.yml
Make a long, complicated string. You can run "apg -m 64", or if you lack 'apg'
dd if=/dev/random count=1 | md5sum
,
and put that on the 'cookie_secret' line (replacing the 'ssssht').
This file contains information about the Message Queing system used in your Gitorious installation. There's a section about this further down in this document, but as a starting point you can use the supplied sample file in config/broker.yml.example (cp config/broker.yml.example config/broker.yml)
Gems are handled by Bundler. Install Bundler, then use it to install all of Gitorious' requirements. Note that Gitorious does not work out of the box with RubyGems 1.5, so make sure you're on an earlier version (e.g. 1.4.x).
[sudo] gem install bundler bundle install
It is now time for creating the Gitorious database.
bundle exec rake db:create:all
will create an empty database for you.
Now that you have a database, it's time to add the database schema
bundle exec rake db:migrate
will take care of this for you
Running all the tests will ensure your Gitorious installation is correctly set up. It takes less than a minute to run all the tests, and gives confidence that the code is working as intended.
bundle exec rake test
Once all the tests pass, you're almost ready.
Gitorious uses the ActiveMessaging plugin, which supports a range of different messaging platforms, for sending demanding tasks for asynchronous processing. In order to these events to be processed, you need to run a messaging server when running Gitorious.
A pretty reliable solution is to use Apache's ActiveMQ messaging queue system, located at http://activemq.apache.org/ . Download a version for you operating system, unpack, and follow the instructions to get running. On Unix-like systems, this is as easy as unpacking the tarball, going into it and running
bin/activemq
This will start the ActiveMQ server in a default setup, probably pretty well suited for development purposes. The ActiveMessaging plugin needs to know how to contact your MQ server, so it needs a config/broker.yml file. The Gitorious distribution provides an example (again, the defaults should work in a development environment). Just copy the config/broker.yml.example to config/broker.yml and start your server.
The messages are sent to the server, in order to "consume" the messages, there is a script in scripts/poller that will run all registered "processors" (found in app/processors) that consume messages. In order to have eg. creation of repositories done automatically run
bundle exec script/poller start
and the script will be started and daemonized.
You're free to use other messaging protocols than the default Stomp protocol, which is required in config/environment.rb. The ActiveMessaging website (http://code.google.com/p/activemessaging/wiki/ActiveMessaging) has more information about how to set this up.
bundle exec rake ultrasphinx:configure RAILS_ENV=production bundle exec rake ultrasphinx:index RAILS_ENV=production bundle exec rake ultrasphinx:daemon:start RAILS_ENV=production
This sequence of commands will configure, index the database and start the sphinx daemon
Now that you have all the components running, it's time to try Gitorious on your local machine:
bundle exec script/server (for Mongrel/Webrick) thin start (for Thin)
Remember the values you put for gitorious_host and gitorious_port in
config/gitorious.yml? Go to http://
In a production environment, you'll want to automate as much as possible. We use Capistrano for deploying to gitorious.org, and use custom Capistrano recipes for starting and stopping the various tasks in Gitorious.
The doc/recipes directory contains instructions for setting up init scripts for these tasks for various platforms. Please consult these, and feel free to contribute your own!
The sphinx daemon needs to be running in order for full text search to work.
For cloning over the Git protocol, Gitorious includes a custom git daemon found in script/git-daemon.
The script/poller script needs to be kept running.
While Mongrel/thin is great for trying out Gitorious on a local install, in a production environment you'll probably want something a little more robust. Most Rails folks use Passenger with Apache or Nginx these days, Gitorious will play happily in such an environment.
In order for people to be able to push to your repositories, you need an SSH daemon running. You'll also need a system user account that's used for git connections through SSH. Consult the recipes in doc/recipes for instructions on how to set this up. Until you've done this, the web frontend will work, but users won't be able to push their changes.
In production, you'll want to have a limited-privileges user to run the git processes, just as you do for your webserver
Make the tree invisible to any other non-root user; make the tree read-only by that user; but grant write access to the /tmp and /public/cache directories.
Consider setting up the standard (lighttpd|nginx|apache) frontend <=> mongrel backend if you see traffic (or configure mod_passenger for apache2).
Gitorious will add a 'forced command' to your ~/.ssh/authorized_keys file for the target host: if you start finding ssh oddities suspect this first. Don't log out until you've ensured you can still log in remotely.