SlimJim was born out of a need for a simple auto update script which would update multiple development/test environments every time someone

Overview

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 or BitBucket repositories.

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...

How SlimJim Works

INSTALLATION

To configure SlimJim on your server just follow these 4 steps:

  1. Setup site and DB

Basic LAMP website 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.

Run slimjim.sql on your MySql server.

Copy config.sample.php to config.php in the root folder and modify the following variables as needed:

class CUSTOM_CONFIG {
    /* Paths */
   public static $ROOT_PATH = '/srv/www/slimjim.yourcompany.com/public_html/';

    /* MySQL */
    public static $DB_NAME	= 'slimjim';
    public static $DB_HOST  = 'localhost';
    public static $DB_USER	= 'root';
    public static $DB_PASS	= '';
}

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.

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

  1. 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_CLOSE_WRITE php /srv/www/slimjim.yourcompany.com/public_html/deploy.php $#

  1. Permissions

Give execute permissions to the deploy script

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

Allow writing to the requests folder

root@yourhost:/# chmod 777 /srv/www/slimjim.yourcompany.com/public_html/requests

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 the contents from ~/.ssh/id_rsa.pub and add to GitHub or add to BitBucket

  1. Add Post-Receive Webhook

Finally, add the appropriate one of these URLs as a webhook into your repository settings:

For GitHub: http://slimjim.yourcompany.com/gh_hook

For BitBucket: http://slimjim.yourcompany.com/bb_hook

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

CONTRIBUTE!

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

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Issue a pull request to my develop branch
  6. I will test out your cool feature on develop and do a release to master soon thereafter! :)
Comments
  • not working in subdirectory of website

    not working in subdirectory of website

    From my testing, (at least for the Admin area), the pathing doesn't seem to work correctly when setup in a subdirectory off the server root. (i.e. http://mysite.com/slimjim/admin/index.php ) .

    When I did a subdomain w/ slimjim in the root it worked fine....(i.e. http://mysite.com/admin/index.php )

    This possibly could have been my server configuration - so this is an unverified issue.

    (Centos 5 / apache 2 / php 5.3 )

    opened by johnmolino 3
  • Last step - unclear

    Last step - unclear

    Hello there! :)

    Firstly, thanks for the tool, it's looking promising! I was about to test it, and got it all except the last step. What should I do exactly in this step:

    Add Post-Receive Webhook
    Finally, add the appropriate one of these URLs as a webhook into your repository settings:
    
    For GitHub: http://slimjim.yourcompany.com/gh_hook
    
    For BitBucket: http://slimjim.yourcompany.com/bb_hook
    

    ?

    Where should I add the https://mysite/gh_hook?

    Thanks in further!

    opened by milosb793 2
  • Adding support for hooks and various other improvements.

    Adding support for hooks and various other improvements.

    Like the title, added support for hooks. Also fixed some errors in the CLI commands. It now clones the project if the directory is empty. Instead of echoing we log to the syslog for realtime debugging. I added two hooks, "writable" and "after_deploy" which execute commands therein. Hook file is formatted in YAML. Settings table adds support for various improvements. I pre populated it with the current IPs from github and the default Hook file name.

    opened by animecyc 1
  • Multiple checkouts of same repository on same server instance

    Multiple checkouts of same repository on same server instance

    Allow for multiple checkouts of the same repository on the same server instance. E.g. convenient when DEV- and STAGING-environment are placed on the same server.

    opened by plivius 0
  • Github cidr checks

    Github cidr checks

    This bypass might be useful for those still struggling with the heartbleed fall-out (i.e. php-curl-ssl issues or servers with self-signed certificates).

    opened by plivius 0
Owner
Jesal Gadhia
Jesal Gadhia
This library provides a collection of native enum utilities (traits) which you almost always need in every PHP project.

This library provides a collection of native enum utilities (traits) which you almost always need in every PHP project.

DIVE 20 Nov 11, 2022
Quickly and easily preview and test your Magento 2 order confirmation page, without hacks or spending time placing new order each time

Preview Order Confirmation Page for Magento 2 For Magento 2.0.x, 2.1.x, 2.2.x and 2.3.x Styling and testing Magento's order confirmation page can be a

