Files

47 lines
1.5 KiB
Bash

#!/usr/bin/env bash
# devpi — private PyPI cache / mirror
#
# Run on a Proxmox VE host:
# bash -c "$(curl -fsSL https://gitea.luki-net.org/luki-net/proxmox-scripts/raw/branch/main/ct/devpi.sh)"
set -euo pipefail
APP="devpi"
APP_DESCRIPTION="private PyPI cache / mirror — saves time on CUDA/torch rebuilds"
APP_PORT="3141"
LIB_URL="${LIB_URL:-https://gitea.luki-net.org/luki-net/proxmox-scripts/raw/branch/main/lib}"
INSTALL_SCRIPT_URL="${INSTALL_SCRIPT_URL:-https://gitea.luki-net.org/luki-net/proxmox-scripts/raw/branch/main/install/devpi-install.sh}"
# App-specific defaults (override build.func defaults)
DEFAULT_HOSTNAME="devpi"
DEFAULT_DISK="20"
DEFAULT_CORES="2"
DEFAULT_RAM="2048"
source <(curl -fsSL "$LIB_URL/build.func")
print_app_summary() {
local devpi_pw
devpi_pw=$(pct exec "$CTID" -- bash -c "awk -F': ' '/^devpi root password/ {print \$2}' /root/devpi.credentials 2>/dev/null" | tr -d '\r\n')
cat <<EOF
Web UI / API: http://$IP_CT:$APP_PORT
Mirror index URL: http://$IP_CT:$APP_PORT/root/pypi/+simple/
devpi root password: $devpi_pw
Credentials file: /root/devpi.credentials (inside the LXC)
Persistent pip config (~/.pip/pip.conf or /etc/pip.conf):
[global]
index-url = http://$IP_CT:$APP_PORT/root/pypi/+simple/
trusted-host = $IP_CT
Dockerfile snippet:
ARG PIP_INDEX_URL=http://$IP_CT:$APP_PORT/root/pypi/+simple/
ENV PIP_INDEX_URL=\$PIP_INDEX_URL
ENV PIP_TRUSTED_HOST=$IP_CT
EOF
}
run_installer