Skip to content

Instantly share code, notes, and snippets.

@fdelbos
fdelbos / FreeBSD_node_monit.md
Last active February 17, 2020 13:38
FreeBSD 10 Nodejs setup with nginx, mongo and monit

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

;;; header2.el --- Support for creation and update of file headers.
;;
;; Filename: header2.el
;; Description: Support for creation and update of file headers.
;; Author: Lynn Slater
;; Drew Adams
;; Maintainer: Drew Adams
;; Copyright (C) 1996-2013, Drew Adams, all rights reserved.
;; Copyright (C) 1989 Free Software Foundation, Inc.
;; Copyright (C) 1988 Lynn Randolph Slater, Jr.
@fdelbos
fdelbos / TJSONProtocol.py
Created October 24, 2012 20:35
A Python JSON implementation of the Thrift protocol
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@fdelbos
fdelbos / pkg_display.py
Created March 23, 2012 21:21
display information on each package on freebsd
#!/usr/local/bin/python
import os, sys, commands
def print_package(name):
rows, columns = os.popen('stty size', 'r').read().split()
for i in range (int(columns)):
sys.stdout.write('_')
print '\n'
@fdelbos
fdelbos / gist:1852875
Created February 17, 2012 11:39
Mount freebsd disk from linux
mount -r -t ufs -o ufstype=ufs2 /dev/sda1 1/
@fdelbos
fdelbos / uwsgi.xml
Created February 15, 2012 16:12
uWsgi xml config file
<uwsgi>
<socket>127.0.0.1:3031</socket>
<pythonpath>..</pythonpath>
<chdir>/usr/home/fred/www/lecomptoir/</chdir>
<module>django_wsgi</module>
</uwsgi>
@fdelbos
fdelbos / gist:1836947
Created February 15, 2012 16:09
FreeBSD startup script for uWsgi
#!/bin/sh
#
# PROVIDE: myuwsgi
#
. /etc/rc.subr
name=myuwsgi
rcvar=myuwsgi_enable
start_cmd="myuwsgi_start"
@fdelbos
fdelbos / nginx.conf
Created February 15, 2012 15:12
Freebsd Nginx config for Django
user www;
worker_processes 1;
error_log /var/log/nginx-error.log;
events {
worker_connections 256;
use kqueue;
}
http {
@fdelbos
fdelbos / gist:1225129
Last active September 27, 2015 06:18
basic shell conf
export PS1="[\e[0;47m\w\e[0m]\e[0;32m\\$\e[0m "
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
BLOCKSIZE=m; export BLOCKSIZE
EDITOR=emacs; export EDITOR
PAGER=less; export PAGER
PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-current
export PACKAGESITE
@fdelbos
fdelbos / .emacs
Last active September 27, 2015 06:08
Minimalist Emacs configuration
(setq visible-bell t)
(line-number-mode 1)
(column-number-mode 1)
(global-font-lock-mode t)
(setq font-lock-maximum-size nil)
(setq-default transient-mark-mode t)
(menu-bar-mode -1)
(setq backup-inhibited t)
(setq auto-save-default nil)
(setq inhibit-startup-message t)