Continuous Integration the quick and easy way

Assuming your codebase is in /www/$(hostname)

Optionally, install Yarn. Othwerwise continue and use NPM:

curl -sS | sudo apt-key add
echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn


@reboot root bash /www/$(hostname)/_cron/


eval "$(ssh-agent -s)"
ssh-add ~/.ssh/gitlab

cd /www/$(hostname)
git reset HEAD -\-hard;
git pull
npm install


var fs = require('fs');
var express = require('express');
var http = require('http');
var app = express();

app.set('port', 9999);'/_deploy', function(req, res) {

    // done
        message: 'Github Hook received!'

    // apply
    var spawn = require('child_process').spawn,
        deploy = spawn('sh', ['']);


http.createServer(app).listen(app.get('port'), function() {
    console.log('Express server listening on port ' + app.get('port'));

So, your _deploy.js Node script will be listening to port http://YOUR-DOMAIN:9999/_deploy

Then, your GitHub (or GitLab, or CMS) account will make a POST request to this url, which will trigger this script to run, which will trigger the "" script to run, which will GIT reset and pull the entire directory from your latest change in your repository.

results matching ""

    No results matching ""