MagePal :: Magento Extensions 71 Aug 12, 2022
Plugin Notify OP Or Staff Has Permission antixraype.check when someone breaks ore

General Plugin Notify OP Or Staff Has Permission antixraype.check when someone breaks ore If the message repeats many times, check if the player is us

Nguyễn Đạt 3 Mar 15, 2022
Create and update progress bars in different environments

Create and update progress bars in different environments

Laminas Project 8 Jul 28, 2022
This script allows to bypass Oracle Cloud Infrastructure 'Out of host capacity' error immediately when additional OCI capacity will appear in your Home Region / Availability domain.

Resolving Oracle Cloud "Out of Capacity" issue and getting free VPS with 4 ARM cores / 24GB of memory Very neat and useful configuration was recently

Alexander Hitrov 323 Jan 6, 2023
salah eddine bendyab 18 Aug 17, 2021
⌚ Watch your RAM in real time with this script ⌚

PHP-MemWatch Watch your RAM in real time, with this script! * Substitute of watch -n 1 free -m How to use: 1° Download this project 2° Extract to your

Érik Freitas 4 Dec 5, 2021
Run a script in real time inside your pocketmine server!

Geral PlayScript is a plugin that allows you to run PHP code directly from the server by command. How to use Move your PHP code (must have a .php exte

LADINO 3 Aug 9, 2022
Allow multiple options for Magento 2 checkout layout. Provides capabilities to AB test checkout changes and more.

Aimes_CheckoutDesigns Features Please note: This module is currently still considered a proof of concept. This module provides the ability to change c

Rob Aimes 30 Aug 8, 2022
A simple shell script which loads a magento environment

A simple shell script to load up a Magento environment and execute PHP code Very experimental and should only be ran on dev servers REQUIRES php pcntl

beeplogic 28 Feb 4, 2022
Envbar allows you to differentiate between environments by adding a custom colored bar above the top navigation.

Envbar Envbar allows you to differentiate between environments by adding a custom colored bar above the top navigation. This should help backend users

Magenizr 6 Oct 7, 2022
Sspak - Tool for managing bundles of db/assets from SilverStripe environments

SSPak SSPak is a SilverStripe tool for managing database and assets content, for back-up, restoration, or transfer between environments. The file form

Silverstripe CMS 45 Dec 14, 2022
Warden is a CLI utility for orchestrating Docker based developer environments

Warden Warden is a CLI utility for orchestrating Docker based developer environments, and enables multiple local environments to run simultaneously wi

David Alger 314 Dec 2, 2022
A set of PHP scripts which leverage MySQL INFORMATION_SCHEMA to create log tables and insert / update triggers

mysql-logtable-php mysql-logtable-php is a set of PHP scripts which leverage MySQL INFORMATION_SCHEMA to create log tables and insert / update trigger

null 3 Feb 27, 2022
The swiss army knife for Magento developers, sysadmins and devops. The tool provides a huge set of well tested command line commands which save hours of work time. All commands are extendable by a module API.

netz98 magerun CLI tools for Magento 2 The n98 magerun cli tools provides some handy tools to work with Magento from command line. Build Status Latest

netz98 758 Dec 28, 2022
Adds a header to every response to try and twart Google's usage of your site in it's FLoC tracking method.

Laravel No FLoC This package will add the Permissions-Policy: interest-cohort=() to try and twart Google's usage of your site in it's FLoC tracking me

Jean-Philippe Murray 11 Jul 14, 2022
Sanitize and escape every values in your PHP Application

PHP Sanitizer Sanitize and escape every values in your PHP Application. This solution will make PHP developer life easy, very easy and developers woul

Maniruzzaman Akash 10 Oct 2, 2022
Collection of useful PHP functions, mini-classes, and snippets for every day.

JBZoo / Utils Collection of PHP functions, mini classes and snippets for everyday developer's routine life. Install composer require jbzoo/utils Usage

JBZoo Toolbox 786 Dec 30, 2022
This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every translatable field.

Autotranslate This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every

null 4 Jan 3, 2022