Files
meezi/docker-compose.mirror.yml
T
soroush.asadi 61e44c63ab refactor(mirror): replace 3 services with single Nexus Repository Manager
Consolidates BaGet + Verdaccio + registry:2 into one Sonatype Nexus OSS
instance with a REST API provisioning script.

docker-compose.mirror.yml: single nexus service, ports 8081 (UI/NuGet/npm)
  and 8083 (Docker Hub pull-through proxy)
mirrors/nexus/provision.sh: idempotent setup — changes admin password,
  enables anonymous access, creates nuget-proxy / npm-proxy / docker-hub-proxy
nuget.mirror.config: updated source URL to Nexus NuGet proxy endpoint
ci-cd.yml: updated npm --registry to Nexus npm proxy endpoint

Run once on server: docker compose -f docker-compose.mirror.yml up -d
  then: ./mirrors/nexus/provision.sh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 14:35:55 +03:30

44 lines
2.5 KiB
YAML

# ─────────────────────────────────────────────────────────────────────────────
# Nexus Repository Manager OSS — single pull-through mirror for everything
# ─────────────────────────────────────────────────────────────────────────────
# FIRST-TIME SETUP (run once after starting):
# docker compose -f docker-compose.mirror.yml up -d
# ./mirrors/nexus/provision.sh # creates all proxy repos + enables anon access
#
# Endpoints (after provisioning):
# UI → http://SERVER_IP:8081 (admin / see provision.sh output)
# NuGet → http://SERVER_IP:8081/repository/nuget-proxy/index.json
# npm → http://SERVER_IP:8081/repository/npm-proxy/
# Docker → http://SERVER_IP:8083 (add to /etc/docker/daemon.json)
#
# Memory: needs ~2 GB JVM heap — recommended on a server with 4 GB+ total RAM.
# Adjust INSTALL4J_ADD_VM_PARAMS below if your server has more/less RAM.
# ─────────────────────────────────────────────────────────────────────────────
services:
nexus:
image: sonatype/nexus3:latest
container_name: meezi-mirror-nexus
restart: unless-stopped
environment:
# Heap: Xmx = max Java heap. MaxDirectMemorySize = off-heap (blob cache).
# Total Nexus RAM ≈ Xmx + MaxDirectMemorySize + ~512 MB OS/JVM overhead.
# 4 GB server: values below (2 GB heap + 1 GB off-heap + 512 MB overhead ≈ 3.5 GB)
# 8 GB server: -Xms1g -Xmx4g -XX:MaxDirectMemorySize=2g
INSTALL4J_ADD_VM_PARAMS: "-Xms512m -Xmx2g -XX:MaxDirectMemorySize=1g -Djava.util.prefs.userRoot=/nexus-data/javaprefs"
volumes:
- nexus-data:/nexus-data
ports:
- "8081:8081" # Web UI + NuGet + npm REST API
- "8083:8083" # Docker Hub pull-through proxy (dedicated port required by Docker protocol)
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:8081/service/rest/v1/status"]
interval: 30s
timeout: 15s
retries: 10
start_period: 120s # Nexus JVM startup takes ~2 min on first boot
volumes:
nexus-data:
name: meezi-mirror-nexus-data