Or how this site is updated

This site is build via jekyll and the sources are coming from a git repository on github. I do not write something special about git or jekyll here. Just how the “deployment” works.

Github webhook

Github has a nice feature called “Service hooks” - especially a “Post-Receive URLs” hook. I use this hook to notify my server to do a “git pull” on a local repository, then rebuild the site with jekyll and rsync changed data to the document root.

The webhook endpoint:

packageReceiveHook;useDancer':syntax';our$VERSION='0.3';# Configuration for different projectsmy$config={"PROJECTNAME"=>{run=>"/home/user/bin/updateblog.sh",},};prefix'/notify';get'/*'=>sub {header'Allow'=>'POST';status'405';"Not for you\n";};post'/:project'=>sub {if(notdefined$config->{params->{project}}){status'not_found';return"No such project: ".params->{project}."\n";}my$payload=params->{'payload'};if(notdefined$payload){status'415';return"I need a payload\n";}# Read the configuration for that repomy$repo_config=$config->{$repo->{name}};if(defined$repo_config&&defined$repo_config->{run}){eval{system$repo_config->{run};};}return"OK";};true;