Skip to content

Instantly share code, notes, and snippets.

@shantanoo-desai
shantanoo-desai / README.md
Last active February 20, 2023 20:13
tiguitto (Telegraf, InfluxDBv1.x, Grafana, Mosquitto) stack with Traefik v2.3 reverse proxy using docker

tiguitto Stack with Traefik v2.3 as reverse-proxy

  • Tested on Raspberry-Pi 4 Model B 2GB RAM
  • Docker Version: 19.03.8
  • Docker-Compose version: 1.25.5

Directory structure:

 .
# find merge-request which contains commit in GitLab
# https://gitlab.com/gitlab-org/gitlab-foss/-/issues/28037
# https://stackoverflow.com/a/17819027/7277090
git config --add remote.origin.fetch '+refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*'
git fetch origin
git for-each-ref --contains <hash> | grep merge-requests | head -n 10
@wenerme
wenerme / k3s-new-cert.sh
Created July 12, 2020 06:12
K3S Create Client Cert
#!/bin/bash
set -e
fail(){
echo "error: $*"
echo "usage: ./k3s-new-cert <name> [subject=/O=admin]"
exit 1
}
@houstondapaz
houstondapaz / ingres.yaml
Created June 19, 2020 13:55
ingress nginx configuration snippet
nginx.ingress.kubernetes.io/configuration-snippet: |
more_set_headers "Server:SEU_SERVER";
more_set_headers "cache-Control: no-cache, no-store";
more_set_headers "pragma: no-cache";
if ($request_uri ~* \.(?:ico|css|js|gif|jpe?g|png|svg|woff2|woff|ttf|eo|mp3)$) {
more_set_headers "cache-control: public, must-revalidate, proxy-revalidate";
more_set_headers "pragma: public";
expires max;
}
rewrite ^/SUB_PATH(/?)(.*)$ /$2 break;
function gen_ssl_cert {
local prefix="${1}"
openssl genrsa -des3 -out "${prefix}.lock.key" 1024
openssl rsa -in "${prefix}.lock.key" -out "${prefix}.key"
rm "${prefix}.lock.key"
openssl req -new -key "${prefix}.key" -out "${prefix}.csr"
openssl x509 -req -days 3650 -in "${prefix}.csr" -signkey "${prefix}.key" -out "${prefix}.crt"
openssl pkcs12 -export -inkey "${prefix}.key" -in "${prefix}.crt" -out "${prefix}.pfx"
- etcd
- load balancing
- availability
- auto-scaling
- networking
- roll-back on faulty deployments
- persistent storage
- upgrading nodes
- removing nodes
- adding nodes
DOCKER
======
./create_partycrasher_zip.sh
docker build -t partycrasher .
-- docker run gunicorn with local ES
docker run -e ELASTICSEARCH_ALLOW_DELETE_ALL=true -e ELASTICSEARCH_CREATE_INDEXES=true -e ELASTICSEARCH_HOSTS=host.docker.internal -e ELASTICSEARCH_PORT=9200 -e ELASTICSEARCH_REST_HTTP_SCHEME=http -e ELASTICSEARCH_REST_SIGN_REQUESTS_ENABLED=false -e PARTYCRASHER_LOGGER_LEVEL=DEBUG -it --rm -p 8080:8080 --name partycrasher partycrasher
@zthxxx
zthxxx / .gitattributes
Last active November 8, 2020 07:50
auto ignore console.log at git diff or stage
# .gitattributes or .git/info/attributes
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreattributesFile
*.[jt]s filter=ignoreLogStage
*.[jt]sx filter=ignoreLogStage
@mhausenblas
mhausenblas / README.md
Last active January 25, 2023 15:14
Fluent Bit log forwarding to CloudWatch

Set Up Fluent Bit as a DaemonSet to Send Logs to CloudWatch

Create a new 1.13 or 1.14 EKS cluster called container-insights.

Enable IRSA:

eksctl utils associate-iam-oidc-provider \
               --name container-insights \
               --approve
@mhausenblas
mhausenblas / load-gen-ecs.sh
Created July 9, 2019 14:02
Load generator scripts for NGINX services in ECS and EKS
#!/bin/bash
################################################################################
# Generate load for the NGINXs services in ECS
nginxurls=$(ecs-cli ps --desired-status RUNNING | grep nginx | awk '{ split($3, url, "-") ; print(url[1]) }')
while true
do
printf "Hit "
for nginxurl in $nginxurls