Skip to content

Instantly share code, notes, and snippets.

Lucas Roesler LucasRoesler

Block or report user

Report or block LucasRoesler

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@LucasRoesler
LucasRoesler / kind-faas-netes-certification.md
Created Jul 28, 2019
Running OpenFaaS Certifier for faas-netes in KinD
View kind-faas-netes-certification.md
  1. Start the KinD env and disable auth. In the faas-netes project
make start-kind
export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"

helm upgrade openfaas --install ./chart/openfaas \
    --namespace openfaas  \
    --set basic_auth=false \
    --set openfaasImagePullPolicy=IfNotPresent \
View git-pr.sh
#!/usr/bin/env bash
# reset environment variables that could interfere with normal usage
export GREP_OPTIONS=
# put all utility functions here
# make a temporary file
git_extra_mktemp() {
mktemp -t "$(basename "$0")".XXX
}
@LucasRoesler
LucasRoesler / graceful_servers.go
Last active May 10, 2019
Two possible call signatures for gracefully starting and ending the health server
View graceful_servers.go
// ListenAndServeMonitoring starts up an HTTP server serving /metrics and /health.
//
// When the context is cancelled, the server will be gracefully shutdown.
func ListenAndServeMonitoring(ctx context.Context, addr string, healthHandler http.Handler) error {
srv := monitoringServer(addr, healthHandler)
go func() {
<-ctx.Done()
shutdownContext, cancel := context.WithTimeout(context.Background(), 1*time.Second)
defer cancel()
@LucasRoesler
LucasRoesler / dev-openfaas-env.sh
Last active Aug 17, 2019
Create a new dev environment using KinD and immediately forward the Gateway port
View dev-openfaas-env.sh
#!/bin/bash
DEVENV=${1:-devopenfaas}
kind create cluster --name "$DEVENV"
export KUBECONFIG="$(kind get kubeconfig-path --name="$DEVENV")"
kubectl rollout status deploy coredns --watch -n kube-system
# INSTALLING HELM
View tmux_cheatsheet.markdown

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

View openfaas-logs-k8s-test-install.sh
#!/usr/bin/env bash
echo "[0] Install the OF namespaces"
kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml
echo "[1] Setup basic auth"
kubectl -n openfaas create secret generic basic-auth \
--from-literal=basic-auth-user=admin \
--from-literal=basic-auth-password="tester"
echo "[2] update helm chart cache"
helm repo update
View openfaas-logs-walkthrough.md
  1. Install openfaas using these images
  • Replace the gateway with theaxer/gateway:loggerhandler
  • Replace your provider with theaxer/faas-netes:loggerhandler or theaxer/swarm:loggerhandler

Export the base url to your gateway, e.g.

export gateway=http://localhost:31112
View k8s-log-provider-walkthrough.md
  1. install openfaas with my fork
kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml
helm upgrade openfaas --install openfaas/openfaas \
    --namespace openfaas  \
    --set basic_auth=true \
    --set faasnetesd.image=theaxer/faas-netes:logger \
    --set faasnetesd.imagePullPolicy=IfNotPresent \
@LucasRoesler
LucasRoesler / of-kind.sh
Created Feb 17, 2019 — forked from burtonr/of-kind.sh
OpenFaaS on KinD quickstart
View of-kind.sh
#!/bin/bash
echo "> Be KinD with OpenFaaS"
# First, check if docker is available
docker version | 2>/dev/null
if [ $? -ne 0 ]; then
echo "> Docker is required for running OpenFaaS on KinD"
echo "> Install with: 'curl -sLS https://get.docker.com | sudo sh'"
@LucasRoesler
LucasRoesler / raw-docker-logs.sh
Created Feb 11, 2019
read docker logs directly from the socket
View raw-docker-logs.sh
#!/bin/bash
NAME=go-echo
curl -sN --unix-socket /var/run/docker.sock \
http://./services/$NAME/logs\?tail\=5\&stdout\=1\&stderr\=1\&timestamps\=1\&details\=1
You can’t perform that action at this time.