<commit_before>SlimJim
=======

### WHY? 

SlimJim was born out of a need for a simple auto update script which would update multiple development/test environments every time someone commits to their respective Github repository.

I know there are many deployment/build scripts out there like whiskey_disk, Vlad and Capistrano which can do this if coupled with a CI server like cijoe, Jenkins, etc. 

But I found them to be more complicated to setup just for a basic need i.e to simply update a development/test environment using a post-receive hook without any manual user interaction on behalf of the committer besides ``git push...``

### INSTALLATION 

Now lets get to it. To configure SlimJim on your server follow these steps:

**Setup site and DB**

Basic LAMP setup should suffice. Everything you need is in this repo. I'm using a PHP micro-framework called Slim (thus the name!).

Just don't forget to update the first line in deploy.php to point to the path of your SlimJim directory

Run slimjim.sql on your MySql server

For all the projects that you want to auto-update, add the name of the github repo, branch and the physical path on your server to the Projects table

Modify the IPs in the allowed_from key in the settings table to make sure GitHub or any other site can POST to your endpoint.

**Install & setup [incron](http://inotify.aiken.cz/?section=incron&page=about&lang=en)**

When the site receives a payload from the post-receive hook it will drop a request in the /requests folder. Incron is needed to listen for that event and trigger the deploy script.

``root@yourhost:/# apt-get install incron``

Add the root user to your allow list

``root@yourhost:/# vi /etc/incron.allow``

Add this, save and quit:

``root``

Now watch your requests directory for updates

``root@yourhost:/# incrontab -e``

Add this, save and quit:

``/srv/www/slimjim.yourcompany.com/public_html/requests/ IN_CREATE php /srv/www/slimjim.yourcompany.com/public_html/deploy.php $#``

**Permissions**

Give execute permissions to the deploy script

``root@yourhost:/# chmod +x deploy.php``

Give permissions to pull from github to the root user (make sure to leave the password empty) 
<commit_msg>Updates to instructions<commit_after>SlimJim
=======

### WHY? 

SlimJim was born out of a need for a simple auto update script which would update multiple development/test environments every time someone commits to their respective Github repository.

I know there are many deployment/build scripts out there like whiskey_disk, Vlad and Capistrano which can do this if coupled with a CI server like cijoe, Jenkins, etc. 

But I found them to be more complicated to setup just for a basic need i.e to simply update a development/test environment using a post-receive hook without any manual user interaction on behalf of the committer besides ``git push...``

### INSTALLATION 

Now lets get to it. To configure SlimJim on your server follow these steps:

**Setup site and DB**

Basic LAMP setup should suffice. Everything you need is in this repo. I'm using a PHP micro-framework called Slim (thus the name!) which requires PHP 5.3.0 or newer.

Update the first line in deploy.php to point to the path of your SlimJim directory.

Run slimjim.sql on your MySql server. Update /index.php & /admin/index.php with appropriate host, username, and password for the database.

For all the projects that you want to auto-update, add the name of the github repo, branch and the physical path on your server to the projects table.

Modify the IPs in the allowed_from key in the settings table to make sure GitHub or any other site can POST to your endpoint.

Alternatively, you can also manage projects and other settings by going to the administrative interface located at /admin

**Install & setup [incron](http://inotify.aiken.cz/?section=incron&page=about&lang=en)**

When the site receives a payload from the post-receive hook it will drop a request in the /requests folder. Incron is needed to listen for that event and trigger the deploy script.

``root@yourhost:/# apt-get install incron``

Add the root user to your allow list

``root@yourhost:/# vi /etc/incron.allow``

Add this, save and quit:

``root``

Now watch your requests directory for updates

``root@yourhost:/# incrontab -e``

Add this, save and quit:

``/srv/www/slimjim.yourcompany.com/public_html/requests/ IN_CREATE php /srv/www/slimjim.yourcompany.com/public_html/deploy.php $#``

**Permissions**

Give execute permissions to the deploy script

``root@yourhost:/# chmod +x deploy.php``

Give permissions to pull from github to the root user (make sure to leave the password empty) 

{'fraction_non_alphanumeric': 0.06992254733218589, 'fraction_numerical': 0.0006454388984509467, 'mean_word_length': 4.362168396770473, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '6898932', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1247, 'n_words': 672}