Skip to content

Instantly share code, notes, and snippets.

View pid's full-sized avatar

Sascha pid

  • Baden-Württemberg, Germany
View GitHub Profile
{
"name": "my-app",
"version": "0.0.0",
"dependencies": {
"browserify": "~2.36.1",
"less": "~1.5.1"
},
"devDependencies": {
"watchify": "~0.4.1",
"catw": "~0.2.0"
var gulp = require('gulp');
var gutil = require('gulp-util');
var express = require('express');
var path = require('path');
var tinylr = require('tiny-lr');
var createServers = function(port, lrport) {
var lr = tinylr();
lr.listen(lrport, function() {
gutil.log('LR Listening on', lrport);
// jshint devel: true
// make a copy of each `console` methods and adds them
// to the global object so that you can call `log('foobar')`
// instead of the verbose `console.log('foobar')`
// DO NOT USE IT IN PRODUCTION MODE
// @623HS
(function(global) {
'use strict';
var name, value;

Overview

We run multiple server processes in two data centers. Each process listens on two ports, one for HTTP and one for HTTPS. HTTPS is terminated by Apache prior to reaching node.js. HTTP goes directly from the client to node.js (through a master load balancer). We do not use clusters. We slice our physical servers into thin virtual machines running SmartOS, each with about 3GB of memory designed for a single node.js process.

Our node.js servers are hapi.js servers using the composer functionality and plugins architecture. We have three sets of plugins loaded: mobile web front end experience (single page app), legacy API reverse proxy, and monitoring.

We also serve original node.js services off another server zone which runs closed source plugins using hapi.

Analytics

@pid
pid / LICENSE.txt
Created January 27, 2014 20:37 — forked from jed/LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@pid
pid / cors-nginx.conf
Last active August 29, 2015 14:06 — forked from michiel/cors-nginx.conf
nginx CORS config
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
#!/bin/bash
##############################################
# modified version of original http://media-glass.es/ghost-sitemaps/
# for ghost.centminmod.com
# http://ghost.centminmod.com/ghost-sitemap-generator/
##############################################
url="ghost.centminmod.com"
webroot='/home/nginx/domains/ghost.centminmod.com/public'
path="${webroot}/sitemap.xml"
user='nginx' # web server user
@pid
pid / default.vcl
Last active August 29, 2015 14:08 — forked from lkarsten/default.vcl
varnish vcl for ghost blogging platform
#
# Varnish VCL file for Ghost blogging platform.
# http://ghost.org/
#
# Written for Ghost v0.3.0.
#
# This is a low-hanging-fruit type of VCL. TTL of objects are overridden to 2
# minutes, and everything below /ghost/ is pass()-ed so the user sessions
# work.
#