Skip to content

Instantly share code, notes, and snippets.

View rjchicago's full-sized avatar
💭
🐳 🚢 🏗️

Ryan Jones rjchicago

💭
🐳 🚢 🏗️
View GitHub Profile
@rjchicago
rjchicago / htop.sh
Created May 24, 2021 18:48
Run HTOP on any host running Docker.
docker run --rm -it --pid host frapsoft/htop
# sort by CPU: Shift + P
# sort by Memory: Shift + M
# collapse threads: Shift + H
@rjchicago
rjchicago / kzdt.sh
Last active May 24, 2021 18:44
Kill Zombie Docker Tasks (based on https://hub.docker.com/r/dperny/tasknuke)
#!/bin/sh
SERVICES=$(docker service ls --format '{{print .Name}}')
for SERVICE in $SERVICES; do
IDS=$(docker service ps $SERVICE -f "desired-state=shutdown" | grep Running | awk '{print $1;}')
if [ -n "$IDS" ]; then
echo $SERVICE
fi
for ID in $IDS; do
TASK=$(docker inspect $ID | sed -n 's/.*\"ID\": \"\(.*\)\".*/\1/p' | awsk '{print $1; exit}')
docker run --rm -v /var/run/docker/swarm/control.sock:/var/run/swarmd.sock dperny/tasknuke $TASK | sed 's/^/ - /'
@rjchicago
rjchicago / docker-image-errors.sh
Last active May 24, 2021 18:44
We've encountered errors where either we hit the Docker Hub rate limit, or an image tag has been overwritten and therefor SHA's do not match. This script will loop through images currently in use and attempt a Docker pull and print out any errors.
# loop through services and get names
for SERVICE in $(docker service ls --format "{{.Name}}"); do
# get the full image:tag@sha used by the service
IMAGE=$(docker service inspect $SERVICE --format "{{.Spec.TaskTemplate.ContainerSpec.Image}}")
# try image pull and capture error for printing
ERROR="$(docker pull -q $IMAGE 2>&1 > /dev/null)"
if [[ ! -z $ERROR ]]; then
printf "$SERVICE: $IMAGE\n\t$ERROR\n"
fi
done
@rjchicago
rjchicago / export.sh
Last active November 15, 2022 01:16
Export Variables from .env
set -a; source .env; set +a
@m-radzikowski
m-radzikowski / script-template.sh
Last active June 25, 2024 12:02
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@StevenACoffman
StevenACoffman / _MicroService Proxy Gateway Solutions.md
Last active September 28, 2023 14:54
Microservice Proxy/Gateway Solutions

MicroService Proxy Gateway Solutions

Kong, Traefik, Caddy, Linkerd, Fabio, Vulcand, and Netflix Zuul seem to be the most common in microservice proxy/gateway solutions. Kubernetes Ingress is often a simple Ngnix, which is difficult to separate the popularity from other things.

Github Star Trend:

Github Star History for Kong vs traefik vs fabio vs caddy vs Zuul

This is just a picture of this link from March 2, 2019

Originally, I had included some other solution