<commit_before>== Installing jobsworth on your server
=== Step 1: Getting the source

The source is released under the MIT/X Consortium License.

The easiest way to get the source and easily update it from time to time is with git. You'll need to install that on your machine and then run:

  git clone git://github.com/ari/clockingit.git

You will want to put the source somewhere sensible depending on your operating system. On OSX that might be ~/Sites/jobsworth and on FreeBSD /usr/local/www/jobsworth. We'll use the FreeBSD path in these instructions.

=== Step 2: Prerequsites

You need to be running some type of Unix: OSX, Linux, Solaris, BSD. Windows will probably not work. You will also need a database. MySQL has been heavily tested, and some people are running postgresql.

Install the following packages:

* ruby gems
* ruby mysql driver (you could also choose postgresql)
* rake
* ImageMagick

How to install these will differ on each platform. Some possibilities:

==== FreeBSD

  portinstall ruby-iconv ruby18-gems ruby18-mysql rubygem-rake ImageMagick

==== OSX

First install the Macports system from http://www.macports.org. Then:

  sudo port install rb-rubygems rb-mysql rb-rake ImageMagick

==== Other

Under other operating systems use your favourite package manager to ensure you have Ruby 1.8.x, rubygems, Imagemagick, Rake and the Ruby mysql driver installed.


=== Step 3: Phusion Passenger

Install Phusion Passenger. You can instead use Mongrel, but it tends to be a little easier to set up with Phusion.

  gem install passenger
  passenger-install-apache2-module

And follow the instructions you'll be given about how to install the relevant config for Apache httpd.

Your Apache httpd virtual host DocumentRoot should point to the public directory in the installation directory.

  <VirtualHost *:80>
    ServerName <EMAIL>sworth.example.com.au
    RailsEnv production
    PassengerHighPerformance on

    DocumentRoot /usr/local/www/jobsworth/public
    CustomLog /var/log/www/myserver.example.com.au-access_log combined
    ErrorLog /var/log/www/myserver.example.com.au-access_log
  </VirtualHost>

Naturally adjust the paths to suit your own environment.


=== Step 4: Setup configuration and database

  cd /usr/local/www/jobsworth
  ruby setup.rb
  
  
=== Step 5: Ruby gems

There are a few Ruby gems which are needed for running CIT. Change directory into the top of your CIT installation, then type:

  rake gems:install

That will install the gems you need.

If you have trouble on OSX with the mysql gem (this seems to be an issue on 10.5), then try this
  sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-include=/opt/local/include/mysql5 --with-mysql-lib=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config




== Upgrading to a newer revision

  git checkout db/schema.rb
  git pull

Check that there aren't any updated gems or new gems to install. If there are, just follow the instructions you will be given on screen.

  rake gems

Next, make sure the database is updated and javascript/css rebuilt.

  rake db:migrate RAILS_ENV=production
  rake asset:packager:build_all

Depending on which environment you are updating, you can change the RAIL_ENV value to "test" or "development" and the appropriate database will be updated.

Find the daemon running with

  ps ax | grep push_server

then kill the push server daemon.
<commit_msg>Let's update the docs to reflect that we no longer have to deal with the asset combining stuff by hand now.<commit_after>== Installing jobsworth on your server
=== Step 1: Getting the source

The source is released under the MIT/X Consortium License.

The easiest way to get the source and easily update it from time to time is with git. You'll need to install that on your machine and then run:

  git clone git://github.com/ari/clockingit.git

You will want to put the source somewhere sensible depending on your operating system. On OSX that might be ~/Sites/jobsworth and on FreeBSD /usr/local/www/jobsworth. We'll use the FreeBSD path in these instructions.

=== Step 2: Prerequsites

You need to be running some type of Unix: OSX, Linux, Solaris, BSD. Windows will probably not work. You will also need a database. MySQL has been heavily tested, and some people are running postgresql.

Install the following packages:

* ruby gems
* ruby mysql driver (you could also choose postgresql)
* rake
* ImageMagick

How to install these will differ on each platform. Some possibilities:

==== FreeBSD

  portinstall ruby-iconv ruby18-gems ruby18-mysql rubygem-rake ImageMagick

==== OSX

First install the Macports system from http://www.macports.org. Then:

  sudo port install rb-rubygems rb-mysql rb-rake ImageMagick

==== Other

Under other operating systems use your favourite package manager to ensure you have Ruby 1.8.x, rubygems, Imagemagick, Rake and the Ruby mysql driver installed.


=== Step 3: Phusion Passenger

Install Phusion Passenger. You can instead use Mongrel, but it tends to be a little easier to set up with Phusion.

  gem install passenger
  passenger-install-apache2-module

And follow the instructions you'll be given about how to install the relevant config for Apache httpd.

Your Apache httpd virtual host DocumentRoot should point to the public directory in the installation directory.

  <VirtualHost *:80>
    ServerName jobsworth.example.com.au
    RailsEnv production
    PassengerHighPerformance on

    DocumentRoot /usr/local/www/jobsworth/public
    CustomLog /var/log/www/myserver.example.com.au-access_log combined
    ErrorLog /var/log/www/myserver.example.com.au-access_log
  </VirtualHost>

Naturally adjust the paths to suit your own environment.


=== Step 4: Setup configuration and database

  cd /usr/local/www/jobsworth
  ruby setup.rb
  
  
=== Step 5: Ruby gems

There are a few Ruby gems which are needed for running CIT. Change directory into the top of your CIT installation, then type:

  rake gems:install

That will install the gems you need.

If you have trouble on OSX with the mysql gem (this seems to be an issue on 10.5), then try this
  sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-include=/opt/local/include/mysql5 --with-mysql-lib=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config




== Upgrading to a newer revision

  git checkout db/schema.rb
  git pull

Check that there aren't any updated gems or new gems to install. If there are, just follow the instructions you will be given on screen.

  rake gems

Next, make sure the database is updated:

  rake db:migrate RAILS_ENV=production

Depending on which environment you are updating, you can change the RAIL_ENV value to "test" or "development" and the appropriate database will be updated.

Find the daemon running with

  ps ax | grep push_server

then kill the push server daemon.

{'fraction_non_alphanumeric': 0.06140223544781536, 'fraction_numerical': 0.006677311656263609, 'mean_word_length': 3.931997136721546, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 12, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6217721', 'n_tokens_mistral': 2021, 'n_tokens_neox': 1862, 'n_words': 919}