Skip to content

Instantly share code, notes, and snippets.

@SergeFocus
SergeFocus / settings.json
Created November 18, 2023 11:33 — forked from Bazulenkov/settings.json
Пример настройки settings.json в VSCode
{
"python.terminal.activateEnvInCurrentTerminal": true, // автоматически активировать виртуальное окружение
"python.linting.enabled": true, // линтер включен
"files.autoSave": "onFocusChange", // автоматически сохранять файл при переключенни на другое окно
"editor.rulers": [
80 // рисует линию, где заканчивается 80-й символ строки
],
"python.formatting.provider": "black", // использовать Black в качестве форматтера
"python.formatting.blackArgs": [
"--line-length", // длина строки 79 символов
@SergeFocus
SergeFocus / traefik.md
Created July 19, 2023 23:25 — forked from dancheskus/traefik.md
Traefik, как обратный прокси в Docker (пример с 2 react проектами)

Traefik, как обратный прокси в Docker (пример с 2 react проектами)

В результате будет 2 react проекта на 1 сервере доступных по разным ссылкам

Цели

  • Запустить traefik в одном контейнере
  • Запустить другие проекты в других контейнерах
  • Соединить все контейнеры в одну docker cеть
  • Настроить контейнеры с проектами так, что-бы они объясняли traefik'у, какие url ведут на конкретный проект
@SergeFocus
SergeFocus / Grafana Alert Template.md
Created June 5, 2023 19:48 — forked from Himura2la/Grafana Alert Template.md
How to use Grafana Alerts with the Telegram
  • Template name: telegram.message
  • Content:
    {{ define "alert_list" }}{{ range . }}{{ .Labels.alertname }}
    {{ range .Annotations.SortedPairs }}<strong>{{ .Name }}</strong>: {{ .Value }}
    {{ end }}| {{ if gt (len .GeneratorURL) 0 }}<a href="{{ .GeneratorURL }}">source</a> | {{ end }}{{ if gt (len .SilenceURL) 0 }}<a href="{{ .SilenceURL }}">silence</a> | {{ end }}{{ if gt (len .DashboardURL) 0 }}<a href="{{ .DashboardURL }}">dashboard</a> | {{ end }}{{ if gt (len .PanelURL) 0 }}<a href="{{ .PanelURL }}">panel</a> |{{ end }}
    —
    {{ end }}{{ end }}
    {{ define "telegram.message" }}
    

{{ if gt (len .Alerts.Firing) 0 }}FIRING!!!

# ------------------- Dashboard Secret ------------------- #
# ------------------- Dashboard Secret ------------------- #
apiVersion: v1
kind: Secret
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard-certs

Setup a k3s kubernetes cluster using Multipass VMs

for node in node1 node2 node3;do
 multipass launch -n $node
done

# Init cluster on node1
multipass exec node1 -- bash -c "curl -sfL https://get.k3s.io | sh -"
@SergeFocus
SergeFocus / HOW_TO_change_and_persist_k3os_traefik_config.md
Created June 20, 2022 22:33 — forked from Nicklas2751/HOW_TO_change_and_persist_k3os_traefik_config.md
How to configure the system traefik of k3os and perist the config over reboots

Problem: If you change the k3os traefik configuration in /var/lib/rancher/k3s/server/manifests/traefik.yaml directly, all changes will be lost after a reboot.

Solution:

  1. sudo vi /var/lib/rancher/k3os/config.yaml
  2. Add to the top level k3os part the following:
  k3s_args:
  - server
  - "--no-deploy=traefik"
@SergeFocus
SergeFocus / k3s_helm_install.sh
Created June 20, 2022 17:48 — forked from icebob/k3s_helm_install.sh
K3S + Helm installing
# Install K3S
curl -sfL https://get.k3s.io | sh -
# Copy k3s config
mkdir $HOME/.kube
sudo cp /etc/rancher/k3s/k3s.yaml $HOME/.kube/config
sudo chmod 644 $HOME/.kube/config
# Check K3S
kubectl get pods -n kube-system
@SergeFocus
SergeFocus / rancher-on-k3os.md
Created June 14, 2022 07:45 — forked from sebstyle/rancher-on-k3os.md
Install rancher on k3os

Rancher cluster on k3os

Goal

Install rancher on k3os with centralized datastore on mysql cluster.

Environment

  • Host: Ubuntu 18.04.4 Desktop (32gb ram 4 cpu)
  • Virtualisation: kvm/qemu (virtual machine manager)
  • Local network: 192.168.0.0/16
    • Gateway: 192.168.0.1
@SergeFocus
SergeFocus / gist:1d09bd24c67d761fa02f1ce75e9ea50e
Created April 26, 2022 09:36 — forked from MerNat/gist:8ee69c5eeaa4ac909b0044f48e9569b0
Traefik docker compose yml for cluster or swarm configuration.
version: '3.4'
services:
consul-leader:
image: consul
command: agent -server -client=0.0.0.0 -bootstrap -ui
volumes:
- consul-data-leader:/consul/data
environment:
- CONSUL_BIND_INTERFACE=eth0