Compare commits

..
Author SHA1 Message Date
push-app-to-main[bot] 1419ade972 Add hindsight (ct) 2026-11-29 08:07:38 +00:00
4 changed files with 164 additions and 129 deletions

No files matched your search

-62
View File
@@ -1,62 +0,0 @@
#!/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: TaiKamilla
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://www.cloudpanel.io/
APP="CloudPanel"
var_tags="${var_tags:-webserver;hosting;php}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-20}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-yes}"
var_unprivileged="${var_unprivileged:-1}"
export var_db_engine="${var_db_engine:-}"
export var_admin_user="${var_admin_user:-}"
export var_admin_email="${var_admin_email:-}"
export var_admin_pass="${var_admin_pass:-}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -f /home/clp/htdocs/app/data/db.sq3 ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
$STD apt update
if [[ -z "$(apt list --upgradable 2>/dev/null | grep '/')" ]]; then
msg_ok "No update required. ${APP} is already up to date"
exit
fi
msg_info "Updating CloudPanel"
$STD clp-update
$STD apt -y --with-new-pkgs --allow-downgrades upgrade
msg_ok "Updated CloudPanel"
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}https://${IP}:8443${CL}"
echo -e "${INFO}${YW}Admin credentials: ~/cloudpanel.creds (inside the container)${CL}"
+75
View File
@@ -0,0 +1,75 @@
#!/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: andy-vdg
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://hindsight.vectorize.io/
APP="Hindsight"
var_tags="${var_tags:-ai;memory;mcp}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-12}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
#var_arm64="${var_arm64:-no}" # unset = ask the user; set yes/no only when verified
var_unprivileged="${var_unprivileged:-1}"
export var_llm_provider="${var_llm_provider:-}"
export var_llm_api_key="${var_llm_api_key:-}"
export var_llm_model="${var_llm_model:-}"
export var_llm_base_url="${var_llm_base_url:-}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/hindsight ]]; then
msg_error "No Hindsight Installation Found!"
exit
fi
if check_for_gh_release "hindsight" "vectorize-io/hindsight"; then
msg_info "Stopping Hindsight"
systemctl stop hindsight
msg_ok "Stopped Hindsight"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "hindsight" "vectorize-io/hindsight" "tarball"
PYTHON_VERSION="3.11" UV_PROJECT_DIR="/opt/hindsight" setup_uv
msg_info "Updating Python Environment"
cd /opt/hindsight
$STD uv sync --locked --package hindsight-api-slim --extra local-ml
HOME=/opt/hindsight_data $STD /opt/hindsight/.venv/bin/python -c "from sentence_transformers import SentenceTransformer, CrossEncoder; from hindsight_api.config import DEFAULT_EMBEDDINGS_LOCAL_MODEL as E, DEFAULT_RERANKER_LOCAL_MODEL as R; SentenceTransformer(E); CrossEncoder(R)"
if ! grep -q '^HF_HUB_OFFLINE=' /opt/hindsight.env; then
cat <<EOF >>/opt/hindsight.env
HF_HUB_OFFLINE=1
EOF
fi
msg_ok "Updated Python Environment"
msg_info "Starting Hindsight"
systemctl start hindsight
msg_ok "Started Hindsight"
msg_ok "Updated successfully!"
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 the API and its interactive docs using the following URL:${CL}"
echo -e "${GATEWAY}${BGN}http://${IP}:8888/docs${CL}"
echo -e "${INFO}${YW}API key: ~/hindsight.creds (inside the container)${CL}"
-67
View File
@@ -1,67 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: TaiKamilla
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://www.cloudpanel.io/
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
var_db_engine="${var_db_engine:-MARIADB_12.3}"
if [[ ! "$var_db_engine" =~ ^(MARIADB_12\.3|MARIADB_11\.8|MYSQL_8\.4)$ ]]; then
msg_warn "Unsupported database engine '${var_db_engine}', using MARIADB_12.3"
var_db_engine="MARIADB_12.3"
fi
var_admin_user="${var_admin_user:-admin}"
if [[ ! "$var_admin_user" =~ ^[A-Za-z0-9._-]{3,}$ ]]; then
msg_warn "Invalid admin user '${var_admin_user}' (3+ letters, digits, dots, dashes or underscores), using admin"
var_admin_user="admin"
fi
var_admin_email="${var_admin_email:-admin@example.com}"
if [[ ! "$var_admin_email" =~ ^[^@[:space:]]+@[^@[:space:]]+\.[^@[:space:]]+$ ]]; then
msg_warn "Invalid admin email '${var_admin_email}', using admin@example.com"
var_admin_email="admin@example.com"
fi
var_admin_pass="${var_admin_pass:-$(random_password 20)}"
confirm_external_installer "https://www.cloudpanel.io/" "https://installer.cloudpanel.io/ce/v2/install.sh"
msg_info "Installing Dependencies"
$STD apt install -y openssh-server wget
msg_ok "Installed Dependencies"
msg_info "Installing CloudPanel (Patience)"
curl_with_retry "https://installer.cloudpanel.io/ce/v2/install.sh" /tmp/cloudpanel-install.sh
if ! sha256sum -c --status <<<"8146dbe0a488e7088b04071b0c34d59aa0ab1fe9dcec382d395fd155c9e6c476 /tmp/cloudpanel-install.sh"; then
msg_error "The CloudPanel installer does not match the checksum published in its documentation"
exit 1
fi
# SWAP=false: dphys-swapfile cannot manage swap inside a container
$STD env HOME=/root SWAP=false DB_ENGINE="$var_db_engine" bash /tmp/cloudpanel-install.sh
rm -f /tmp/cloudpanel-install.sh
systemctl disable -q --now chrony
if systemctl is-failed -q chrony; then
systemctl reset-failed chrony
fi
msg_ok "Installed CloudPanel"
msg_info "Creating CloudPanel Admin"
$STD clpctl user:add --userName="$var_admin_user" --email="$var_admin_email" --firstName="Admin" --lastName="CloudPanel" --password="$var_admin_pass" --role="admin" --timezone="UTC" --status="1"
cat <<EOF >~/cloudpanel.creds
CloudPanel Admin
URL: https://${LOCAL_IP}:8443
Username: ${var_admin_user}
Password: ${var_admin_pass}
EOF
chmod 600 ~/cloudpanel.creds
msg_ok "Created CloudPanel Admin"
motd_ssh
customize
cleanup_lxc
+89
View File
@@ -0,0 +1,89 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: andy-vdg
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://hindsight.vectorize.io/
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
PG_VERSION="18" PG_MODULES="pgvector" setup_postgresql
PG_DB_NAME="hindsight" PG_DB_USER="hindsight" PG_DB_EXTENSIONS="vector,pg_trgm,btree_gin" setup_postgresql_db
fetch_and_deploy_gh_release "hindsight" "vectorize-io/hindsight" "tarball"
PYTHON_VERSION="3.11" UV_PROJECT_DIR="/opt/hindsight" setup_uv
msg_info "Setting up Python Environment"
cd /opt/hindsight
$STD uv sync --locked --package hindsight-api-slim --extra local-ml
msg_ok "Set up Python Environment"
msg_info "Downloading Embedding and Reranker Models"
mkdir -p /opt/hindsight_data
HOME=/opt/hindsight_data $STD /opt/hindsight/.venv/bin/python -c "from sentence_transformers import SentenceTransformer, CrossEncoder; from hindsight_api.config import DEFAULT_EMBEDDINGS_LOCAL_MODEL as E, DEFAULT_RERANKER_LOCAL_MODEL as R; SentenceTransformer(E); CrossEncoder(R)"
msg_ok "Downloaded Embedding and Reranker Models"
msg_info "Configuring Hindsight"
API_KEY=$(random_password 48)
cat <<EOF >/opt/hindsight.env
HINDSIGHT_API_HOST=0.0.0.0
HINDSIGHT_API_PORT=8888
HINDSIGHT_API_DATABASE_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@127.0.0.1:5432/${PG_DB_NAME}
HINDSIGHT_API_TENANT_EXTENSION=hindsight_api.extensions.builtin.tenant:ApiKeyTenantExtension
HINDSIGHT_API_TENANT_API_KEY=${API_KEY}
HINDSIGHT_API_LLM_PROVIDER=${var_llm_provider:-none}
HINDSIGHT_API_LLM_API_KEY=${var_llm_api_key:-}
HINDSIGHT_API_LLM_MODEL=${var_llm_model:-}
HINDSIGHT_API_LLM_BASE_URL=${var_llm_base_url:-}
TRANSFORMERS_VERBOSITY=error
HF_HUB_VERBOSITY=error
TOKENIZERS_PARALLELISM=false
# models are cached at install; online, startup stalls on a slow huggingface.co (vectorize-io/hindsight#6494)
HF_HUB_OFFLINE=1
EOF
sed -i '/=$/d' /opt/hindsight.env
chmod 600 /opt/hindsight.env
cat <<EOF >>~/hindsight.creds
Hindsight API Key: ${API_KEY}
EOF
chmod 600 ~/hindsight.creds
msg_ok "Configured Hindsight"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/hindsight.service
[Unit]
Description=Hindsight API
Wants=network-online.target
After=network-online.target postgresql.service
Requires=postgresql.service
[Service]
Type=simple
User=root
WorkingDirectory=/opt/hindsight_data
Environment=HOME=/opt/hindsight_data
Environment=PYTHONUNBUFFERED=1
EnvironmentFile=/opt/hindsight.env
ExecStart=/opt/hindsight/.venv/bin/hindsight-api
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now hindsight
msg_ok "Created Service"
if [[ "${var_llm_provider:-none}" == "none" ]]; then
msg_warn "No LLM configured: Hindsight stores plain chunks only. Set HINDSIGHT_API_LLM_PROVIDER and its key in /opt/hindsight.env, then run systemctl restart hindsight"
fi
motd_ssh
customize
cleanup_lxc