Skip to content

Instantly share code, notes, and snippets.

View jbrisbin's full-sized avatar

Jon Brisbin jbrisbin

View GitHub Profile
@jbrisbin
jbrisbin / MyCustomResourceController.java
Last active March 15, 2019 21:59
Sketch of Fabric8 Quarkus extension pattern
@ApplicationScoped
@CustomResourceController(MyCustomResource.class)
public class MyCustomResourceController {
@Inject
NamespacedKubernetesClient client;
@Inject
CustomResourceDefinition crd;
@Inject
CustomResourceClient<MyCustomResource> myCustomResources;
@jbrisbin
jbrisbin / kubectl.log
Created March 13, 2019 22:41
Errors encountered deploying fabric8 QuarkusIO app
WARNING: The sunec native library, required by the SunEC provider, could not be loaded. This library is usually shipped as part of the JDK and can be found under <JAVA_HOME>/jre/lib/<platform>/libsunec.so. It is loaded at run time via System.loadLibrary("sunec"), the first time services from SunEC are accessed. To use this provider's services the java.library.path system property needs to be set accordingly to point to a location that contains libsunec.so. Note that if java.library.path is not set it defaults to the current working directory.
2019-03-13 22:29:41,054 INFO [com.ins.age.kub.ope.cli.InstanaKubernetesClient] (main) onStartup(): {}
io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.inNamespace(BaseOperation.java:310)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.inAnyNamespace(BaseOperation.java:316)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.inAnyNamespace(BaseOperation.java:68)
at com.inst
@jbrisbin
jbrisbin / kubectl.sh
Created October 28, 2017 19:55
BASH completion for kubectl
#!/bin/bash
KUBE_COMPLETE_COMMANDS=$(kubectl | egrep '^ ([a-z]*)' | awk '{print $1}')
_get_root_cmds() {
kubectl | egrep '^ ([a-z]*)' | awk '{print $1}'
}
_get_root_opts() {
echo $(kubectl options | egrep '\-[a-z][A-Z]*' | awk -F: '{print $1}' | awk -F= '{print $1}') | tr -d ,
@jbrisbin
jbrisbin / get_proc.sh
Created September 21, 2017 18:39
BASH script to get a procfile from a Docker container for a given process
#!/bin/bash
PROCESS=$1
PROC_FILE=${2:-status}
CONTAINERS=$(docker ps -q)
for c in $CONTAINERS; do
PIDS=$(docker exec $c ps ax | egrep $PROCESS | egrep -v grep | awk '{print $1}')
if [[ ! -z "$PIDS" ]]; then
echo "==== $c"
@jbrisbin
jbrisbin / README.md
Last active October 14, 2020 21:51
Makefile to build an Elixir mix-based project into a reusable Docker image

Elixir Mix-based Docker Image

This bit of Makefile can be included into your make-based build system for creating a Docker image out of an Elixir project that's built with mix. It mounts the current directory into a Docker container at /usr/src/$APP_NAME (where APP_NAME is either the working directory name or can be overridden), performs a mix release, then copies the resultant rel to /opt/$APP_NAME. The base image is modified to add WORKDIR /opt/$APP_NAME and set the ENTRYPOINT of the image to be /opt/$APP_NAME/bin/$APP_NAME foreground.

Usage

@jbrisbin
jbrisbin / riak-kv.yml
Last active November 25, 2020 10:46
Example docker-compose files for Riak KV and TS
version: "2"
services:
coordinator:
image: basho/riak-kv
ports:
- "8087"
- "8098"
environment:
- CLUSTER_NAME=riakkv
labels:
@jbrisbin
jbrisbin / Makefile
Created August 26, 2016 14:23
Makefile to build multiple build-essential images from a single set
BUILD_BASE ?= y
UPGRADE ?= y
DOCKER ?= y
FPM ?= y
JAVA ?= y
FROM ?= ubuntu:14.04
MAINTAINER = Jon Brisbin <jbrisbin@basho.com>
OS_FAMILY = $(shell echo "$(FROM)" | cut -d: -f1)
@jbrisbin
jbrisbin / connect-slave.sh
Created August 25, 2016 18:07
Automatic boostrapping of Mesos slaves in Jenkins
#!/bin/bash
curl -sSL -XPOST -H "Content-Type: application/json" -d @- "http://marathon.mesos:8080/v2/apps" <<END
{
"id": "/jenkins/build/$3",
"cpus": 1,
"mem": 8192,
"instances": 1,
"cmd": "java -jar slave.jar -jnlpUrl http://$1/jenkins/computer/$3/slave-agent.jnlp -secret $4",
"constraints": [["hostname", "CLUSTER", "$2"]],
"uris": [
@jbrisbin
jbrisbin / mesos-inventory.py
Created August 25, 2016 18:01
Ansible dynamic inventory script that finds out what slaves are available in the current Mesos cluster. Assumes mesos-dns.
#!/usr/bin/env python
import argparse
import os
import sys
import re
import urllib2
try:
import json
@jbrisbin
jbrisbin / docker-compose.yml
Created June 15, 2016 22:32
Riak TS cluster creation with Docker Compose
version: "2"
services:
primary:
hostname: primary
image: basho/riak-ts
ports:
- "8087"
- "8098"
secondary:
image: basho/riak-ts