Skip to content

Instantly share code, notes, and snippets.

View jbrisbin's full-sized avatar

Jon Brisbin jbrisbin

View GitHub Profile
@jbrisbin
jbrisbin / DeclarativeBuildTest.scala
Last active June 9, 2016 13:38
Example of Declarative configuration of build/test orchestration
axes "os" -> Seq("ubuntu-14.04", "centos-7"),
"mesos" -> Seq("0.26.1", "0.28.1")
s"Build ${build.name}" should {
"Compile native" in s"build-essential:$os" {
tags "parallel", "native", "required"
make "clean", "package"
mv "packages/**/*.tgz" to s"artifactory/${build.name}"
@jbrisbin
jbrisbin / Dockerfile
Last active May 19, 2016 19:01
Dockerfile for creating an Alpine-based image for accessing Riak Time Series via the Python client
FROM alpine
MAINTAINER Jon Brisbin <jbrisbin@basho.com>
RUN \
apk add --update python py-six py-setuptools curl unzip
RUN \
cd /usr/lib/python2.7/site-packages && \
curl -sSLO https://pypi.python.org/packages/2.7/r/riak/riak-2.4.2-py2.7.egg && \
curl -sSLO https://pypi.python.org/packages/2.7/p/protobuf/protobuf-2.6.1-py2.7.egg && \
unzip -o riak-2.4.2-py2.7.egg && \
@jbrisbin
jbrisbin / config.json
Last active June 2, 2016 19:55
Riak Mesos Framework example config file
{
"riak": {
"framework-name": "riak",
"hostname": "riak.marathon.mesos",
"marathon": "marathon.mesos:8080",
"master": "leader.mesos:5050",
"zk": "leader.mesos:2181",
"user": "root",
"role": "riak",
"auth-principal": "riak",
@jbrisbin
jbrisbin / riak-ts-cluster.sh
Last active May 9, 2016 18:20
Start and stop a 5-node Riak TS cluster using the Docker image
#!/bin/bash
eval $(docker-machine env --shell=bash)
eval $(weave env)
CLUSTER_NAME=${2:-dev}
WEAVE=`which weave`
if [ "" == "$WEAVE" ]; then
LINK="--link ${CLUSTER_NAME}1"
fi
#!/bin/bash
curl -sS master.mesos:5050/slaves/json | jq -r '.slaves[] | .hostname' >inventory.txt
$ dcos --log-level=DEBUG package install --app --options=config.json --yes riak
The Mesos Riak Framework implementation is an experimental beta and there may be bugs, incomplete features, incorrect documentation or other discrepancies. The Riak framework should have at least 2GB of RAM and 0.5 CPUs to perform successfully.
2016-04-01 21:50:29,621 /usr/lib/python2.7/site-packages/dcos/package.py:options:1282 - Generated default options: {u'riak': {u'node': {u'url': u'http://riak-tools.s3.amazonaws.com/riak/2.1/2.1.3/ubuntu/trusty/riak-2.1.3-amd64.tar.gz', u'mem': 8000.0, u'disk': 20000.0, u'patches-url': u'http://riak-tools.s3.amazonaws.com/riak_explorer/0.1/0.1.2.patch/ubuntu/trusty/riak_explorer-0.1.2.patch-amd64.tar.gz', u'cpus': 1.0}, u'auth-secret-file': u'', u'healthcheck-timeout-seconds': 20, u'constraints': [], u'zk': u'leader.mesos:2181', u'auth-principal': u'', u'framework-name': u'riak', u'hostname': u'riak.mesos', u'auth-provider': u'', u'director': {u'url': u'http://riak-tools.s3.amazonaws.com/ria
ENV FROM_A_GIST hello
// case classes should be used instead of builders.
// Query is a case class that has all the appropriate parameters on it.
val query = Query("select * from ...")
case class LondonAirQuality(family:String, series:String, measurementDate:Long)
// Use standard Scala Try match/case semantics for execute
val jsonResult = Try(client.execute(query)) {
case Success(result) => {
// Result is natively iterable and can be mapped to another collection using Scala collections APIs
2016-01-15 10:36:32
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.60-b23 mixed mode):
"RMI TCP Connection(3)-192.168.99.1" #99 daemon prio=9 os_prio=31 tid=0x00007fc402bc0000 nid=0xb507 runnable [0x00007000042db000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
reactor.core.support.Exceptions$ValueCause: Exception while signaling value: java.util.LinkedHashMap.class : {@SpeciesCode=CO, @SpeciesName=Carbon Monoxide, @Description=Carbon Monoxide is a colourless, odourless poisonous gas produced by incomplete, or inefficient, combustion of fuel including 'cold' or badly tuned engines., @HealthEffect=The gas affects the transport of oxygen around the body by the blood. At very high levels, this can lead to a significant reduction in the supply of oxygen to the heart, particularly in people suffering from heart disease., @Link=http://www.londonair.org.uk/LondonAir/guide/WhatIsCO.aspx}
at reactor.core.support.Exceptions.addValueAsLastCause(Exceptions.java:127) ~[reactor-core-2.0.5.RELEASE.jar:na]
at reactor.rx.action.Action.onNext(Action.java:206) [reactor-stream-2.0.5.RELEASE.jar:na]
... 83 common frames omitted
Wrapped by: java.lang.IllegalStateException: Peer already started
at reactor.io.net.ReactorPeer.start(ReactorPeer.java:71) ~[reactor-net-2.0.5.RELEASE.jar:na