D1_ROOT := /home/gfs-data D2_ROOT := /media/seagate-1000 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 #------------------------------------------------ init-traefik-data: [ -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" init-prometheus-data: [ -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 network-up-drone: docker network ls | grep -q drone-network || docker network create --driver overlay --attachable drone-network network-down-drone: docker network rm drone-network network-up-prometheus: docker network ls | grep -q prometheus-network || docker network create --driver overlay --attachable prometheus-network network-down-prometheus: docker network rm prometheus-network network-up-traefik: docker network ls | grep -q traefik-network || docker network create --driver overlay --attachable traefik-network network-down-traefik: docker network rm traefik-network #------------------------------------------------ stack-up-traefik: network-up-traefik init-traefik-data docker stack deploy --compose-file traefik.yml traefik-stack stack-down-traefik: docker stack rm traefik-stack stack-up-codepot: network-up-traefik docker stack deploy --compose-file codepot.yml codepot-stack stack-down-codepot: docker stack rm codepot-stack 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 docker stack deploy --compose-file gitea.yml gitea-stack stack-down-gitea: docker stack rm gitea-stack stack-up-drone: network-up-traefik network-up-drone docker stack deploy --compose-file drone.yml drone-stack stack-down-drone: docker stack rm drone-stack stack-up-drone-runner: network-up-drone 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 docker stack deploy --compose-file cadvisor.yml cadvisor-stack stack-down-cadvisor: docker stack rm cadvisor-stack stack-up-prometheus-node-exporter: network-up-prometheus 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 stack-up-prometheus: network-up-prometheus init-prometheus-data docker stack deploy --compose-file prometheus.yml prometheus-stack stack-down-prometheus: docker stack rm prometheus-stack stack-up-grafana: netwokr-up-traefik docker stack deploy --compose-file grafana.yml grafana-stack stack-down-grafana: docker stack rm grafana-stack stack-up-nextcloud: network-up-traefik init-nextcloud-data 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 docker stack deploy --compose-file onlyoffice.yml onlyoffice-stack stack-down-onlyoffice: docker stack rm onlyoffice-stack 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 # ------------------------------------------------------------------- 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 #------------------------------------------------ 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