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

@ChaosJohn
ChaosJohn / post-receive.sh
Last active August 29, 2015 14:27 — forked from icyleaf/post-receive.sh
git autodeploy script when it matches the string "[deploy]"
#!/bin/sh
#
# git autodeploy script when it matches the string "[deploy]"
#
# @author icyleaf <icyleaf.cn@gmail.com>
# @link http://icyleaf.com
# @version 0.1
#
# Usage:
# 1. put this into the post-receive hook file itself below
@ChaosJohn
ChaosJohn / README.md
Last active September 15, 2015 07:02 — forked from hwdsl2/.MOVED.md
IPsec L2TP VPN Auto Install Script for Ubuntu 14.04 & 12.04 and Debian 8
@ChaosJohn
ChaosJohn / README.md
Last active September 15, 2015 07:02 — forked from hwdsl2/.MOVED.md
IPsec L2TP VPN Auto Install Script for CentOS / RHEL 6 and 7

IPsec/L2TP VPN Auto Install Script for CentOS/RHEL

Script for automatic configuration of IPsec/L2TP VPN server on CentOS/RHEL 6 & 7 64-bit.
Works on dedicated servers or any KVM- or XEN-based Virtual Private Server (VPS).

It can also be used as the Amazon EC2 "user-data" with the official CentOS 7 AMI. Note that the official CentOS 6 AMI does NOT come with cloud-init, so you need to run this script manually after instance creation.

Alternative VPN script for Ubuntu/Debian
Original post by Thomas Sarlandie

@ChaosJohn
ChaosJohn / freebsd-java.md
Created October 9, 2015 04:16 — forked from nathggns/freebsd-java.md
Installing java on FreeBSD

Before installing this JRE, you have to install the linux binary compatibility on FreeBSD, you can follow this documentation. Jave requires some information about the proc. You have to mount linprocfs, type:

kldload linprocfs
mount -t linprocfs linprocfs /compat/linux/proc

and add this line to /etc/fstab:

linprocfs   /compat/linux/proc   linprocfs   rw   0  0
@ChaosJohn
ChaosJohn / Install Cloud9 on local or remote computer, server, or raspberry pi This gist will help you install Cloud9 on your local or remote computer, server, or even your raspberry pi. Many people are having issues at the time of this Gist's creation.
Complete installation process:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y python-software-properties python make build-essential g++ curl libssl-dev apache2-utils git libxml2-dev
sudo apt-get update
sudo apt-get upgrade
cd ~
mkdir git
cd ~/git
package com.az.custom.request;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
@ChaosJohn
ChaosJohn / VideoTextureView
Created November 13, 2015 11:21 — forked from garymabin/VideoTextureView
Ijkplayer video container based on TextureView
/*
* Copyright (C) 2006 The Android Open Source Project
* Copyright (C) 2012 YIXIA.COM
* Copyright (C) 2013 Zhang Rui <bbcallen@gmail.com>
* Licensed 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
@ChaosJohn
ChaosJohn / README.md
Created November 20, 2015 03:27 — forked from jnovack/README.md
Opening up mosh in firewalld using firewall-cmd

Mosh (mobile shell) is a gift from the Gods(tm). Anyone with spotty internet or wireless connection has suffered the pain of a lost SSH session. Sure, one can fire up screen (or tmux as the kids are using these days), but that's an extra step and you are still using the SSH protocol.

I'm not here to tout the benefits of Mosh, you came here to open it up in your firewall.

  1. Create the following file as /etc/firewalld/services/mosh.xml
  2. firewall-cmd --reload
  3. firewall-cmd --add-service=mosh --permanent

If you tend to have a lot of sessions (not recommended), you can increase the ports, but the default should be fine for most applications.

@ChaosJohn
ChaosJohn / Info.plist
Created December 10, 2015 02:22 — forked from aruld/Info.plist
To run Intellij 14.1 with latest JDK 9 on OS X Yosemite, edit /Applications/IntelliJ\ IDEA\ 14.app/Contents/Info.plist and set JVMVersion to 1.8 under JVM Options.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>