First of all be root while doing this... sudo su
Set the hostname:
hostnamectl set-hostname 'k8s-master'
These instructions work for the Raspberry Pi running Raspbian (hard float) and create a hardware optimized version of NodeJS for the Raspberry PI, (and include a working install and NPM!!!):
Install Raspbian - http://www.raspberrypi.org/downloads
Install the necessary dependecies:
sudo apt-get install git-core build-essential
(If you just installed git then you need to administer your git identity first, else adding the patches below will fail!!!)
Adapted from the forked gist and this blog. Adjusted to our own implementation.
The provided file should work with systemd version 219 or later. It might work with earlier versions.
The easiest way to check your systemd version is to run systemctl --version
.
# | |
# This needs to be installed here: | |
# /etc/systemd/system/consul.service | |
# | |
[Unit] | |
Description=consul | |
Requires=network-online.target | |
After=network-online.target |
Install first for ubuntu:
sudo apt-get install build-essential libssl-dev curl git-core
Compile the required node version and put in global reach:
# install nodejs from Github (replace 0.8.9 with required version)
git clone git://github.com/joyent/node.git node0.8.9
var cluster = require('cluster'); | |
var util = require('util'); | |
var http = require('http'); | |
var numCPUs = 2; //require('os').cpus().length; | |
// | |
// general functions | |
// | |
function isRoot() { | |
return process.getuid() == 0; |
var https = require('https'), | |
fs = require('fs'); | |
var options = { | |
key: fs.readFileSync('./ssl/privatekey.pem'), | |
cert: fs.readFileSync('./ssl/certificate.pem'), | |
requestCert: true | |
}; | |
https.createServer(options, function (req, res) { |
parse_git_branch() { | |
ref=$(git symbolic-ref -q HEAD 2> /dev/null) || return | |
printf "${1:-(%s)}" "${ref#refs/heads/}" | |
} | |
pimp_prompt() { | |
local BLUE="\[\033[0;34m\]" | |
local BLUE_BOLD="\[\033[1;34m\]" | |
local RED="\[\033[0;31m\]" | |
local LIGHT_RED="\[\033[1;31m\]" |
The best approach is to create an IPv6 server socket that can also accept IPv4 connections. To do so, create a regular IPv6 socket, turn off the socket option IPV6_V6ONLY, bind it to the "any" address, and start receiving. IPv4 addresses will be presented as IPv6 addresses, in the IPv4-mapped format.
The major difference across systems is whether IPV6_V6ONLY is a) available, and b) turned on or off by default. It is turned off by default on Linux (i.e. allowing dual-stack sockets without setsockopt), and is turned on on most other systems.
In addition, the IPv6 stack on Windows XP doesn't support that option. In these cases, you will need to create two separate server sockets, and place them into select or into multiple threads.
Found on: http://stackoverflow.com/questions/1618240/how-to-support-both-ipv4-and-ipv6-connections
function hasOwnProperty(key) { | |
if(this[key]) { | |
var proto = this.prototype; | |
if(proto) { | |
return ((key in this.prototype) && (this[key] === this.prototype[key])); | |
} | |
return true; | |
} else { | |
return false; | |
} |