From e0f9190b76aedafa5ecb5ec1601a61bb873e0d59 Mon Sep 17 00:00:00 2001 From: vincent Date: Sun, 17 Mar 2024 18:58:24 +0100 Subject: [PATCH] feat: docker pull througt mirror --- ansible/group_vars/all/docker | 2 + nomad-job/MQTT.nomad | 2 +- nomad-job/actualbudget.nomad | 2 +- nomad-job/alertmanager.nomad | 2 +- nomad-job/backup-consul.nomad | 2 +- nomad-job/backup-postgress.nomad | 2 +- nomad-job/backup-vault.nomad | 2 +- nomad-job/batch-rutorrent.nomad | 2 +- nomad-job/batch-seedboxsync.nomad | 2 +- nomad-job/borgmatic.nomad | 2 +- nomad-job/chainetv.nomad | 2 +- nomad-job/crowdsec-agent.nomad | 2 +- nomad-job/crowdsec-api.nomad | 2 +- nomad-job/dashboard.nomad | 2 +- nomad-job/dockermailserver.nomad | 2 +- nomad-job/drone-runner.nomad | 2 +- nomad-job/drone.nomad | 2 +- nomad-job/filestash.nomad | 2 +- nomad-job/ghostfolio.nomad | 4 +- nomad-job/gitea.nomad | 2 +- nomad-job/grafana.nomad | 16 +- nomad-job/homeassistant.nomad | 2 +- nomad-job/jellyfin.nomad | 4 +- nomad-job/lldap.nomad | 2 +- nomad-job/loki.nomad | 2 +- nomad-job/node-exporter.nomad | 2 +- nomad-job/nut_exporter.nomad | 2 +- nomad-job/pacoloco.nomad | 2 +- nomad-job/paperless-ng.nomad | 4 +- nomad-job/pdns-auth.nomad | 8 +- nomad-job/pihole.nomad | 2 +- nomad-job/prometheus.nomad | 2 +- nomad-job/radicale.nomad | 2 +- nomad-job/registry.nomad.hcl | 219 +++++++++++++++++++++++++++ nomad-job/rutorrent.nomad | 2 +- nomad-job/supysonic.nomad | 4 +- nomad-job/syncthing.nomad | 2 +- nomad-job/traefik-ingress.nomad | 2 +- nomad-job/traefik-local.nomad | 4 +- nomad-job/tt-rss.nomad | 6 +- nomad-job/vaultwarden.nomad | 2 +- nomad-job/vector.nomad | 2 +- nomad-job/vikunja.nomad | 2 +- nomad-job/volume/registry-docker.hcl | 17 +++ nomad-job/volume/registry-ghcr.hcl | 17 +++ nomad-job/www.nomad | 2 +- 46 files changed, 309 insertions(+), 64 deletions(-) create mode 100644 nomad-job/registry.nomad.hcl create mode 100644 nomad-job/volume/registry-docker.hcl create mode 100644 nomad-job/volume/registry-ghcr.hcl diff --git a/ansible/group_vars/all/docker b/ansible/group_vars/all/docker index 901590a..a373aca 100644 --- a/ansible/group_vars/all/docker +++ b/ansible/group_vars/all/docker @@ -3,3 +3,5 @@ docker_daemon_config: - 172.17.0.1 - 192.168.1.5 mtu: 1420 + insecure-registries: + - 192.168.1.0/24 diff --git a/nomad-job/MQTT.nomad b/nomad-job/MQTT.nomad index 23d7ce6..a409f12 100644 --- a/nomad-job/MQTT.nomad +++ b/nomad-job/MQTT.nomad @@ -35,7 +35,7 @@ job "MQTT" { ] } config { - image = "eclipse-mosquitto" + image = "docker.service.consul:5000/library/eclipse-mosquitto" ports = ["mosquittoWS", "mosquittoMQTT"] volumes = [ "/mnt/diskstation/nomad/mosquitto:/mosquitto/data", diff --git a/nomad-job/actualbudget.nomad b/nomad-job/actualbudget.nomad index d9caddd..0cb95d8 100644 --- a/nomad-job/actualbudget.nomad +++ b/nomad-job/actualbudget.nomad @@ -43,7 +43,7 @@ job "actualbudget" { ] } config { - image = "ghcr.io/actualbudget/actual-server:latest" + image = "ghcr.service.consul:5000/actualbudget/actual-server:latest" ports = ["http"] volumes = [ "/mnt/diskstation/nomad/actualbudget:/data" diff --git a/nomad-job/alertmanager.nomad b/nomad-job/alertmanager.nomad index 1c54b14..0dc5499 100644 --- a/nomad-job/alertmanager.nomad +++ b/nomad-job/alertmanager.nomad @@ -45,7 +45,7 @@ job "alertmanager" { } config { - image = "prom/alertmanager" + image = "docker.service.consul:5000/prom/alertmanager" args= ["--log.level=debug", "--config.file=/etc/alertmanager/alertmanager.yml"] ports = ["http"] volumes = [ diff --git a/nomad-job/backup-consul.nomad b/nomad-job/backup-consul.nomad index d26ad86..e16c934 100644 --- a/nomad-job/backup-consul.nomad +++ b/nomad-job/backup-consul.nomad @@ -26,7 +26,7 @@ job "backup-consul" { task "consul-backup" { driver = "docker" config { - image = "ducampsv/docker-consul-backup:latest" + image = "docker.service.consul:5000/ducampsv/docker-consul-backup:latest" volumes = [ "/mnt/diskstation/nomad/backup/consul:/backup" ] diff --git a/nomad-job/backup-postgress.nomad b/nomad-job/backup-postgress.nomad index e3bc2f7..2c02424 100644 --- a/nomad-job/backup-postgress.nomad +++ b/nomad-job/backup-postgress.nomad @@ -32,7 +32,7 @@ job "backup-postgress" { name = "backup-postgress" } config { - image = "ducampsv/docker-backup-postgres:latest" + image = "docker.service.consul:5000/ducampsv/docker-backup-postgres:latest" volumes = [ "/mnt/diskstation/nomad/backup/postgres:/backup" ] diff --git a/nomad-job/backup-vault.nomad b/nomad-job/backup-vault.nomad index 4e47764..7e71cb6 100644 --- a/nomad-job/backup-vault.nomad +++ b/nomad-job/backup-vault.nomad @@ -29,7 +29,7 @@ job "backup-vault" { task "backup-vault" { driver = "docker" config { - image = "ducampsv/docker-vault-backup:latest" + image = "docker.service.consul:5000/ducampsv/docker-vault-backup:latest" volumes = [ "/mnt/diskstation/nomad/backup/vault:/backup" ] diff --git a/nomad-job/batch-rutorrent.nomad b/nomad-job/batch-rutorrent.nomad index 8a89d7a..f5a2c6a 100644 --- a/nomad-job/batch-rutorrent.nomad +++ b/nomad-job/batch-rutorrent.nomad @@ -13,7 +13,7 @@ job "batch-rutorrent" { task "cleanForwardFolder" { driver= "docker" config { - image = "alpine" + image = "docker.service.consul:5000/library/alpine" volumes = [ "/mnt/hetzner/storagebox/file/forward:/file" ] diff --git a/nomad-job/batch-seedboxsync.nomad b/nomad-job/batch-seedboxsync.nomad index 1a758a7..f6c0753 100644 --- a/nomad-job/batch-seedboxsync.nomad +++ b/nomad-job/batch-seedboxsync.nomad @@ -32,7 +32,7 @@ job "batch-seedboxsync" { name = "seedboxsync" } config { - image = "ducampsv/rsync:latest" + image = "docker.service.consul:5000/ducampsv/rsync:latest" volumes = [ "/mnt/diskstation/download:/media", "local/id_rsa:/home/rsyncuser/.ssh/id_rsa" diff --git a/nomad-job/borgmatic.nomad b/nomad-job/borgmatic.nomad index c30e104..e9fcdeb 100644 --- a/nomad-job/borgmatic.nomad +++ b/nomad-job/borgmatic.nomad @@ -20,7 +20,7 @@ job "borgmatic" { task "borgmatic" { driver = "docker" config { - image = "ghcr.io/borgmatic-collective/borgmatic" + image = "ghcr.service.consul:5000/borgmatic-collective/borgmatic" volumes = [ "/exports:/exports", "local/borgmatic.d:/etc/borgmatic.d", diff --git a/nomad-job/chainetv.nomad b/nomad-job/chainetv.nomad index 5b4057c..1f63443 100644 --- a/nomad-job/chainetv.nomad +++ b/nomad-job/chainetv.nomad @@ -39,7 +39,7 @@ job "chainetv" { ] } config { - image = "ducampsv/chainetv:latest" + image = "docker.service.consul:5000/ducampsv/chainetv:latest" ports = ["http"] } resources { diff --git a/nomad-job/crowdsec-agent.nomad b/nomad-job/crowdsec-agent.nomad index a4353dc..e777cc6 100644 --- a/nomad-job/crowdsec-agent.nomad +++ b/nomad-job/crowdsec-agent.nomad @@ -27,7 +27,7 @@ job "crowdsec-agent" { } driver = "docker" config { - image = "crowdsecurity/crowdsec" + image = "docker.service.consul:5000/crowdsecurity/crowdsec" ports = ["metric"] volumes = [ "/var/run/docker.sock:/var/run/docker.sock", diff --git a/nomad-job/crowdsec-api.nomad b/nomad-job/crowdsec-api.nomad index 56921fa..97efb7e 100644 --- a/nomad-job/crowdsec-api.nomad +++ b/nomad-job/crowdsec-api.nomad @@ -41,7 +41,7 @@ job "crowdsec-api" { ] } config { - image = "crowdsecurity/crowdsec" + image = "docker.service.consul:5000/crowdsecurity/crowdsec" ports = ["http", "metric"] volumes = [ "/mnt/diskstation/nomad/crowdsec/db:/var/lib/crowdsec/data", diff --git a/nomad-job/dashboard.nomad b/nomad-job/dashboard.nomad index af6de93..d2c33ef 100644 --- a/nomad-job/dashboard.nomad +++ b/nomad-job/dashboard.nomad @@ -33,7 +33,7 @@ job "dashboard" { ] } config { - image = "b4bz/homer" + image = "docker.service.consul:5000/b4bz/homer" ports = ["http"] volumes = [ "/mnt/diskstation/nomad/homer:/www/assets" diff --git a/nomad-job/dockermailserver.nomad b/nomad-job/dockermailserver.nomad index 02be84d..751ff7f 100644 --- a/nomad-job/dockermailserver.nomad +++ b/nomad-job/dockermailserver.nomad @@ -119,7 +119,7 @@ job "dockermailserver" { task "docker-mailserver" { driver = "docker" config { - image = "ghcr.io/docker-mailserver/docker-mailserver:latest" + image = "ghcr.service.consul:5000/docker-mailserver/docker-mailserver:latest" ports = ["smtp", "esmtp", "imap","rspamd"] volumes = [ "/mnt/diskstation/nomad/dms/mail-data:/var/mail", diff --git a/nomad-job/drone-runner.nomad b/nomad-job/drone-runner.nomad index bbf58dd..506f6e2 100644 --- a/nomad-job/drone-runner.nomad +++ b/nomad-job/drone-runner.nomad @@ -16,7 +16,7 @@ job "drone-runner" { task "drone-runner" { driver = "docker" config { - image = "drone/drone-runner-docker:latest" + image = "docker.service.consul:5000/drone/drone-runner-docker:latest" volumes = [ "/var/run/docker.sock:/var/run/docker.sock", ] diff --git a/nomad-job/drone.nomad b/nomad-job/drone.nomad index 9fa31bd..c47d815 100644 --- a/nomad-job/drone.nomad +++ b/nomad-job/drone.nomad @@ -45,7 +45,7 @@ job "drone" { ] } config { - image = "drone/drone:latest" + image = "docker.service.consul:5000/drone/drone:latest" ports = [ "http" ] diff --git a/nomad-job/filestash.nomad b/nomad-job/filestash.nomad index 59358cd..dca4893 100644 --- a/nomad-job/filestash.nomad +++ b/nomad-job/filestash.nomad @@ -48,7 +48,7 @@ job "filestash" { ] } config { - image = "machines/filestash" + image = "docker.service.consul:5000/machines/filestash" ports = ["http"] volumes = [ "/mnt/diskstation/nomad/filestash:/app/data/state" diff --git a/nomad-job/ghostfolio.nomad b/nomad-job/ghostfolio.nomad index e37118e..c183660 100644 --- a/nomad-job/ghostfolio.nomad +++ b/nomad-job/ghostfolio.nomad @@ -27,7 +27,7 @@ job "ghostfolio" { task "redis" { driver = "docker" config { - image = "redis" + image = "docker.service.consul:5000/library/redis" ports = ["redis"] } resources { @@ -51,7 +51,7 @@ job "ghostfolio" { ] } config { - image = "ghostfolio/ghostfolio:latest" + image = "docker.service.consul:5000/ghostfolio/ghostfolio:latest" ports = ["http"] volumes = [ ] diff --git a/nomad-job/gitea.nomad b/nomad-job/gitea.nomad index fb2e82c..d02cec2 100644 --- a/nomad-job/gitea.nomad +++ b/nomad-job/gitea.nomad @@ -59,7 +59,7 @@ job "git" { ] } config { - image = "gitea/gitea:latest" + image = "docker.service.consul:5000/gitea/gitea:latest" ports = [ "http", "ssh" diff --git a/nomad-job/grafana.nomad b/nomad-job/grafana.nomad index 73915b6..3929658 100644 --- a/nomad-job/grafana.nomad +++ b/nomad-job/grafana.nomad @@ -16,12 +16,6 @@ job "grafana" { to = 3000 } } - volume "grafana" { - type = "csi" - source = "grafana" - access_mode = "multi-node-multi-writer" - attachment_mode = "file-system" - } service { name = "grafana" port = "http" @@ -44,17 +38,13 @@ job "grafana" { } task "dashboard" { - volume_mount { - volume = "grafana" - destination = "/grafana" - } driver = "docker" config { - image = "grafana/grafana" + image = "docker.service.consul:5000/grafana/grafana" ports = ["http"] volumes = [ - "grafana:/etc/grafana", - "grafana:/var/lib/grafana" + "/mnt/diskstation/nomad/grafana/config:/etc/grafana", + "/mnt/diskstation/nomad/grafana/lib:/var/lib/grafana" ] } resources { diff --git a/nomad-job/homeassistant.nomad b/nomad-job/homeassistant.nomad index b5699d1..eaf36ab 100644 --- a/nomad-job/homeassistant.nomad +++ b/nomad-job/homeassistant.nomad @@ -57,7 +57,7 @@ job "homeassistant" { } } config { - image = "homeassistant/home-assistant:stable" + image = "docker.service.consul:5000/homeassistant/home-assistant:stable" ports = ["http", "coap"] privileged = "true" network_mode = "host" diff --git a/nomad-job/jellyfin.nomad b/nomad-job/jellyfin.nomad index ab183f1..c7d2601 100644 --- a/nomad-job/jellyfin.nomad +++ b/nomad-job/jellyfin.nomad @@ -43,7 +43,7 @@ job "jellyfin" { } config { - image = "ghcr.io/jellyfin/jellyfin-vue:unstable" + image = "ghcr.service.consul:5000/jellyfin/jellyfin-vue:unstable" ports = ["http"] } env { @@ -88,7 +88,7 @@ job "jellyfin" { ] } config { - image = "jellyfin/jellyfin" + image = "docker.service.consul:5000/jellyfin/jellyfin" ports = ["http"] volumes = [ "/mnt/diskstation/nomad/jellyfin/config:/config", diff --git a/nomad-job/lldap.nomad b/nomad-job/lldap.nomad index eb66cc3..7b9429b 100644 --- a/nomad-job/lldap.nomad +++ b/nomad-job/lldap.nomad @@ -41,7 +41,7 @@ job "lldap" { task "lldap" { driver = "docker" config { - image = "ducampsv/lldap:latest" + image = "docker.service.consul:5000/ducampsv/lldap:latest" ports = ["ldap","http"] volumes = [ "/mnt/diskstation/nomad/lldap:/data" diff --git a/nomad-job/loki.nomad b/nomad-job/loki.nomad index 0cec304..67488b4 100644 --- a/nomad-job/loki.nomad +++ b/nomad-job/loki.nomad @@ -38,7 +38,7 @@ job "loki" { } } config { - image = "grafana/loki" + image = "docker.service.consul:5000/grafana/loki" ports = ["http"] args = [ "-config.file", diff --git a/nomad-job/node-exporter.nomad b/nomad-job/node-exporter.nomad index 646af33..227325e 100644 --- a/nomad-job/node-exporter.nomad +++ b/nomad-job/node-exporter.nomad @@ -32,7 +32,7 @@ job "node-exporter" { task "node-exporter" { driver = "docker" config { - image = "prom/node-exporter" + image = "docker.service.consul:5000/prom/node-exporter" ports = ["http"] args = [ "--web.listen-address=:${NOMAD_PORT_http}", diff --git a/nomad-job/nut_exporter.nomad b/nomad-job/nut_exporter.nomad index 2475f33..c53e712 100644 --- a/nomad-job/nut_exporter.nomad +++ b/nomad-job/nut_exporter.nomad @@ -29,7 +29,7 @@ job "nut_exporter" { task "nut_exporter" { driver = "docker" config { - image = "ghcr.io/druggeri/nut_exporter" + image = "ghcr.service.consul:5000/druggeri/nut_exporter" ports = ["http"] } env { diff --git a/nomad-job/pacoloco.nomad b/nomad-job/pacoloco.nomad index 84bca0e..d041b34 100644 --- a/nomad-job/pacoloco.nomad +++ b/nomad-job/pacoloco.nomad @@ -32,7 +32,7 @@ job "pacoloco" { ] } config { - image = "ducampsv/pacoloco" + image = "docker.service.consul:5000/ducampsv/pacoloco" ports = ["http"] volumes = [ "/mnt/diskstation/nomad/pacoloco:/var/cache/pacoloco", diff --git a/nomad-job/paperless-ng.nomad b/nomad-job/paperless-ng.nomad index 11a157c..f0a59b6 100644 --- a/nomad-job/paperless-ng.nomad +++ b/nomad-job/paperless-ng.nomad @@ -33,7 +33,7 @@ job "paperless-ng" { task "redis" { driver = "docker" config { - image = "redis" + image = "docker.service.consul:5000/library/redis" ports = ["redis"] } resources { @@ -67,7 +67,7 @@ job "paperless-ng" { } } config { - image = "ghcr.io/paperless-ngx/paperless-ngx" + image = "ghcr.service.consul:5000/paperless-ngx/paperless-ngx" ports = ["http"] volumes = [ "/mnt/diskstation/nomad/paperless-ng/media:/usr/src/paperless/media", diff --git a/nomad-job/pdns-auth.nomad b/nomad-job/pdns-auth.nomad index 583fc67..2f721ff 100644 --- a/nomad-job/pdns-auth.nomad +++ b/nomad-job/pdns-auth.nomad @@ -39,7 +39,7 @@ job "pdns-auth" { } config { - image = "powerdns/pdns-auth-master:latest" + image = "docker.service.consul:5000/powerdns/pdns-auth-master:latest" network_mode = "host" privileged=true cap_add= ["net_bind_service"] @@ -102,7 +102,7 @@ include-dir=/etc/powerdns/pdns.d } driver = "docker" config { - image = "powerdnsadmin/pda-legacy:latest" + image = "docker.service.consul:5000/powerdnsadmin/pda-legacy:latest" ports= ["pdnsadmin"] volumes = [ "/mnt/diskstation/nomad/pdns-admin/:/data/node_module/", @@ -131,7 +131,7 @@ SQLALCHEMY_DATABASE_URI=postgresql://pdns-admin:{{ .Data.data.pdnsadmin }}@activ driver = "docker" config { - image = "powerdns/pdns-recursor-master:latest" + image = "docker.service.consul:5000/powerdns/pdns-recursor-master:latest" network_mode = "host" volumes = [ "local/recursor.conf:/etc/powerdns/recursor.conf", @@ -172,7 +172,7 @@ local-address=192.168.1.6 EOH } config { - image = "osixia/keepalived:2.0.20" + image = "docker.service.consul:5000/osixia/keepalived:2.0.20" network_mode = "host" cap_add = [ "NET_ADMIN", diff --git a/nomad-job/pihole.nomad b/nomad-job/pihole.nomad index 9497d5b..371763c 100644 --- a/nomad-job/pihole.nomad +++ b/nomad-job/pihole.nomad @@ -45,7 +45,7 @@ job "pihole" { } config { - image = "pihole/pihole:2023.10.0" + image = "docker.service.consul:5000/pihole/pihole:2023.10.0" network_mode = "host" volumes = [ "local/dnsmasq.d/02-localresolver.conf:/etc/dnsmasq.d/02-localresolver.conf", diff --git a/nomad-job/prometheus.nomad b/nomad-job/prometheus.nomad index bc29755..4c62c9e 100644 --- a/nomad-job/prometheus.nomad +++ b/nomad-job/prometheus.nomad @@ -250,7 +250,7 @@ EOH driver = "docker" config { - image = "prom/prometheus:latest" + image = "docker.service.consul:5000/prom/prometheus:latest" args = [ "--config.file=/etc/prometheus/prometheus.yml", "--storage.tsdb.path=/prometheus", diff --git a/nomad-job/radicale.nomad b/nomad-job/radicale.nomad index a77086e..1645518 100644 --- a/nomad-job/radicale.nomad +++ b/nomad-job/radicale.nomad @@ -44,7 +44,7 @@ job "radicale" { ] } config { - image = "tomsquest/docker-radicale" + image = "docker.service.consul:5000/tomsquest/docker-radicale" ports = ["http"] volumes = [ "local/config:/config/config", diff --git a/nomad-job/registry.nomad.hcl b/nomad-job/registry.nomad.hcl new file mode 100644 index 0000000..6c041ef --- /dev/null +++ b/nomad-job/registry.nomad.hcl @@ -0,0 +1,219 @@ +job "registry" { + datacenters = ["homelab"] + priority = 100 + type = "service" + meta { + forcedeploy = "0" + } + constraint { + attribute = "${attr.cpu.arch}" + value = "amd64" + } + + group "registry" { + network { + mode = "host" + port "docker_registry" { + to = 5000 + } + port "ghcr_registry" { + to = 5000 + } + port "traefik" { + to = 5000 + static = 5000 + } + port "redis" { + to = 6379 + } + port "admin" { + to = 8080 + } + } + volume "registry-docker" { + type = "csi" + source = "registry-docker" + access_mode = "multi-node-multi-writer" + attachment_mode = "file-system" + } + volume "registry-ghcr" { + type = "csi" + source = "registry-ghcr" + access_mode = "multi-node-multi-writer" + attachment_mode = "file-system" + } + service { + name = "docker" + port = "traefik" + } + service { + name = "ghcr" + port = "traefik" + } + task "docker-registry" { + driver = "docker" + config { + image = "registry:2" + ports = ["docker_registry"] + volumes = [ + "local/dockerhub.yaml:/etc/docker/registry/config.yml" + ] + + } + env { + } + volume_mount { + volume = "registry-docker" + destination = "/var/lib/registry" + } + template { + data = <