Skip to content

Instantly share code, notes, and snippets.

@Shogan
Shogan / run.sh
Created Nov 25, 2020
docker-compose as a docker container on any arch, including ARM
View run.sh
#!/bin/sh
#
# Forked from https://raw.githubusercontent.com/linuxserver/docker-docker-compose/master/run.sh
#
# Run docker-compose in a container
#
# This script will attempt to mirror the host paths by using volumes for the
# following paths:
# * $(pwd)
# * $(dirname $COMPOSE_FILE) if it's set
@Shogan
Shogan / docker-compose.yml
Last active Nov 29, 2020
Example docker-compose services to run on ARM Graviton2 based instances under Docker with Traefik v2 routing. See https://www.shogan.co.uk/how-tos/minimal-cost-web-hosting-with-spot-graviton2-efs-traefik-lets-encrypt/ for more info.
View docker-compose.yml
version: "3"
networks:
web:
external: true
internal:
external: false
services:
blog:
@Shogan
Shogan / example-traefik-dynamic.toml
Created Nov 21, 2020
an example of a traefik dynamic toml configuration
View example-traefik-dynamic.toml
[http.middlewares.simpleAuth.basicAuth]
users = [
"YourUsername:$apr1$bJDZ0TQm$IBSNb2xcRsYrIdcJxNG1h."
]
[http.routers.api]
rule = "Host(`dashboard.example.com`)"
entrypoints = ["websecure"]
middlewares = ["simpleAuth"]
service = "api@internal"
View traefik-le-staging-template.toml
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.http.redirections.entryPoint]
to = "websecure"
scheme = "https"
[entryPoints.websecure]
address = ":443"
View velero-aws-s3-prereqs.sh
BUCKET=your-backup-bucket-name-here
REGION=eu-west-2
aws iam create-user --user-name velero
cat > velero-policy.json <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
@Shogan
Shogan / codebuild_build.sh
Created Jun 21, 2020
AWS CodeBuild local docker build launch and configure
View codebuild_build.sh
#!/bin/bash
function allOSRealPath() {
if isOSWindows
then
path=""
case $1 in
.* ) path="$PWD/${1#./}" ;;
/* ) path="$1" ;;
* ) path="/$1" ;;
@Shogan
Shogan / install-k8s-pi-components.sh
Created Dec 8, 2019
install kubernetes components for rpi
View install-k8s-pi-components.sh
sudo tee /etc/apt/sources.list.d/kubernetes.list &>/dev/null <<EOF
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update
# Pin / install specific versions of the following components
sudo apt-get install -qy kubelet=1.16.2-00 kubectl=1.16.2-00 kubeadm=1.16.2-00 kubernetes-cni=0.7.5-00
@Shogan
Shogan / metallb.yaml
Created Dec 7, 2019
MetalLB kubernetes resources manifest for raspberry pi cluster
View metallb.yaml
apiVersion: v1
kind: Namespace
metadata:
labels:
app: metallb
name: metallb-system
---
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
@Shogan
Shogan / dnsmasq.conf
Created Nov 17, 2019
Creates a dnsmasq.conf configuration file
View dnsmasq.conf
sudo tee /etc/dnsmasq.conf &>/dev/null <<EOF
# Our DHCP service will be providing addresses over our eth0 adapter
interface=eth0
# We will listen on the static IP address we declared earlier
listen-address=10.0.0.1
# Pre-allocate a bunch of IPs on the 10.0.0.0/8 network for the Raspberry Pi nodes
# DHCP will allocate these for 12 hour leases, but will always assign the same IPs to the same Raspberry Pi
# devices, as you'll populate the MAC addresses below with those of your actual Pi ethernet interfaces
@Shogan
Shogan / tcpdump-cmds.md
Created Sep 15, 2019
tcpdump useful commands
View tcpdump-cmds.md

Some useful tcpdump commands

Listen on all interfaces (any) for traffic on port 8080:

tcpdump -vv -x -X -i any 'port 8080'

Listen on eth0 interface for all traffic:

tcpdump -vv -x -X -i eth0