百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

SlimJim

> DevOps
开源

SlimJim 是一个简单的自动更新脚本,它利用 Slim(一个 PHP 微框架)、incron(基于 inotify 的 cron 系统)和 GitHub/Bitbucket 后接收钩子。

100 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

SlimJim 是一个简单的自动更新脚本,它利用 Slim(一个 PHP 微框架)、incron(基于 inotify 的 cron 系统)和 GitHub/Bitbucket 后接收钩子。

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

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! :)

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPcontinuous-deploymentdeploymentgit-hooks

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理