Skip to content

Instantly share code, notes, and snippets.

View jirfag's full-sized avatar

Denis Isaev jirfag

View GitHub Profile
@jirfag
jirfag / k8s_port_forward_monitoring.sh
Created March 29, 2020 16:58
Kubernetes port forwarding
#!/bin/bash
set -x
echo "grafana is in http://127.0.0.1:7000/"
echo "use login admin"
echo "use password $(kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.adminPassword}" | base64 --decode)"
kubectl -n monitoring port-forward service/prometheus-operator-grafana 7000:80
#echo "prometheus is in http://127.0.0.1:9090/"
#kubectl -n monitoring port-forward service/prometheus-operator-prometheus 9090:9090
@jirfag
jirfag / k8s_connect_to_db.sh
Created March 29, 2020 17:00
Kubernetes connect to PostgreSQL
#!/bin/bash
set -ue
PGPASSWORD=$(kubectl get secret -n postgres pg-su -o jsonpath="{.data.password}" | base64 --decode)
PGUSER=$(kubectl get secret -n postgres pg-su -o jsonpath="{.data.username}" | base64 --decode)
BASH_CMD="PGPASSWORD=${PGPASSWORD} psql -h pg-stolon-proxy.postgres -U ${PGUSER} -d api_prod"
kubectl -n postgres exec -ti pg-stolon-keeper-0 -- bash -c "${BASH_CMD}"
@jirfag
jirfag / component.tsx
Last active August 8, 2024 18:23
React/Gatsby Table of Contents
import React, { createRef } from "react"
import throttle from "lodash/throttle"
// Import styled components (see the Styles section below).
import {
TocDiv,
TocLink,
TocIcon,
TocTitle,
TocToggleOpener,
@jirfag
jirfag / Dockerfile
Last active June 1, 2021 03:20
Kubernetes PostgreSQL backups
FROM python:alpine
RUN pip install --no-cache-dir awscli
RUN apk update && apk add postgresql
COPY dumpDb.sh .
ENTRYPOINT [ "/bin/sh" ]
CMD [ "./dumpDb.sh" ]
@jirfag
jirfag / action_items.csv
Created August 7, 2024 18:50
Post-mortem action items
Action item Applicability to other incidents Effectiveness for this incident Verdict
Fine-tune alerts Low High Do: low-cost
Fix the segfault bug Low High Do: root cause
Database timeout automated tests Medium-low High Do: hygiene
Retry circuit breaker or retry budget High High Implement retry budget: key action item
Circuit breaker High Medium Not an action item for now: will take in the future
Deadline propagation High Medium-high Start as a long-term project