Skip to content

Instantly share code, notes, and snippets.

View arsalanses's full-sized avatar
🧠
lets play chess

Arsalan Sefidgar arsalanses

🧠
lets play chess
View GitHub Profile
@arsalanses
arsalanses / docker-config.sh
Created October 31, 2024 09:03
docker swarm config service update
#!/bin/bash
set -xue
OLD_CONFIG=$(docker service inspect service_name | jq .[].Spec.TaskTemplate.ContainerSpec.Configs[].ConfigName)
OLD_VERSION=${OLD_CONFIG: -2:-1}
NEW_VERSION=$((OLD_VERSION + 1))
NEW_CONFIG=$(echo "$OLD_CONFIG" | sed "s/$OLD_VERSION/$NEW_VERSION/")
echo "NEW_CONFIG: $NEW_CONFIG"
@arsalanses
arsalanses / ReadMe.md
Created October 22, 2024 12:07
kubernetes setup external load-balancer

haproxy and keepalived install and configuration

On API loadbalancer nodes

echo "install haproxy and keepalived service"
apt install -y haproxy keepalived

echo "copy and move haproxy config"
cat /etc/haproxy/haproxy.cfg
cat <<EOT >> /etc/haproxy/haproxy.cfg
listen Stats-Page
@arsalanses
arsalanses / default.conf
Created October 20, 2024 20:38
nginx mirror
upstream backend {
server echo01:5678;
}
upstream test_backend {
server echo02:5678;
}
server {
server_name 192.168.0.100;
@arsalanses
arsalanses / compose.yml
Created October 7, 2024 19:52
opengist
services:
caddy:
image: docker.arvancloud.ir/caddy:2.8-alpine
restart: unless-stopped
command: caddy reverse-proxy --access-log --from https://git.domain.com:443 --to http://opengist:6157 { metrics /metrics }
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
@arsalanses
arsalanses / compose.yml
Last active October 6, 2024 21:32
caddy + v2ray
services:
# caddy:
# image: docker.arvancloud.ir/caddy:2.8-alpine
# restart: unless-stopped
# command: caddy reverse-proxy --access-log --from https://domain:443 --to http://jumper:6157
# ports:
# - "80:80"
# - "443:443"
# - "443:443/udp"
# volumes:
@arsalanses
arsalanses / CronJob.yml
Last active October 17, 2024 12:10
arvancaas minio api svc ingress
apiVersion: batch/v1
kind: CronJob
metadata:
name: minio-cleanup
namespace: devops-storage
spec:
schedule: "0 * * * *"
jobTemplate:
spec:
template:
@arsalanses
arsalanses / compose.yml
Last active October 20, 2024 10:07
cadvisor
services:
cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.49.1
container_name: cadvisor
command: --disable_metrics=disk,udp,percpu
restart: unless-stopped
privileged: true
ports:
- "9102:8080"
volumes:
@arsalanses
arsalanses / README.md
Last active November 6, 2024 11:45
minio policy example
# create bucket
mc mb ALIAS/BUCKETNAME

# create user
mc admin user add ALIAS USERNAME SECRET-KEY
{
@arsalanses
arsalanses / compose.yml
Created October 5, 2024 11:55
caddy + healthchecks
services:
caddy:
image: caddy:2.6.4
restart: unless-stopped
command: caddy reverse-proxy --from https://hc.monkeyseemonkeydo.lv:443 --to http://web:8000
ports:
- 80:80
- 443:443
volumes:
- caddy:/data

swarm init

docker swarm init --data-path-port=7789 --advertise-addr <ip-addr>
docker network create -d overlay --attachable proxy