playground/docker-stack/Makefile

173 lines
5.8 KiB
Makefile
Raw Permalink Normal View History

2022-10-30 15:40:09 +00:00
D1_ROOT := /home/gfs-data
D2_ROOT := /media/seagate-1000
2022-10-09 16:59:31 +00:00
all:
@echo "ERROR: Be specific with one or more targets"
build:
DOCKER_BUILDKIT=1 docker build -t alpine:prom-proc-net -f Dockerfile.prom-proc-net .
push:
docker tag alpine:prom-proc-net docker.io/hyunghwan/alpine:prom-proc-net
docker push docker.io/hyunghwan/alpine:prom-proc-net
2022-10-30 15:40:09 +00:00
#------------------------------------------------
2022-10-09 16:59:31 +00:00
init-traefik-data:
2022-10-30 15:40:09 +00:00
[ -d "$(D1_ROOT)/traefik" ] || mkdir "$(D1_ROOT)/traefik"
cp traefik-cert.yml "$(D1_ROOT)/traefik"
cp -f /etc/letsencrypt/live/miflux.com/fullchain.pem "$(D1_ROOT)/traefik/miflux.crt"
cp -f /etc/letsencrypt/live/miflux.com/privkey.pem "$(D1_ROOT)/traefik/miflux.key"
init-coder-data:
[ -d "$(D1_ROOT)/coder" ] || { mkdir "$(D1_ROOT)/coder"; chown 1000:1000 "$(D1_ROOT)/coder"; }
[ -d "$(D1_ROOT)/coder/data" ] || { mkdir "$(D1_ROOT)/coder/data"; chown 1000:1000 "$(D1_ROOT)/coder/data"; }
[ -d "$(D1_ROOT)/coder/templates" ] || { mkdir "$(D1_ROOT)/coder/templates"; chown 1000:1000 "$(D1_ROOT)/coder/templates"; }
[ -d "$(D1_ROOT)/coder/workspace" ] || { mkdir "$(D1_ROOT)/coder/workspace"; chown 1000:1000 "$(D1_ROOT)/coder/workspace"; }
init-gitea-data:
[ -d "$(D1_ROOT)/gitea" ] || mkdir "$(D1_ROOT)/gitea"
2022-10-09 16:59:31 +00:00
init-prometheus-data:
2022-10-30 15:40:09 +00:00
[ -d "$(D1_ROOT)/prometheus" ] || mkdir "$(D1_ROOT)/prometheus"
[ -d "$(D1_ROOT)/prometheus/etc" ] || mkdir "$(D1_ROOT)/prometheus/etc"
[ -d "$(D1_ROOT)/prometheus/data" ] || mkdir "$(D1_ROOT)/prometheus/data"
chown 65534:65534 "$(D1_ROOT)/prometheus/data"
cp -f prometheus.conf.yml "$(D1_ROOT)/prometheus/etc/prometheus.yml"
##cp -f prometheus.alert.rules.yml "$(D1_ROOT)/prometheus/etc/alert.rules.yml"
init-nextcloud-data:
[ -d "$(D2_ROOT)/nextcloud" ] || mkdir "$(D2_ROOT)/nextcloud"
init-onlyoffice-data:
[ -d "$(D2_ROOT)/onlyoffice" ] || mkdir "$(D2_ROOT)/onlyoffice"
[ -d "$(D2_ROOT)/onlyoffice/data" ] || mkdir "$(D2_ROOT)/onlyoffice/data"
[ -d "$(D2_ROOT)/onlyoffice/logs" ] || mkdir "$(D2_ROOT)/onlyoffice/logs"
#------------------------------------------------
network-up-coder:
docker network ls | grep -q coder-network || docker network create --driver overlay --attachable coder-network
network-down-coder:
docker network rm coder-network
2022-10-09 16:59:31 +00:00
network-up-drone:
2022-10-30 15:40:09 +00:00
docker network ls | grep -q drone-network || docker network create --driver overlay --attachable drone-network
2022-10-09 16:59:31 +00:00
network-down-drone:
docker network rm drone-network
network-up-prometheus:
2022-10-30 15:40:09 +00:00
docker network ls | grep -q prometheus-network || docker network create --driver overlay --attachable prometheus-network
2022-10-09 16:59:31 +00:00
network-down-prometheus:
docker network rm prometheus-network
network-up-traefik:
2022-10-30 15:40:09 +00:00
docker network ls | grep -q traefik-network || docker network create --driver overlay --attachable traefik-network
2022-10-09 16:59:31 +00:00
network-down-traefik:
docker network rm traefik-network
2022-10-30 15:40:09 +00:00
#------------------------------------------------
stack-up-traefik: network-up-traefik init-traefik-data
2022-10-09 16:59:31 +00:00
docker stack deploy --compose-file traefik.yml traefik-stack
stack-down-traefik:
docker stack rm traefik-stack
2022-10-30 15:40:09 +00:00
stack-up-codepot: network-up-traefik
2022-10-09 16:59:31 +00:00
docker stack deploy --compose-file codepot.yml codepot-stack
stack-down-codepot:
docker stack rm codepot-stack
2022-10-30 15:40:09 +00:00
stack-up-coder: network-up-traefik network-up-coder init-coder-data
docker stack deploy --compose-file coder.yml coder-stack
stack-down-coder:
docker stack rm coder-stack
stack-up-gitea: network-up-traefik init-gitea-data
2022-10-09 16:59:31 +00:00
docker stack deploy --compose-file gitea.yml gitea-stack
stack-down-gitea:
docker stack rm gitea-stack
2022-10-30 15:40:09 +00:00
stack-up-drone: network-up-traefik network-up-drone
2022-10-09 16:59:31 +00:00
docker stack deploy --compose-file drone.yml drone-stack
stack-down-drone:
docker stack rm drone-stack
2022-10-30 15:40:09 +00:00
stack-up-drone-runner: network-up-drone
2022-10-09 16:59:31 +00:00
docker stack deploy --compose-file drone-runner.yml drone-runner-stack
stack-down-drone-runner:
docker stack rm drone-runner-stack
stack-up-portainer:
docker stack deploy --compose-file portainer.yml portainer-stack
stack-down-portainer:
docker stack rm portainer-stack
#------------------------------------------------
stack-up-cadvisor: network-up-prometheus
2022-10-09 16:59:31 +00:00
docker stack deploy --compose-file cadvisor.yml cadvisor-stack
stack-down-cadvisor:
docker stack rm cadvisor-stack
2022-10-30 15:40:09 +00:00
stack-up-prometheus-node-exporter: network-up-prometheus
2022-10-09 16:59:31 +00:00
docker stack deploy --compose-file prometheus-node-exporter.yml prometheus-node-exporter-stack
stack-down-prometheus-node-exporter:
docker stack rm prometheus-node-exporter-stack
2022-10-30 15:40:09 +00:00
stack-up-prometheus: network-up-prometheus init-prometheus-data
2022-10-09 16:59:31 +00:00
docker stack deploy --compose-file prometheus.yml prometheus-stack
stack-down-prometheus:
docker stack rm prometheus-stack
stack-up-grafana: netwokr-up-traefik
2022-10-09 16:59:31 +00:00
docker stack deploy --compose-file grafana.yml grafana-stack
stack-down-grafana:
docker stack rm grafana-stack
2022-10-20 11:21:55 +00:00
2022-10-30 15:40:09 +00:00
stack-up-nextcloud: network-up-traefik init-nextcloud-data
2022-10-20 11:21:55 +00:00
docker stack deploy --compose-file nextcloud.yml nextcloud-stack
stack-down-nextcloud:
docker stack rm nextcloud-stack
stack-up-onlyoffice: network-up-traefik init-onlyoffice-data
2022-10-20 11:21:55 +00:00
docker stack deploy --compose-file onlyoffice.yml onlyoffice-stack
stack-down-onlyoffice:
docker stack rm onlyoffice-stack
2022-10-09 16:59:31 +00:00
stack-up-monitor: stack-up-prometheus-node-exporter stack-up-prometheus stack-up-grafana
stack-down-monitor: stack-down-grafana stack-down-prometheus stack-down-prometheus-node-exporter
2023-02-22 07:28:22 +00:00
# -------------------------------------------------------------------
stack-up-web: network-up-traefik
[ -d "$(D1_ROOT)/web" ] || mkdir "$(D1_ROOT)/web"
docker stack deploy --compose-file web.yml --resolve-image always web-stack
stack-down-web:
docker stack rm web-stack
2022-10-09 16:59:31 +00:00
#------------------------------------------------
stack-down-all: stack-down-portainer stack-down-drone-runner stack-down-drone stack-down-gitea stack-down-codepot stack-down-traefik
stack-up-all: stack-up-traefik stack-up-codepot stack-up-gitea stack-up-drone stack-up-drone-runner stack-up-portainer