Skip to content

Instantly share code, notes, and snippets.

View ahjohannessen's full-sized avatar

Alex Henning Johannessen ahjohannessen

View GitHub Profile
@ahjohannessen
ahjohannessen / Flowz.scala
Last active August 29, 2015 14:27 — forked from DomBlack/Flowz.scala
Generic Akka stream operations for carrying extra information around operations
import akka.stream.scaladsl.Flow
import scala.concurrent.{ ExecutionContext, Future }
import scalaz._
import scalaz.std.scalaFuture.futureInstance // IntelliJ lies
/**
* Flowz provides Akka Stream Flow like methods for monadic types.
*
* You can define the `M` type and the input type, and let the compiler infer the output
#!/usr/bin/env bash
projections=(
"by_category"
"by_event_type"
"stream_by_category"
"streams"
"users"
)
// This should work with Scala 2.10.4 & scalaz 7.1, core, effect and concurrent packages
import scalaz.{ concurrent, Free, Functor, Monad, syntax }
import concurrent.Task
import Free.{freeMonad => _, _}
import syntax.monad._
// Describe the set of actions - which are functors
sealed trait RedisF[+A] {
def map[B](fn: A => B): RedisF[B]
#cloud-config
coreos:
update:
reboot-strategy: off
units:
-
name: custom-reboot.service
runtime: true
content: |

Easy Kubernetes Installation on CoreOS

At Timeline Labs, we are continuously looking at new technologies to see what fits our needs. We are especially excited about Kubernetes from Google to manage our services atop Docker and CoreOS.

This process for installing Kubernetes on CoreOS uses Flannel for Kubernetes networking and should be cloud provider agnostic. To deploy the Kubernetes master functionality into the cluster, it uses fleetctl.

Thanks to Kelsey Hightower and his blog posts! They served as a great starting point for this process.

How do I get this running?

Add the cloud config below to your own and bring up your cluster. Once you can fleetctl list-machines, go ahead and fleetctl start the three Kubernetes master units in the fleet section below. At this point, you can ssh to the machine where the Kubernetes master units deployed,

# install latest docker
wget --no-check-certificate https://get.docker.io/builds/Linux/x86_64/docker-latest -O docker
chmod +x docker
# systemd for the new docker
sudo tee /media/state/units/docker-local.service > /dev/null <<EOF
[Unit]
Description=docker local
[Service]
$packages = [ 'curl', 'terminator', 'jdk7-openjdk', 'chromium', 'virtualbox', 'git', 'zsh', 'networkmanager', 'network-manager-applet', 'ttf-dejavu', 'arandr',
'openssh', 'nm-applet', 'xscreensaver', 'volwheel' ]
$yaourtPackages = [ 'vagrant', 'sublime-text', 'dropbox', 'oh-my-zsh-git', 'intellij-idea-13-community', 'kalu' ]
$services = [ 'NetworkManager' ]
$stoppedServices = [ 'netctl' ]
package { $packages:
#!/bin/bash
# An alternative to "links", run this script after starting or stopping any
# container. It's a hack to update the host machine (vagrant) /etc/hosts with
# the current active docker containers and tell dnsmasq to refresh.
#
# Then start each machine with "-dns ${DOCKER_HOST_IP}", e.g.
# $ docker run -d -name mycontainer1 -dns 10.0.3.1 MYPRODUCT
# You can't seem to set the DNS during "docker build".
#
# Diagnostic command to run in host or while logged into containers:
#Download Elementary OS from here:
#http://sourceforge.net/projects/elementaryos/files/stable/
#First you update your system
sudo apt-get update && sudo apt-get dist-upgrade
#Clean-up System
sudo apt-get purge noise
sudo apt-get purge software-center
sudo apt-get purge scratch-text-editor
#don't send the nginx version number in error pages and Server header
server_tokens off;
# config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
# to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_stripping
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
# config to don't allow the browser to render the page inside an frame or iframe
# and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking
# if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri