Skip to content

Instantly share code, notes, and snippets.

FreeBSD 10 Nodejs setup with nginx, mongodb, redis and monit

This my receipe for installing a complete nodejs server on FreeBSD 10. The parameters used in this configuration are for a very small private server that I use for demo purpose only, so for a production server, you should somehow set the limits in pair with your ressources.

I use monit so I don't have to write rc scripts for node and it should take care of process lifecycle management for me. Alternatives exists such as supervisord or circus.

Installing mongodb

1) Load the u3g(4) driver:
# kldload u3g
# kldstat
Id Refs Address Size Name
...
7 1 0xffffffff81b6e000 5ffb u3g.ko
2) Set the driver to load at boot:
@nkhine
nkhine / demo.js
Created July 9, 2012 11:59 — forked from syntagmatic/demo.js
Projection Demo
// demo.js
//
// Adapted by Kai Chang and Rich Morin from http://bl.ocks.org/1653763
window.onload = function() {
var w = $('#chart').width(),
h = (w * 0.45);
proj = {
@nkhine
nkhine / README.md
Created July 10, 2012 07:16 — forked from mbostock/.block
Superformula Tweening (Christophe Viau)

Christophe Viau implemented a new shape type for D3.js based on superformulas. One nice property of these shapes is that you can easily tween between two shapes by simply interpolating the control points. Click on the blue shapes to try it!

@nkhine
nkhine / debt.csv
Created July 10, 2012 10:34 — forked from mbostock/.block
The Euro Debt Crisis
creditor debtor amount risk
Britain France 22.4 3
Britain Greece 0.55 0
Britain Italy 26 0
Britain Portugal 19.4 0
Britain United States 345 1
France Germany 53.8 1
France Greece 53.9 0
France Ireland 17.3 0
France Italy 366 0
@nkhine
nkhine / index.html
Created July 10, 2012 11:54 — forked from eugenepyvovarov/index.html
Google Maps + D3
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" src="http://github.com/mbostock/d3/raw/v1.8.4/d3.js"></script>
<style type="text/css">
html, body, #map {
width: 100%;
@nkhine
nkhine / README.md
Created July 12, 2012 12:36 — forked from mbostock/.block
Twitter SVG Logo
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<title>Creating SVG groups with D3.js</title>
</head>
<body>
<div id="d3group"></div>
<script type="text/javascript">
@nkhine
nkhine / jquery.doubletap.js
Created August 9, 2012 12:23 — forked from asgeo1/jquery.doubletap.js
doubletap event for jquery
//based on blog post that I saw here: http://www.sanraul.com/2010/08/01/implementing-doubletap-on-iphones-and-ipads/
(function($){
$.fn.doubletap = function(fn) {
return fn ? this.bind('doubletap', fn) : this.trigger('doubletap');
};
$.attrFn.doubletap = true;
$.event.special.doubletap = {
setup: function(data, namespaces){
@nkhine
nkhine / fiddle.css
Created September 6, 2012 10:05 — forked from zalun/fiddle.css
body {
font-family: Helvetica, Verdana
}
p {
padding: 7px 10px;
}
#demo {
border: 1px solid #999;
}