This manual is about setting up an automatic deploy workflow using nodejs, PM2, nginx and GitLab CI. It is tested on:
- Target server: Ubuntu 16.04 x64. This is suitable for Ubuntu 14.x.
- Windows 10 on my PC to work.
const invoices = [ | |
{ invoiceId: "c1-5b", vendor: "GE", paid: true }, | |
{ invoiceId: "a", vendor: "GE", paid: false }, | |
{ invoiceId: "-7c", vendor: "Whirlpool", paid: true }, | |
{ invoiceId: "b", vendor: "Bosch", paid: true }, | |
{ invoiceId: "9b54-dbdd", vendor: "Bosch", paid: false }, | |
{ invoiceId: "2cac788-", vendor: "Whirlpool", paid: true }, | |
{ invoiceId: "99cd9c14", vendor: "Bosch", paid: false }, | |
{ invoiceId: "a1854b-14b", vendor: "Frigidaire", paid: false }, | |
{ invoiceId: "43b76a75", vendor: "Bosch", paid: true }, |
var gulp = require('gulp'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
var browserify = require('browserify'); | |
var watchify = require('watchify'); | |
var babel = require('babelify'); | |
function compile(watch) { | |
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel)); |
<?php | |
namespace GM\VirtualPages; | |
/** | |
* @author Giuseppe Mazzapica <[email protected]> | |
* @license http://opensource.org/licenses/MIT MIT | |
*/ | |
class Controller implements ControllerInterface { | |
private $pages; |
The trick? pass the file descriptor from a parent process and have the server.listen reuse that descriptor. So multiprocess in their own memory space (but with ENV shared usually)
It does not balance, it leaves it to the kernel.
In the last nodejs > 0.8 there is a cluster module (functional although marked experimental)
// NOTE: I previously suggested doing this through Grunt, but had plenty of problems with | |
// my set up. Grunt did some weird things with scope, and I ended up using nodemon. This | |
// setup is now using Gulp. It works exactly how I expect it to and is WAY more concise. | |
var gulp = require('gulp'), | |
spawn = require('child_process').spawn, | |
node; | |
/** | |
* $ gulp server | |
* description: launch the server. If there's a server already running, kill it. |