readd portainer

This commit is contained in:
CanbiZ 2025-11-28 11:32:44 +01:00
parent 6da891f822
commit 3b366dc098

View File

@ -29,7 +29,7 @@ var_os="debian"
var_version="13" var_version="13"
DISK_SIZE="10G" DISK_SIZE="10G"
USE_CLOUD_INIT="no" USE_CLOUD_INIT="no"
# INSTALL_PORTAINER="no" INSTALL_PORTAINER="no"
OS_TYPE="" OS_TYPE=""
OS_VERSION="" OS_VERSION=""
@ -284,16 +284,16 @@ function select_cloud_init() {
fi fi
} }
# function select_portainer() { function select_portainer() {
# if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "PORTAINER" \ if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "PORTAINER" \
# --yesno "Install Portainer for Docker management?\n\nPortainer is a lightweight management UI for Docker.\n\nAccess after installation:\n• HTTP: http://<VM-IP>:9000\n• HTTPS: https://<VM-IP>:9443" 14 68); then --yesno "Install Portainer for Docker management?\n\nPortainer is a lightweight management UI for Docker.\n\nAccess after installation:\n• HTTP: http://<VM-IP>:9000\n• HTTPS: https://<VM-IP>:9443" 14 68); then
# INSTALL_PORTAINER="yes" INSTALL_PORTAINER="yes"
# echo -e "${ADVANCED}${BOLD}${DGN}Portainer: ${BGN}yes${CL}" echo -e "${ADVANCED}${BOLD}${DGN}Portainer: ${BGN}yes${CL}"
# else else
# INSTALL_PORTAINER="no" INSTALL_PORTAINER="no"
# echo -e "${ADVANCED}${BOLD}${DGN}Portainer: ${BGN}no${CL}" echo -e "${ADVANCED}${BOLD}${DGN}Portainer: ${BGN}no${CL}"
# fi fi
# } }
function get_image_url() { function get_image_url() {
local arch=$(dpkg --print-architecture) local arch=$(dpkg --print-architecture)
@ -323,7 +323,7 @@ function default_settings() {
select_cloud_init select_cloud_init
# Portainer Selection - ALWAYS ask # Portainer Selection - ALWAYS ask
# select_portainer select_portainer
# Set defaults for other settings # Set defaults for other settings
VMID=$(get_valid_nextid) VMID=$(get_valid_nextid)
@ -367,7 +367,7 @@ function advanced_settings() {
select_cloud_init select_cloud_init
# Portainer Selection - ALWAYS ask (at the beginning) # Portainer Selection - ALWAYS ask (at the beginning)
# select_portainer select_portainer
METHOD="advanced" METHOD="advanced"
[ -z "${VMID:-}" ] && VMID=$(get_valid_nextid) [ -z "${VMID:-}" ] && VMID=$(get_valid_nextid)
@ -711,20 +711,20 @@ touch /root/.docker-installed
INSTALLEOF" >/dev/null INSTALLEOF" >/dev/null
# Add Portainer installation script if requested # Add Portainer installation script if requested
# if [ "$INSTALL_PORTAINER" = "yes" ]; then if [ "$INSTALL_PORTAINER" = "yes" ]; then
# virt-customize -q -a "${FILE}" --run-command "cat > /root/install-portainer.sh << 'PORTAINEREOF' virt-customize -q -a "${FILE}" --run-command "cat > /root/install-portainer.sh << 'PORTAINEREOF'
# #!/bin/bash #!/bin/bash
# exec >> /var/log/install-docker.log 2>&1 exec >> /var/log/install-docker.log 2>&1
# echo \"[\\$(date)] Installing Portainer\" echo \"[\\$(date)] Installing Portainer\"
# docker volume create portainer_data 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 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
# echo \"[\\$(date)] Portainer installed and started\" echo \"[\\$(date)] Portainer installed and started\"
# PORTAINEREOF" >/dev/null PORTAINEREOF\" >/dev/null
# virt-customize -q -a "${FILE}" --run-command "chmod +x /root/install-portainer.sh" >/dev/null virt-customize -q -a "${FILE}" --run-command "chmod +x /root/install-portainer.sh" >/dev/null
# virt-customize -q -a "${FILE}" --run-command "sed -i 's|INSTALL_PORTAINER_PLACEHOLDER|/root/install-portainer.sh|' /root/install-docker.sh" >/dev/null virt-customize -q -a "${FILE}" --run-command "sed -i 's|INSTALL_PORTAINER_PLACEHOLDER|/root/install-portainer.sh|' /root/install-docker.sh" >/dev/null
# else else
# virt-customize -q -a "${FILE}" --run-command "sed -i 's|INSTALL_PORTAINER_PLACEHOLDER|echo \"[\\\\\\$(date)] Skipping Portainer installation\"|' /root/install-docker.sh" >/dev/null virt-customize -q -a "${FILE}" --run-command "sed -i 's|INSTALL_PORTAINER_PLACEHOLDER|echo \"[\\\\\\$(date)] Skipping Portainer installation\"|' /root/install-docker.sh" >/dev/null
# fi fi
virt-customize -q -a "${FILE}" --run-command "chmod +x /root/install-docker.sh" >/dev/null virt-customize -q -a "${FILE}" --run-command "chmod +x /root/install-docker.sh" >/dev/null
@ -899,15 +899,15 @@ else
echo -e "${TAB}${DGN}Docker: ${BGN}Latest (via get.docker.com)${CL}" echo -e "${TAB}${DGN}Docker: ${BGN}Latest (via get.docker.com)${CL}"
fi fi
# if [ "$INSTALL_PORTAINER" = "yes" ]; then if [ "$INSTALL_PORTAINER" = "yes" ]; then
# if [ -n "$VM_IP" ]; then if [ -n "$VM_IP" ]; then
# echo -e "${TAB}${DGN}Portainer: ${BGN}https://${VM_IP}:9443${CL}" echo -e "${TAB}${DGN}Portainer: ${BGN}https://${VM_IP}:9443${CL}"
# else else
# echo -e "${TAB}${DGN}Portainer: ${BGN}Will be accessible at https://<VM-IP>:9443${CL}" echo -e "${TAB}${DGN}Portainer: ${BGN}Will be accessible at https://<VM-IP>:9443${CL}"
# echo -e "${TAB}${YW}⚠️ Wait 2-3 minutes after boot for installation to complete${CL}" echo -e "${TAB}${YW}⚠️ Wait 2-3 minutes after boot for installation to complete${CL}"
# echo -e "${TAB}${YW}⚠️ Get IP with: ${BL}qm guest cmd ${VMID} network-get-interfaces${CL}" echo -e "${TAB}${YW}⚠️ Get IP with: ${BL}qm guest cmd ${VMID} network-get-interfaces${CL}"
# fi fi
# fi fi
if [ "$USE_CLOUD_INIT" = "yes" ]; then if [ "$USE_CLOUD_INIT" = "yes" ]; then
display_cloud_init_info "$VMID" "$HN" display_cloud_init_info "$VMID" "$HN"
fi fi