Skip to content

Instantly share code, notes, and snippets.

View DrPsychick's full-sized avatar
🤔

DrPsychick DrPsychick

🤔
View GitHub Profile
@DrPsychick
DrPsychick / docker-compose.yml
Last active August 17, 2020 21:03
Example to run telegraf, influxdb, grafana locally in docker
# using version 2 because of https://docs.docker.com/compose/compose-file/#resources
version: "2.4"
services:
telegraf:
image: drpsychick/telegraf
restart: always
environment:
HOST_PROC: /rootfs/proc
HOST_SYS: /rootfs/sys
HOST_ETC: /rootfs/etc
@DrPsychick
DrPsychick / docker-compose-keycloak.yml
Created August 20, 2020 18:36
Demo keycloak docker-compose
# source: https://github.com/keycloak/keycloak-containers/tree/master/docker-compose-examples
version: '3'
volumes:
postgres_data:
driver: local
services:
postgres:
image: postgres
@DrPsychick
DrPsychick / telegraf.conf
Created August 28, 2020 17:06
Telegraf Windows Performance Counters configuration
# Windows Performance Counters plugin.
# These are the recommended method of monitoring system metrics on windows,
# as the regular system plugins (inputs.cpu, inputs.mem, etc.) rely on WMI,
# which utilize more system resources.
#
# See more configuration examples at:
# https://github.com/influxdata/telegraf/tree/master/plugins/inputs/win_perf_counters
# If metrics are missing run `lodctr /r` as Administrator
[[inputs.win_perf_counters]]
@DrPsychick
DrPsychick / git-funcs.sh
Last active April 19, 2021 20:02
Simple bash functions to automate GitHub branches and pull requests
#!/bin/bash
# Workflow: create branch -> create pull request
# git-create-branch-push "issue X"
# -> make changes, commit and push
# github-branch-pr "fix: issue solved" "closes #x"
# -> creates new PR with title and body
#
# Workflow: create branch for issue -> create pull request
# github-issue-branch-push 10
@DrPsychick
DrPsychick / update_cert.sh
Last active December 29, 2020 13:52
Update `kind` node IPs in configuration
#!/bin/bash
set -e
# updates the API certificate with new DNSs and IPs
# 1. fetch CA + existing cert
# 2. extract AltNames and update AltNames
# 3. create new cert
# 4. upload and use it in API pod
if [ -z "$1" ]; then
#!/bin/bash
set -e
# update IP addresses in configs in k8s and on kind master node
# * this is ugly, but the only way to avoid recreating the cluster after restart
export PATH=$PATH:/usr/local/bin
if [ -z "$1" ]; then
echo "Usage: $0 <kind-cluster-name>"
exit 1
@DrPsychick
DrPsychick / backup-restore-certificates.sh
Created December 30, 2020 23:38
backup and restore certificates of your kubernetes cluster to avoid running into letsencrypt issuing limits
#!/bin/bash
if [ -z "$1" -o -z "$2" ]; then
echo "Usage: $0 backup|restore <cluster-name> [certificates.yml]"
exit 1
fi
kube_context="kind-$2"
secrets="$3"
if [ "$1" == "backup" ]; then
@DrPsychick
DrPsychick / k8s-instance-funcs.sh
Last active April 19, 2021 17:36
Generic shell functions for common k8s commands
## some generic functions based on `app.kubernetes.io/instance` label
# list pods including instance label
function k8s.pod() {
kubectl get pod -L app.kubernetes.io/instance
}
# list deployments including instance label
function k8s.deployment() {
kubectl get deployment -L app.kubernetes.io/instance
@DrPsychick
DrPsychick / gitlab-local.md
Last active February 2, 2024 08:18
Run gitlab-ci jobs locally

Run/Test GitLab CI Pipeline jobs locally

  • cd into your project directory

Hints

@DrPsychick
DrPsychick / ubuntu-base.pkr.hcl
Last active November 13, 2022 00:08
Packer build for Ubuntu Server ISO
variables {
iso_url = ""
iso_checksum = "sha256:"
build_dir = "/data/images/build"
build_name = "ubuntu2204"
output_dir = "/data/images/output"
image_name = "ubuntu2204-base"
http_dir = "packer/linux/base/cloudinit/ubuntu2204-autoinstall"
}