Continuous Integration the quick and easy way

Assuming your codebase is in /www/ps-api


@reboot root bash /www/ps-api/_cron/


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

cd /www/ps
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 ""