Code Monkey home page Code Monkey logo

slimjim's Introduction

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

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)

root@yourhost:/# ssh-keygen -t rsa -C "root@yourhost"

Copy and paste the contents from ~/.ssh/id_rsa.pub to Account Settings > SSH Keys > Add SSH key on Github

Add Post-Receive URL

Go to Admin -> Service Hooks and add this URL:

http://slimjim.yourcompany.com/deploy

That's it! Now sit back and watch Jim do the tedious work! :)

CONTRIBUTE!

Now if you like what this does, feel free to improve upon code. Just follow these steps to contribute:

  • Fork SlimJim on GitHub & Clone your fork onto your machine

git clone [email protected]:[YOUR_USERNAME]/SlimJim.git

  • Pull the develop branch from the upstream repository

cd SlimJim

git remote add upstream [email protected]:jesalg/SlimJim.git

git fetch upstream

git checkout -b develop origin/develop

  • Keep develop up-to-date

git fetch upstream

git rebase upstream/develop develop

  • Create a feature branch

git flow feature start my_cool_feature

  • Hack Hack Hack

Make sure to commit your work in bite-size chunks, so the commit log remains clear.

  • When ready, push the feature branch to your origin

    git push origin my_cool_feature

  • Issue a pull request to my develop branch

  • I will test out your cool feature on develop and do a release to master soon thereafter! :)

slimjim's People

Contributors

alex56480 avatar animecyc avatar hskrtich avatar jesalg avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.