mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-08-02 19:13:04 +02:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f7df8aad9c |
+10
-1
@@ -118,10 +118,19 @@ function update_script() {
|
||||
export UV_COMPILE_BYTECODE="1"
|
||||
export UV_LINK_MODE="copy"
|
||||
export UV_NATIVE_TLS="1"
|
||||
export UV_HTTP_TIMEOUT="300"
|
||||
export RUSTUP_PERMIT_COPY_RENAME="true"
|
||||
export UV_PYTHON_INSTALL_DIR="/usr/local/bin"
|
||||
cd /opt/authentik
|
||||
$STD uv sync --frozen --no-install-project --no-dev
|
||||
for attempt in 1 2 3; do
|
||||
if [[ $attempt -eq 3 ]]; then
|
||||
$STD uv sync --frozen --no-install-project --no-dev
|
||||
break
|
||||
fi
|
||||
$STD uv sync --frozen --no-install-project --no-dev && break
|
||||
msg_warn "uv sync attempt $attempt failed, retrying..."
|
||||
sleep $((attempt * 15))
|
||||
done
|
||||
chown -R authentik:authentik /opt/authentik
|
||||
msg_ok "Updated python server"
|
||||
|
||||
|
||||
+16
-5
@@ -37,9 +37,20 @@ function update_script() {
|
||||
fi
|
||||
|
||||
if docker ps -a --format '{{.Image}}' | grep -q '^portainer/portainer-ce:latest$'; then
|
||||
msg_warn "Portainer is now managed by a dedicated addon script and is no longer updated here."
|
||||
echo -e "${TAB}Update/migrate it with:"
|
||||
echo -e "${TAB}${TAB}${GN}bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/portainer.sh)\"${CL}"
|
||||
msg_info "Updating Portainer"
|
||||
$STD docker pull portainer/portainer-ce:latest
|
||||
$STD docker stop portainer
|
||||
$STD docker rm portainer
|
||||
$STD docker volume create portainer_data >/dev/null 2>&1
|
||||
$STD docker run -d \
|
||||
-p 8000:8000 \
|
||||
-p 9443:9443 \
|
||||
--name=portainer \
|
||||
--restart=always \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v portainer_data:/data \
|
||||
portainer/portainer-ce:latest
|
||||
msg_ok "Updated Portainer"
|
||||
fi
|
||||
|
||||
if docker ps -a --format '{{.Names}}' | grep -q '^portainer_agent$'; then
|
||||
@@ -66,5 +77,5 @@ description
|
||||
|
||||
msg_ok "Completed successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW} Portainer is available as a separate addon. Install it with:${CL}"
|
||||
echo -e "${GATEWAY}${BGN}bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/portainer.sh)\"${CL}"
|
||||
echo -e "${INFO}${YW} If you installed Portainer, access it at the following URL:${CL}"
|
||||
echo -e "${GATEWAY}${BGN}https://${IP}:9443${CL}"
|
||||
|
||||
@@ -26,21 +26,23 @@ msg_ok "Installed Docker"
|
||||
get_latest_release() {
|
||||
curl -fsSL https://api.github.com/repos/"$1"/releases/latest | grep '"tag_name":' | cut -d'"' -f4
|
||||
}
|
||||
PORTAINER_LATEST_VERSION=$(get_latest_release "portainer/portainer")
|
||||
DOCKER_COMPOSE_LATEST_VERSION=$(get_latest_release "docker/compose")
|
||||
PORTAINER_AGENT_LATEST_VERSION=$(get_latest_release "portainer/agent")
|
||||
|
||||
read -r -p "${TAB3}Would you like to add Docker Compose? <y/N> " prompt
|
||||
read -r -p "${TAB3}Would you like to add Portainer? <y/N> " prompt
|
||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Installing Docker Compose $DOCKER_COMPOSE_LATEST_VERSION"
|
||||
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
|
||||
mkdir -p "$DOCKER_CONFIG"/cli-plugins
|
||||
curl -fsSL https://github.com/docker/compose/releases/download/"$DOCKER_COMPOSE_LATEST_VERSION"/docker-compose-linux-$(arch_resolve "x86_64" "aarch64") -o ~/.docker/cli-plugins/docker-compose
|
||||
chmod +x "$DOCKER_CONFIG"/cli-plugins/docker-compose
|
||||
msg_ok "Installed Docker Compose $DOCKER_COMPOSE_LATEST_VERSION"
|
||||
fi
|
||||
|
||||
if prompt_confirm "${TAB3}Would you like to install Portainer (UI) via the community-scripts addon?" "n" 60; then
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/portainer.sh)" <<<"y"
|
||||
msg_info "Installing Portainer $PORTAINER_LATEST_VERSION"
|
||||
docker volume create portainer_data >/dev/null
|
||||
$STD docker run -d \
|
||||
-p 8000:8000 \
|
||||
-p 9443:9443 \
|
||||
--name=portainer \
|
||||
--restart=always \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v portainer_data:/data \
|
||||
portainer/portainer-ce:latest
|
||||
msg_ok "Installed Portainer $PORTAINER_LATEST_VERSION"
|
||||
else
|
||||
read -r -p "${TAB3}Would you like to add the Portainer Agent? <y/N> " prompt
|
||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
@@ -55,12 +57,21 @@ else
|
||||
msg_ok "Installed Portainer Agent $PORTAINER_AGENT_LATEST_VERSION"
|
||||
fi
|
||||
fi
|
||||
read -r -p "${TAB3}Would you like to add Docker Compose? <y/N> " prompt
|
||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Installing Docker Compose $DOCKER_COMPOSE_LATEST_VERSION"
|
||||
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
|
||||
mkdir -p "$DOCKER_CONFIG"/cli-plugins
|
||||
curl -fsSL https://github.com/docker/compose/releases/download/"$DOCKER_COMPOSE_LATEST_VERSION"/docker-compose-linux-$(arch_resolve "x86_64" "aarch64") -o ~/.docker/cli-plugins/docker-compose
|
||||
chmod +x "$DOCKER_CONFIG"/cli-plugins/docker-compose
|
||||
msg_ok "Installed Docker Compose $DOCKER_COMPOSE_LATEST_VERSION"
|
||||
fi
|
||||
|
||||
read -r -p "${TAB3}Would you like to expose the Docker TCP socket? <y/N> " prompt
|
||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Exposing Docker TCP socket"
|
||||
$STD mkdir -p /etc/docker
|
||||
$STD echo '{ "hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2375"] }' >/etc/docker/daemon.json
|
||||
$STD echo '{ "hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2375"] }' > /etc/docker/daemon.json
|
||||
$STD rc-service docker restart
|
||||
msg_ok "Exposed Docker TCP socket at tcp://+:2375"
|
||||
fi
|
||||
|
||||
@@ -122,9 +122,18 @@ export UV_NO_BINARY_PACKAGE="cryptography lxml python-kadmin-rs xmlsec"
|
||||
export UV_COMPILE_BYTECODE="1"
|
||||
export UV_LINK_MODE="copy"
|
||||
export UV_NATIVE_TLS="1"
|
||||
export UV_HTTP_TIMEOUT="300"
|
||||
export UV_PYTHON_INSTALL_DIR="/usr/local/bin"
|
||||
cd /opt/authentik
|
||||
$STD uv sync --frozen --no-install-project --no-dev
|
||||
for attempt in 1 2 3; do
|
||||
if [[ $attempt -eq 3 ]]; then
|
||||
$STD uv sync --frozen --no-install-project --no-dev
|
||||
break
|
||||
fi
|
||||
$STD uv sync --frozen --no-install-project --no-dev && break
|
||||
msg_warn "uv sync attempt $attempt failed, retrying..."
|
||||
sleep $((attempt * 15))
|
||||
done
|
||||
cp /opt/authentik/authentik/sources/kerberos/krb5.conf /etc/krb5.conf
|
||||
msg_ok "Setup python server"
|
||||
|
||||
|
||||
@@ -15,11 +15,11 @@ update_os
|
||||
|
||||
PORTAINER_AGENT_LATEST_VERSION=$(get_latest_github_release "portainer/agent")
|
||||
|
||||
setup_docker
|
||||
|
||||
if prompt_confirm "${TAB3}Would you like to install Portainer (UI) via the community-scripts addon?" "n" 60; then
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/portainer.sh)" <<<"y"
|
||||
read -r -p "${TAB3}Would you like to add Portainer (UI)? <y/N> " prompt
|
||||
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||
DOCKER_PORTAINER="true" setup_docker
|
||||
else
|
||||
setup_docker
|
||||
read -r -p "${TAB3}Would you like to install the Portainer Agent (for remote management)? <y/N> " prompt_agent
|
||||
if [[ ${prompt_agent,,} =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Installing Portainer Agent $PORTAINER_AGENT_LATEST_VERSION"
|
||||
|
||||
@@ -32,8 +32,7 @@ get_latest_release() {
|
||||
|
||||
CORE_LATEST_VERSION=$(get_latest_release "home-assistant/core")
|
||||
|
||||
setup_docker
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/portainer.sh)" <<<"y"
|
||||
DOCKER_PORTAINER="true" setup_docker
|
||||
|
||||
msg_info "Pulling Home Assistant $CORE_LATEST_VERSION Image"
|
||||
$STD docker pull ghcr.io/home-assistant/home-assistant:stable
|
||||
|
||||
+60
-2
@@ -4599,17 +4599,20 @@ setup_composer() {
|
||||
# - By default uses distro repository (docker.io) for stability
|
||||
# - Optionally uses official Docker repository for latest features
|
||||
# - Detects and migrates old Docker installations
|
||||
# - Optional: Installs/Updates Portainer CE
|
||||
# - Updates running containers interactively
|
||||
# - Cleans up legacy repository files
|
||||
#
|
||||
# Usage:
|
||||
# setup_docker # Uses official Docker repo (recommended)
|
||||
# USE_DOCKER_REPO=false setup_docker # Uses distro docker.io package
|
||||
# DOCKER_PORTAINER="true" setup_docker
|
||||
# DOCKER_LOG_DRIVER="json-file" setup_docker
|
||||
#
|
||||
# Variables:
|
||||
# USE_DOCKER_REPO - Set to "false" to use distro docker.io package
|
||||
# (default: true, uses official Docker repository)
|
||||
# DOCKER_PORTAINER - Install Portainer CE (optional, "true" to enable)
|
||||
# DOCKER_LOG_DRIVER - Log driver (optional, default: "journald")
|
||||
# DOCKER_SKIP_UPDATES - Skip container update check (optional, "true" to skip)
|
||||
#
|
||||
@@ -4620,7 +4623,7 @@ setup_composer() {
|
||||
# - Interactive per-container update prompt (Y/N, 60 s auto-no)
|
||||
# - Compose-managed containers: full restart via docker compose
|
||||
# - Standalone containers: image pull only, no destructive stop/rm
|
||||
# - Portainer is no longer managed here; use tools/addon/portainer.sh
|
||||
# - Portainer installation and update support
|
||||
# - Set DOCKER_NONINTERACTIVE=1 to skip interactive prompts (CI/unattended)
|
||||
# ------------------------------------------------------------------------------
|
||||
_docker_is_noninteractive() {
|
||||
@@ -4629,6 +4632,7 @@ _docker_is_noninteractive() {
|
||||
|
||||
setup_docker() {
|
||||
local docker_installed=false
|
||||
local portainer_installed=false
|
||||
local USE_DOCKER_REPO="${USE_DOCKER_REPO:-true}"
|
||||
|
||||
# Check if Docker is already installed
|
||||
@@ -4638,6 +4642,12 @@ setup_docker() {
|
||||
msg_info "Docker $DOCKER_CURRENT_VERSION detected"
|
||||
fi
|
||||
|
||||
# Check if Portainer is running
|
||||
if docker ps --format '{{.Names}}' 2>/dev/null | grep -q '^portainer$'; then
|
||||
portainer_installed=true
|
||||
msg_info "Portainer container detected"
|
||||
fi
|
||||
|
||||
# Scenario 1: Use distro repository (opt-out via USE_DOCKER_REPO=false)
|
||||
if [[ "$USE_DOCKER_REPO" != "true" && "$USE_DOCKER_REPO" != "TRUE" && "$USE_DOCKER_REPO" != "1" ]]; then
|
||||
|
||||
@@ -4751,6 +4761,54 @@ EOF
|
||||
systemctl enable -q --now docker
|
||||
fi
|
||||
|
||||
# Portainer Management (common for both modes)
|
||||
if [[ "${DOCKER_PORTAINER:-}" == "true" ]]; then
|
||||
if [ "$portainer_installed" = true ]; then
|
||||
msg_info "Checking for Portainer updates"
|
||||
PORTAINER_CURRENT=$(docker inspect portainer --format='{{.Config.Image}}' 2>/dev/null | cut -d':' -f2)
|
||||
PORTAINER_LATEST=$(curl -fsSL https://registry.hub.docker.com/v2/repositories/portainer/portainer-ce/tags?page_size=100 | grep -oP '"name":"\K[0-9]+\.[0-9]+\.[0-9]+"' | head -1 | tr -d '"')
|
||||
|
||||
if [ "$PORTAINER_CURRENT" != "$PORTAINER_LATEST" ]; then
|
||||
if _docker_is_noninteractive; then
|
||||
msg_info "Skipping Portainer update prompt (non-interactive)"
|
||||
else
|
||||
read -r -p "${TAB3}Update Portainer $PORTAINER_CURRENT → $PORTAINER_LATEST? <y/N> " prompt
|
||||
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||
msg_info "Updating Portainer"
|
||||
docker stop portainer
|
||||
docker rm portainer
|
||||
docker pull portainer/portainer-ce:latest
|
||||
docker run -d \
|
||||
-p 9000:9000 \
|
||||
-p 9443:9443 \
|
||||
--name=portainer \
|
||||
--restart=always \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v portainer_data:/data \
|
||||
portainer/portainer-ce:latest
|
||||
msg_ok "Updated Portainer to $PORTAINER_LATEST"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
msg_ok "Portainer is up-to-date ($PORTAINER_CURRENT)"
|
||||
fi
|
||||
else
|
||||
msg_info "Installing Portainer"
|
||||
docker volume create portainer_data
|
||||
docker run -d \
|
||||
-p 9000:9000 \
|
||||
-p 9443:9443 \
|
||||
--name=portainer \
|
||||
--restart=always \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v portainer_data:/data \
|
||||
portainer/portainer-ce:latest
|
||||
|
||||
LOCAL_IP=$(hostname -I | awk '{print $1}')
|
||||
msg_ok "Installed Portainer (http://${LOCAL_IP}:9000)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Container Update Check
|
||||
# - Skipped entirely when running unattended / non-interactive
|
||||
# - Compose-managed containers: offered via Y/N → docker compose pull + up -d
|
||||
@@ -4766,7 +4824,7 @@ EOF
|
||||
name=$(echo "$line" | awk '{print $1}')
|
||||
image=$(echo "$line" | awk '{print $2}')
|
||||
|
||||
# Portainer is managed by its own addon script, not this generic loop
|
||||
# Portainer containers are handled by the dedicated block above
|
||||
[[ "$name" == "portainer" || "$name" == "portainer_agent" ]] && continue
|
||||
|
||||
current_digest=$(docker inspect "$name" --format='{{.Image}}' 2>/dev/null | cut -d':' -f2 | cut -c1-12)
|
||||
|
||||
Reference in New Issue
Block a user