Skip to content

Instantly share code, notes, and snippets.

View prologic's full-sized avatar
👋
Principal SRE, Founder of Yarn.social and Salty.im

James Mills prologic

👋
Principal SRE, Founder of Yarn.social and Salty.im
View GitHub Profile
@prologic
prologic / alertrules.yml
Created April 11, 2022 22:34
Prometheus AlertRules
---
groups:
- name: msgbus
interval: 15s
rules:
- alert: zero_subscribers
expr: |
msgbus_bus_subscribers == 0
for: 30s
annotations:
@prologic
prologic / alertrules.yml
Created April 7, 2022 04:17
p95 Traefik Prometheus Alertering Rule
---
- name: traefik
interval: 15s
rules:
- alert: p95_latency
expr: |
label_replace(
histogram_quantile(
0.95,
sum(
@prologic
prologic / main.go
Created April 1, 2022 14:46
Test program to test Go'a netdns=cgo resolver on macOS
package main
import (
"fmt"
"log"
"net"
)
func main() {
cnames, addrs, err := net.LookupSRV("_salty", "_tcp", "home.arpa")
@prologic
prologic / traffic.pql
Created January 5, 2022 02:12
PromQL to measure (for Docker containers via cAdvisor) Network Traffic
sum(label_replace(
increase(container_network_transmit_bytes_total{image!="", container_label_com_docker_stack_namespace=~"$stack", container_label_com_docker_swarm_service_name=~"$service"}[$__range])
+
increase(container_network_receive_bytes_total{image!="", container_label_com_docker_stack_namespace=~"$stack", container_label_com_docker_swarm_service_name=~"$service"}[$__range]),
"task_name", "$1", "container_label_com_docker_swarm_task_name", "(.*\\.[0-9]*).*\\..*")) by (task_name)
@prologic
prologic / gen-yarnd-secrets.sh
Created December 4, 2021 02:49
General yarnd secrets
#!/bin/sh
random_string() {
tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 64 | head -n 1
}
echo " - API_SIGNING_KEY=$(random_string)"
echo " - COOKIE_SECRET=$(random_string)"
echo " - MAGICLINK_SECRET=$(random_string)"
@prologic
prologic / docker-compose.yml
Created March 22, 2015 15:04
A mini Docker based PaaS
autodock:
image: prologic/autodock
ports:
- "1338:1338/udp"
- "1338:1338/tcp"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
autodocklogger:
image: prologic/autodock-logger
@prologic
prologic / hello.yml
Created January 12, 2021 06:03
Hello Docker Stack
---
version: "3.8"
services:
hello:
image: prologic/hello-go
networks:
- traefik
deploy:
mode: replicated
@prologic
prologic / go.mod
Created January 11, 2021 23:07
Twtxt Search Engine Crawler proof-of-concept
module twtxt-search-engine
go 1.14
require (
github.com/gocolly/colly/v2 v2.1.0
github.com/jointwt/twtxt v0.0.0-20210108082814-7098fcfa49df
github.com/prologic/read-file-last-line v0.0.0-20200806014221-326f63458987
github.com/sirupsen/logrus v1.7.0
)
@prologic
prologic / traefik.yml
Created January 9, 2021 05:46
Traefik v2 Docker Swarm Stack
---
version: "3.8"
services:
traefik:
image: traefik:latest
ports:
- target: 80
published: 80
protocol: tcp
@prologic
prologic / hello.yml
Created January 9, 2021 03:20
"Hello World" Go service with Tradfik as Ingress Load Balancer
---
version: "3.8"
services:
hello:
image: r.mills.io/prologic/hello-go
networks:
- traefik
deploy:
mode: replicated