From 8a7e004bf4cd770e3055acddf378dd4cdd1d2e58 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, 13 Nov 2026 07:41:25 +0000 Subject: [PATCH] Add chroma (ct) --- ct/chroma.sh | 68 +++++++++++++++++++++++++++++++++++++++ install/chroma-install.sh | 57 ++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 ct/chroma.sh create mode 100644 install/chroma-install.sh diff --git a/ct/chroma.sh b/ct/chroma.sh new file mode 100644 index 000000000..6452c0575 --- /dev/null +++ b/ct/chroma.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/chroma-core/chroma + +APP="Chroma" +var_tags="${var_tags:-database;vector;ai}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-1024}" +var_disk="${var_disk:-4}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_arm64="${var_arm64:-yes}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/chroma ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + CURRENT=$(cat ~/.chroma) + RELEASE=$(curl -fsSL https://pypi.org/pypi/chromadb/json | jq -r '.info.version') + if [[ "$CURRENT" == "$RELEASE" ]]; then + msg_ok "No update available: Chroma (${CURRENT})" + exit + fi + + msg_info "Stopping Chroma" + systemctl stop chroma + msg_ok "Stopped Chroma" + + PYTHON_VERSION="3.12" setup_uv + + msg_info "Updating Chroma to ${RELEASE}" + $STD uv pip install --upgrade --python /opt/chroma/.venv/bin/python "chromadb==${RELEASE}" + cat <~/.chroma +${RELEASE} +EOF + msg_ok "Updated Chroma to ${RELEASE}" + + msg_info "Starting Chroma" + systemctl start chroma + msg_ok "Started Chroma" + msg_ok "Updated successfully!" + 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 "${GATEWAY}${BGN}http://${IP}:8000/docs${CL}" diff --git a/install/chroma-install.sh b/install/chroma-install.sh new file mode 100644 index 000000000..8797979c3 --- /dev/null +++ b/install/chroma-install.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/chroma-core/chroma + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +PYTHON_VERSION="3.12" setup_uv + +CHROMA_VERSION="${var_appversion:-$(curl -fsSL https://pypi.org/pypi/chromadb/json | jq -r '.info.version')}" +msg_info "Installing Chroma ${CHROMA_VERSION}" +$STD uv venv --python 3.12 /opt/chroma/.venv +$STD uv pip install --python /opt/chroma/.venv/bin/python "chromadb==${CHROMA_VERSION}" +cat <~/.chroma +${CHROMA_VERSION} +EOF +msg_ok "Installed Chroma ${CHROMA_VERSION}" + +msg_info "Configuring Chroma" +mkdir -p /opt/chroma_data +cat </opt/chroma_data/config.yaml +persist_path: "/opt/chroma_data" +listen_address: "0.0.0.0" +port: 8000 +EOF +msg_ok "Configured Chroma" + +msg_info "Creating Service" +cat </etc/systemd/system/chroma.service +[Unit] +Description=Chroma +After=network.target + +[Service] +Type=simple +WorkingDirectory=/opt/chroma_data +ExecStart=/opt/chroma/.venv/bin/chroma run /opt/chroma_data/config.yaml +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now chroma +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc