feat(mirror): add Liara npm/PyPI/Ubuntu APT mirrors to Nexus
Adds mirrors/nexus/add-liara-mirrors.sh that provisions: - npm-liara-proxy → https://package-mirror.liara.ir/repository/npm/ - npm-group → npm-liara-proxy + npm-proxy (Liara first, Runflare fallback) - pypi-liara-proxy → https://package-mirror.liara.ir/repository/pypi/ - pypi-group → pypi-liara-proxy + pypi-proxy - ubuntu-proxy → http://linux-mirror.liara.ir/repository/ubuntu/ - ubuntu-security-proxy → http://linux-mirror.liara.ir/repository/ubuntu-security/ Also updates CI npm install steps to use npm-group instead of npm-proxy so all four Node.js jobs benefit from the Liara-first, Runflare-fallback group from day one. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -160,7 +160,7 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: web/dashboard
|
||||
run: npm install --legacy-peer-deps --ignore-scripts --registry http://mirror:8081/repository/npm-proxy/
|
||||
run: npm install --legacy-peer-deps --ignore-scripts --registry http://mirror:8081/repository/npm-group/
|
||||
|
||||
- name: TypeScript check
|
||||
working-directory: web/dashboard
|
||||
@@ -194,7 +194,7 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: web/admin
|
||||
run: npm install --legacy-peer-deps --ignore-scripts --registry http://mirror:8081/repository/npm-proxy/
|
||||
run: npm install --legacy-peer-deps --ignore-scripts --registry http://mirror:8081/repository/npm-group/
|
||||
|
||||
- name: TypeScript check
|
||||
working-directory: web/admin
|
||||
@@ -228,7 +228,7 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: web/website
|
||||
run: npm install --legacy-peer-deps --ignore-scripts --registry http://mirror:8081/repository/npm-proxy/
|
||||
run: npm install --legacy-peer-deps --ignore-scripts --registry http://mirror:8081/repository/npm-group/
|
||||
|
||||
- name: TypeScript check
|
||||
working-directory: web/website
|
||||
@@ -262,7 +262,7 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: web/finder
|
||||
run: npm install --legacy-peer-deps --ignore-scripts --registry http://mirror:8081/repository/npm-proxy/
|
||||
run: npm install --legacy-peer-deps --ignore-scripts --registry http://mirror:8081/repository/npm-group/
|
||||
|
||||
- name: TypeScript check
|
||||
working-directory: web/finder
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
#!/usr/bin/env bash
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# Add Liara mirror repos to Nexus and create groups (Liara → Runflare fallback)
|
||||
#
|
||||
# New repos:
|
||||
# npm-liara-proxy → https://package-mirror.liara.ir/repository/npm/
|
||||
# npm-group → npm-liara-proxy + npm-proxy (Runflare)
|
||||
# pypi-liara-proxy → https://package-mirror.liara.ir/repository/pypi/
|
||||
# pypi-group → pypi-liara-proxy + pypi-proxy (Runflare)
|
||||
# ubuntu-proxy → http://linux-mirror.liara.ir/repository/ubuntu/
|
||||
# ubuntu-security-proxy → http://linux-mirror.liara.ir/repository/ubuntu-security/
|
||||
#
|
||||
# Usage:
|
||||
# ./mirrors/nexus/add-liara-mirrors.sh
|
||||
# NEXUS_ADMIN_PASS=MyPass ./mirrors/nexus/add-liara-mirrors.sh
|
||||
# UBUNTU_DIST=focal ./mirrors/nexus/add-liara-mirrors.sh # default: jammy
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
set -euo pipefail
|
||||
|
||||
NEXUS_URL="http://localhost:8081"
|
||||
ADMIN_PASS="${NEXUS_ADMIN_PASS:-Mirror@2024!}"
|
||||
UBUNTU_DIST="${UBUNTU_DIST:-jammy}" # change to focal/bionic if your Dockerfiles use older Ubuntu
|
||||
AUTH="-u admin:$ADMIN_PASS"
|
||||
|
||||
ok() { echo "✅ $1"; }
|
||||
skip() { echo "⚠️ $1 already exists (skipped)"; }
|
||||
fail() { echo "❌ $1 — HTTP $2"; }
|
||||
|
||||
add_repo() {
|
||||
local TYPE="$1" JSON="$2"
|
||||
local NAME
|
||||
NAME=$(echo "$JSON" | grep -o '"name":"[^"]*"' | head -1 | cut -d'"' -f4)
|
||||
local HTTP
|
||||
HTTP=$(curl -s -o /dev/null -w "%{http_code}" $AUTH \
|
||||
-X POST "$NEXUS_URL/service/rest/v1/repositories/$TYPE" \
|
||||
-H "Content-Type: application/json" -d "$JSON")
|
||||
case "$HTTP" in
|
||||
201) ok "$NAME" ;;
|
||||
400) skip "$NAME" ;;
|
||||
*) fail "$NAME" "$HTTP" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# ── npm ───────────────────────────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo "📦 npm"
|
||||
|
||||
add_repo "npm/proxy" '{
|
||||
"name": "npm-liara-proxy",
|
||||
"online": true,
|
||||
"storage": {"blobStoreName": "default", "strictContentTypeValidation": false},
|
||||
"proxy": {
|
||||
"remoteUrl": "https://package-mirror.liara.ir/repository/npm/",
|
||||
"contentMaxAge": 1440, "metadataMaxAge": 1440
|
||||
},
|
||||
"negativeCache": {"enabled": true, "timeToLive": 1440},
|
||||
"httpClient": {"blocked": false, "autoBlock": true}
|
||||
}'
|
||||
|
||||
add_repo "npm/group" '{
|
||||
"name": "npm-group",
|
||||
"online": true,
|
||||
"storage": {"blobStoreName": "default", "strictContentTypeValidation": false},
|
||||
"group": {
|
||||
"memberNames": ["npm-liara-proxy", "npm-proxy"]
|
||||
}
|
||||
}'
|
||||
|
||||
# ── PyPI ──────────────────────────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo "🐍 PyPI"
|
||||
|
||||
add_repo "pypi/proxy" '{
|
||||
"name": "pypi-liara-proxy",
|
||||
"online": true,
|
||||
"storage": {"blobStoreName": "default", "strictContentTypeValidation": true},
|
||||
"proxy": {
|
||||
"remoteUrl": "https://package-mirror.liara.ir/repository/pypi/",
|
||||
"contentMaxAge": 1440, "metadataMaxAge": 1440
|
||||
},
|
||||
"negativeCache": {"enabled": true, "timeToLive": 1440},
|
||||
"httpClient": {"blocked": false, "autoBlock": true}
|
||||
}'
|
||||
|
||||
add_repo "pypi/group" '{
|
||||
"name": "pypi-group",
|
||||
"online": true,
|
||||
"storage": {"blobStoreName": "default", "strictContentTypeValidation": true},
|
||||
"group": {
|
||||
"memberNames": ["pypi-liara-proxy", "pypi-proxy"]
|
||||
}
|
||||
}'
|
||||
|
||||
# ── Ubuntu APT ────────────────────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo "🐧 Ubuntu APT (distribution: $UBUNTU_DIST)"
|
||||
echo " If your Dockerfiles use a different Ubuntu version, re-run with:"
|
||||
echo " UBUNTU_DIST=focal $0"
|
||||
echo ""
|
||||
|
||||
add_repo "apt/proxy" '{
|
||||
"name": "ubuntu-proxy",
|
||||
"online": true,
|
||||
"storage": {"blobStoreName": "default", "strictContentTypeValidation": false},
|
||||
"proxy": {
|
||||
"remoteUrl": "http://linux-mirror.liara.ir/repository/ubuntu/",
|
||||
"contentMaxAge": 1440, "metadataMaxAge": 1440
|
||||
},
|
||||
"negativeCache": {"enabled": true, "timeToLive": 1440},
|
||||
"httpClient": {
|
||||
"blocked": false, "autoBlock": true,
|
||||
"connection": {"useTrustStore": false}
|
||||
},
|
||||
"apt": {"distribution": "'"$UBUNTU_DIST"'", "flat": false}
|
||||
}'
|
||||
|
||||
add_repo "apt/proxy" '{
|
||||
"name": "ubuntu-security-proxy",
|
||||
"online": true,
|
||||
"storage": {"blobStoreName": "default", "strictContentTypeValidation": false},
|
||||
"proxy": {
|
||||
"remoteUrl": "http://linux-mirror.liara.ir/repository/ubuntu-security/",
|
||||
"contentMaxAge": 1440, "metadataMaxAge": 1440
|
||||
},
|
||||
"negativeCache": {"enabled": true, "timeToLive": 1440},
|
||||
"httpClient": {
|
||||
"blocked": false, "autoBlock": true,
|
||||
"connection": {"useTrustStore": false}
|
||||
},
|
||||
"apt": {"distribution": "'"$UBUNTU_DIST"'", "flat": false}
|
||||
}'
|
||||
|
||||
# ── Done ──────────────────────────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo "═══════════════════════════════════════════════════════════════"
|
||||
echo "🎉 Done!"
|
||||
echo "═══════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
echo " npm-group → http://SERVER:8081/repository/npm-group/"
|
||||
echo " Liara first, Runflare as fallback"
|
||||
echo ""
|
||||
echo " pypi-group → http://SERVER:8081/repository/pypi-group/"
|
||||
echo " Liara first, Runflare as fallback"
|
||||
echo ""
|
||||
echo " Ubuntu APT → http://SERVER:8081/repository/ubuntu-proxy/"
|
||||
echo " distribution: $UBUNTU_DIST"
|
||||
echo " security: http://SERVER:8081/repository/ubuntu-security-proxy/"
|
||||
echo ""
|
||||
echo "To use Ubuntu APT in a Dockerfile:"
|
||||
echo " RUN echo 'deb http://SERVER:8081/repository/ubuntu-proxy/ $UBUNTU_DIST main restricted universe' > /etc/apt/sources.list && \\"
|
||||
echo " echo 'deb http://SERVER:8081/repository/ubuntu-security-proxy/ $UBUNTU_DIST-security main restricted universe' >> /etc/apt/sources.list && \\"
|
||||
echo " apt-get update"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user