Skip to content

Instantly share code, notes, and snippets.

View LucasRoesler's full-sized avatar

Lucas Roesler LucasRoesler

View GitHub Profile

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

#!/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
  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
  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 February 17, 2019 18:22 — forked from burtonr/of-kind.sh
OpenFaaS on KinD quickstart
#!/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 February 11, 2019 13:56
read docker logs directly from the socket
#!/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
@LucasRoesler
LucasRoesler / of-concurrency-tester.sh
Created February 1, 2019 09:45
Deploy the experimental of-gateway with ingress and basic auth, then run load tests using hey
#!/usr/bin/env bash
GATEWAY=of.dev.contiamo.io
PASSWORD=$(head -c 12 /dev/urandom | shasum| cut -d' ' -f1)
mkdir -p $HOME/Code
cat > "$HOME/Code/of-concurrency-test2.yaml" <<- EndOfMessage
basic_auth: true
functionNamespace: openfaas-fn
exposeServices: false
ingress:
@LucasRoesler
LucasRoesler / slack-night-mode.css
Created January 21, 2019 08:59
dark mode for slack
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
@LucasRoesler
LucasRoesler / job.yaml
Created July 19, 2018 14:54 — forked from alexellis/job.yaml
Use a Kubernetes Job and Kaniko to build an OpenFaaS function from Git
# Alex Ellis 2018
# Example from: https://blog.alexellis.io/quick-look-at-google-kaniko/
# Pre-steps:
# kubectl create secret generic docker-config --from-file $HOME/.docker/config.json
# Other potential optimizations (suggested by @errordeveloper)
# - Store "templates" in a permanent volume
# - Download source via "tar" instead of git clone
openapi: 3.0.0
info:
title: Contiamo Labs Server API
description: >-
The labs server API describes a REST-ful interface for interacting with labs
server. This includes the creation and editing of bundles and the
deployment of bundle functions.
version: 0.0.1
contact:
name: Contiamo