Upgrade system finished
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
# =============================================================================
|
||||
# Changemaker Lite V2 — Mirror Third-Party Images to Gitea Registry
|
||||
# Pulls infrastructure images from Docker Hub and re-pushes to the Gitea
|
||||
# container registry, protecting against Docker Hub rate limits.
|
||||
# Changemaker Lite V2 — Mirror ALL Images to Gitea Registry
|
||||
#
|
||||
# Pulls every Docker image used in docker-compose.prod.yml and re-pushes it
|
||||
# to the Gitea container registry. After mirroring, release installs can
|
||||
# pull the entire platform from a single registry — no Docker Hub, GHCR,
|
||||
# LSCR, GCR, or other external registries needed.
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/mirror-images.sh [OPTIONS]
|
||||
#
|
||||
# Options:
|
||||
# --all Also mirror heavy optional images (Rocket.Chat, MongoDB, n8n,
|
||||
# Gitea, Jitsi x4) in addition to core images
|
||||
# --dry-run Print commands without executing
|
||||
# --registry Override registry (default: gitea.bnkops.com/admin)
|
||||
# --help Show this help
|
||||
# --core-only Mirror only the essential infrastructure images (postgres,
|
||||
# redis, alpine) — skip platform and communication services
|
||||
# --dry-run Print commands without executing
|
||||
# --registry Override registry (default: gitea.bnkops.com/admin)
|
||||
# --help Show this help
|
||||
#
|
||||
# Prerequisites:
|
||||
# docker login gitea.bnkops.com
|
||||
@@ -24,7 +27,7 @@ PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
# --- Defaults ---
|
||||
REGISTRY="${GITEA_REGISTRY:-gitea.bnkops.com/admin}"
|
||||
INCLUDE_ALL=false
|
||||
CORE_ONLY=false
|
||||
DRY_RUN=false
|
||||
|
||||
# --- Colors ---
|
||||
@@ -44,83 +47,166 @@ run() { if [[ "$DRY_RUN" == "true" ]]; then echo -e "${CYAN}[DRY-RUN]${NC} $
|
||||
# --- Arg parser ---
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--all) INCLUDE_ALL=true; shift ;;
|
||||
--dry-run) DRY_RUN=true; shift ;;
|
||||
--registry) REGISTRY="$2"; shift 2 ;;
|
||||
--core-only) CORE_ONLY=true; shift ;;
|
||||
--dry-run) DRY_RUN=true; shift ;;
|
||||
--registry) REGISTRY="$2"; shift 2 ;;
|
||||
--help|-h)
|
||||
sed -n '2,30p' "$0" | grep '^#' | sed 's/^# \?//'
|
||||
exit 0 ;;
|
||||
# Legacy flag — now default behavior
|
||||
--all) shift ;;
|
||||
*) error "Unknown option: $1"; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# --- Core images (always mirrored) ---
|
||||
CORE_IMAGES=(
|
||||
"postgres:16-alpine"
|
||||
"postgres:17-alpine"
|
||||
"redis:7-alpine"
|
||||
"nocodb/nocodb:0.301.3"
|
||||
"listmonk/listmonk:v6.0.0"
|
||||
"mailhog/mailhog:v1.0.1"
|
||||
"prom/prometheus:v3.10.0"
|
||||
"grafana/grafana:12.3.0"
|
||||
"prom/alertmanager:v0.31.1"
|
||||
"oliver006/redis_exporter:v1.81.0"
|
||||
"gcr.io/cadvisor/cadvisor:v0.52.1"
|
||||
"prom/node-exporter:v1.9.1"
|
||||
"alpine:3"
|
||||
# =============================================================================
|
||||
# IMAGE MAP — source → destination name in Gitea registry
|
||||
#
|
||||
# Naming conventions:
|
||||
# - Simple names kept as-is: postgres, redis, alpine, mongo, mysql, nats
|
||||
# - Namespaced → short name: nocodb/nocodb → nocodb, listmonk/listmonk → listmonk
|
||||
# - Conflicts resolved explicitly:
|
||||
# gotify/server → gotify (not "server")
|
||||
# vaultwarden/server → vaultwarden (not "server")
|
||||
# jitsi/web → jitsi-web (not "web")
|
||||
# lscr.io/.../nginx → ls-nginx (not "nginx", avoids changemaker-nginx conflict)
|
||||
# alpine/curl → alpine-curl (not "curl")
|
||||
# - Untagged images get :latest appended
|
||||
# =============================================================================
|
||||
|
||||
# --- Core infrastructure (always mirrored) ---
|
||||
declare -A CORE_IMAGES=(
|
||||
# PostgreSQL
|
||||
["postgres:16-alpine"]="postgres:16-alpine"
|
||||
["postgres:17-alpine"]="postgres:17-alpine"
|
||||
# Redis
|
||||
["redis:7-alpine"]="redis:7-alpine"
|
||||
# Alpine (init containers)
|
||||
["alpine:3"]="alpine:3"
|
||||
["alpine/curl:8.11.1"]="alpine-curl:8.11.1"
|
||||
)
|
||||
|
||||
# --- Heavy optional images (--all flag) ---
|
||||
OPTIONAL_IMAGES=(
|
||||
"gitea/gitea:1.23"
|
||||
"n8nio/n8n:1.83.2"
|
||||
"rocket.chat:7.4.0"
|
||||
"mongo:6.0"
|
||||
"jitsi/web:stable-10168"
|
||||
"jitsi/prosody:stable-10168"
|
||||
"jitsi/jicofo:stable-10168"
|
||||
"jitsi/jvb:stable-10168"
|
||||
"gotify/server:2.6.1"
|
||||
# --- Platform services ---
|
||||
declare -A PLATFORM_IMAGES=(
|
||||
# NocoDB
|
||||
["nocodb/nocodb:0.301.3"]="nocodb:0.301.3"
|
||||
# Listmonk
|
||||
["listmonk/listmonk:v6.0.0"]="listmonk:v6.0.0"
|
||||
# MailHog
|
||||
["mailhog/mailhog:v1.0.1"]="mailhog:v1.0.1"
|
||||
# MkDocs
|
||||
["squidfunk/mkdocs-material:latest"]="mkdocs-material:latest"
|
||||
# MkDocs static site server (LinuxServer nginx — NOT our custom nginx)
|
||||
["lscr.io/linuxserver/nginx:1.28.2"]="ls-nginx:1.28.2"
|
||||
# n8n workflow automation
|
||||
["docker.n8n.io/n8nio/n8n:latest"]="n8n:latest"
|
||||
# Homepage dashboard
|
||||
["ghcr.io/gethomepage/homepage:v0.7.2"]="homepage:v0.7.2"
|
||||
# Gitea + MySQL
|
||||
["gitea/gitea:1.23.7"]="gitea:1.23.7"
|
||||
["mysql:8"]="mysql:8"
|
||||
# Mini QR
|
||||
["ghcr.io/lyqht/mini-qr:v0.26.0"]="mini-qr:v0.26.0"
|
||||
# Excalidraw
|
||||
["excalidraw/excalidraw:latest"]="excalidraw:latest"
|
||||
# Vaultwarden
|
||||
["vaultwarden/server:1.35.4"]="vaultwarden:1.35.4"
|
||||
# Docker socket proxy
|
||||
["tecnativa/docker-socket-proxy:v0.4.2"]="docker-socket-proxy:v0.4.2"
|
||||
# Pangolin tunnel
|
||||
["fosrl/newt:latest"]="newt:latest"
|
||||
# Plain nginx (CCP instances: reverse proxy + mkdocs-site-server)
|
||||
["nginx:alpine"]="nginx:alpine"
|
||||
# Code Server (LinuxServer)
|
||||
["lscr.io/linuxserver/code-server:latest"]="code-server:latest"
|
||||
)
|
||||
|
||||
# --- Communication services (Rocket.Chat, Gancio, Jitsi) ---
|
||||
declare -A COMMS_IMAGES=(
|
||||
# Rocket.Chat + dependencies
|
||||
["rocketchat/rocket.chat:7.9.7"]="rocketchat:7.9.7"
|
||||
["mongo:6.0"]="mongo:6.0"
|
||||
["nats:2.11-alpine"]="nats:2.11-alpine"
|
||||
# Gancio events
|
||||
["cisti/gancio:1.28.2"]="gancio:1.28.2"
|
||||
# Jitsi Meet (4 containers)
|
||||
["jitsi/web:stable-9823"]="jitsi-web:stable-9823"
|
||||
["jitsi/prosody:stable-9823"]="jitsi-prosody:stable-9823"
|
||||
["jitsi/jicofo:stable-9823"]="jitsi-jicofo:stable-9823"
|
||||
["jitsi/jvb:stable-9823"]="jitsi-jvb:stable-9823"
|
||||
)
|
||||
|
||||
# --- Monitoring stack ---
|
||||
declare -A MONITORING_IMAGES=(
|
||||
["prom/prometheus:v3.10.0"]="prometheus:v3.10.0"
|
||||
["grafana/grafana:12.3.0"]="grafana:12.3.0"
|
||||
["prom/alertmanager:v0.31.1"]="alertmanager:v0.31.1"
|
||||
["oliver006/redis_exporter:v1.81.0"]="redis_exporter:v1.81.0"
|
||||
["gcr.io/cadvisor/cadvisor:v0.55.1"]="cadvisor:v0.55.1"
|
||||
["prom/node-exporter:v1.10.2"]="node-exporter:v1.10.2"
|
||||
["gotify/server:v2.9.0"]="gotify:v2.9.0"
|
||||
)
|
||||
|
||||
# =============================================================================
|
||||
|
||||
mirror_image() {
|
||||
local source="$1"
|
||||
# Get short name: last path segment + tag
|
||||
local name_tag="${source##*/}"
|
||||
local dest="${REGISTRY}/${name_tag}"
|
||||
local dest_name="$2"
|
||||
local dest="${REGISTRY}/${dest_name}"
|
||||
|
||||
info "Mirroring ${source} → ${dest}..."
|
||||
run docker pull "${source}"
|
||||
run docker tag "${source}" "${dest}"
|
||||
run docker push "${dest}"
|
||||
success "Mirrored ${name_tag}"
|
||||
success "Mirrored ${dest_name}"
|
||||
}
|
||||
|
||||
echo -e "${BOLD}Changemaker Lite — Mirror Images${NC}"
|
||||
echo " Registry: $REGISTRY"
|
||||
echo " All: $INCLUDE_ALL"
|
||||
echo ""
|
||||
mirror_map() {
|
||||
local -n map=$1
|
||||
local label="$2"
|
||||
echo ""
|
||||
echo -e "${BOLD}── ${label} (${#map[@]} images) ──${NC}"
|
||||
for source in "${!map[@]}"; do
|
||||
if ! mirror_image "$source" "${map[$source]}"; then
|
||||
FAILED+=("$source")
|
||||
warn "Failed to mirror: $source (continuing...)"
|
||||
else
|
||||
((MIRRORED++)) || true
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
IMAGES=("${CORE_IMAGES[@]}")
|
||||
if [[ "$INCLUDE_ALL" == "true" ]]; then
|
||||
IMAGES+=("${OPTIONAL_IMAGES[@]}")
|
||||
warn "Including heavy optional images — this will take a while"
|
||||
fi
|
||||
echo -e "${BOLD}Changemaker Lite — Mirror ALL Images to Gitea${NC}"
|
||||
echo " Registry: $REGISTRY"
|
||||
echo " Core only: $CORE_ONLY"
|
||||
echo ""
|
||||
|
||||
FAILED=()
|
||||
for img in "${IMAGES[@]}"; do
|
||||
if ! mirror_image "$img"; then
|
||||
FAILED+=("$img")
|
||||
warn "Failed to mirror: $img (continuing...)"
|
||||
fi
|
||||
done
|
||||
MIRRORED=0
|
||||
TOTAL=0
|
||||
|
||||
# Always mirror core
|
||||
for _ in "${!CORE_IMAGES[@]}"; do ((TOTAL++)) || true; done
|
||||
mirror_map CORE_IMAGES "Core Infrastructure"
|
||||
|
||||
if [[ "$CORE_ONLY" != "true" ]]; then
|
||||
for _ in "${!PLATFORM_IMAGES[@]}"; do ((TOTAL++)) || true; done
|
||||
for _ in "${!COMMS_IMAGES[@]}"; do ((TOTAL++)) || true; done
|
||||
for _ in "${!MONITORING_IMAGES[@]}"; do ((TOTAL++)) || true; done
|
||||
|
||||
mirror_map PLATFORM_IMAGES "Platform Services"
|
||||
mirror_map COMMS_IMAGES "Communication Services"
|
||||
mirror_map MONITORING_IMAGES "Monitoring Stack"
|
||||
else
|
||||
warn "Skipping platform, communication, and monitoring images (--core-only)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${BOLD}── Summary ──${NC}"
|
||||
if [[ ${#FAILED[@]} -eq 0 ]]; then
|
||||
success "All ${#IMAGES[@]} images mirrored to ${REGISTRY}"
|
||||
success "All ${MIRRORED} images mirrored to ${REGISTRY}"
|
||||
else
|
||||
warn "Mirrored $((${#IMAGES[@]} - ${#FAILED[@]}))/${#IMAGES[@]} images"
|
||||
warn "Mirrored ${MIRRORED}/${TOTAL} images"
|
||||
error "Failed: ${FAILED[*]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -81,6 +81,11 @@ case "$ACTION" in
|
||||
ARGS+=(--branch "$BRANCH")
|
||||
fi
|
||||
|
||||
USE_REGISTRY="$(echo "$TRIGGER_CONTENT" | grep -o '"useRegistry"[[:space:]]*:[[:space:]]*true' || true)"
|
||||
if [[ -n "$USE_REGISTRY" ]]; then
|
||||
ARGS+=(--use-registry)
|
||||
fi
|
||||
|
||||
"$SCRIPT_DIR/upgrade.sh" "${ARGS[@]}" 2>&1 | tee -a "${LOG_DIR}/upgrade-watcher.log"
|
||||
log "Upgrade complete."
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user