From 01ced07bff1f00c9abaee6657037c3d5eb5d8f84 Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 12:05:28 +0200 Subject: [PATCH] Zot-Registry (#5016) * 'Add new script' * fix curl call * update json --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com> --- ct/headers/zot-registry | 6 +++ ct/zot-registry.sh | 59 +++++++++++++++++++++++ frontend/public/json/zot-registry.json | 35 ++++++++++++++ install/zot-registry-install.sh | 65 ++++++++++++++++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 ct/headers/zot-registry create mode 100644 ct/zot-registry.sh create mode 100644 frontend/public/json/zot-registry.json create mode 100644 install/zot-registry-install.sh diff --git a/ct/headers/zot-registry b/ct/headers/zot-registry new file mode 100644 index 000000000..81c1fefd9 --- /dev/null +++ b/ct/headers/zot-registry @@ -0,0 +1,6 @@ + _____ __ ____ _ __ +/__ / ____ / /_ / __ \___ ____ _(_)____/ /________ __ + / / / __ \/ __/_____/ /_/ / _ \/ __ `/ / ___/ __/ ___/ / / / + / /__/ /_/ / /_/_____/ _, _/ __/ /_/ / (__ ) /_/ / / /_/ / +/____/\____/\__/ /_/ |_|\___/\__, /_/____/\__/_/ \__, / + /____/ /____/ diff --git a/ct/zot-registry.sh b/ct/zot-registry.sh new file mode 100644 index 000000000..a57223559 --- /dev/null +++ b/ct/zot-registry.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://zotregistry.dev/ + +APP="Zot-Registry" +var_tags="${var_tags:-registry;oci}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-5}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -f /usr/bin/zot ]]; then + msg_error "No ${APP} installation found!" + exit + fi + + RELEASE=$(curl -fsSL https://api.github.com/repos/project-zot/zot/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}') + if [[ ! -f ~/.${APP} ]] || [[ "${RELEASE}" != "$(cat ~/.${APP})" ]]; then + msg_info "Stopping Zot service" + systemctl stop zot + msg_ok "Stopped Zot service" + + msg_info "Updating Zot to ${RELEASE}" + curl -fsSL "https://github.com/project-zot/zot/releases/download/${RELEASE}/zot-linux-amd64" -o /usr/bin/zot + chmod +x /usr/bin/zot + chown root:root /usr/bin/zot + echo "${RELEASE}" >~/.${APP} + systemctl restart zot + msg_ok "Updated Zot to ${RELEASE}" + else + msg_ok "Zot is already up to date (${RELEASE})" + fi + + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}" diff --git a/frontend/public/json/zot-registry.json b/frontend/public/json/zot-registry.json new file mode 100644 index 000000000..d716c2dcf --- /dev/null +++ b/frontend/public/json/zot-registry.json @@ -0,0 +1,35 @@ +{ + "name": "Zot Registry", + "slug": "zot", + "categories": [ + 13 + ], + "date_created": "2025-06-05", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 8080, + "documentation": "https://zotregistry.dev/docs/intro/", + "website": "https://zotregistry.dev/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/zot-registry.webp", + "config_path": "/etc/zot/config.json", + "description": "Zot is a cloud-native OCI image registry focused on extensibility, maintainability, and performance. It supports advanced features such as Web UI, security scanning, authentication via htpasswd and OIDC, and more.", + "install_methods": [ + { + "type": "default", + "script": "ct/zot-registry.sh", + "resources": { + "cpu": 1, + "ram": 2048, + "hdd": 5, + "os": "Debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] +} diff --git a/install/zot-registry-install.sh b/install/zot-registry-install.sh new file mode 100644 index 000000000..f8d56190d --- /dev/null +++ b/install/zot-registry-install.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://zotregistry.dev/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y apache2-utils +msg_ok "Installed Dependencies" + +msg_info "Installing Zot Registry" +RELEASE=$(curl -fsSL https://api.github.com/repos/project-zot/zot/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +curl -fsSL "https://github.com/project-zot/zot/releases/download/${RELEASE}/zot-linux-amd64" -o /usr/bin/zot +chmod +x /usr/bin/zot +chown root:root /usr/bin/zot +mkdir -p /etc/zot +curl -fsSL https://raw.githubusercontent.com/project-zot/zot/refs/heads/main/examples/config-ui.json -o /etc/zot/config.json +ZOTPASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +$STD htpasswd -b -B -c /etc/zot/htpasswd admin "$ZOTPASSWORD" +{ + echo "Zot-Credentials" + echo "Zot User: admin" + echo "Zot Password: $ZOTPASSWORD" +} >>~/zot.creds +echo "${RELEASE}" >~/.${APP} +msg_ok "Installed Zot Registry" + +msg_info "Setup Service" +cat </etc/systemd/system/zot.service +[Unit] +Description=OCI Distribution Registry +Documentation=https://zotregistry.dev/ +After=network.target auditd.service local-fs.target + +[Service] +Type=simple +ExecStart=/usr/bin/zot serve /etc/zot/config.json +Restart=on-failure +User=root +LimitNOFILE=500000 +MemoryHigh=2G +MemoryMax=4G + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now zot +msg_ok "Setup Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"