diff --git a/ct/openviking.sh b/ct/openviking.sh new file mode 100644 index 000000000..e98b119fb --- /dev/null +++ b/ct/openviking.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +# Engine comes from community-scripts/core; this repo only ships the scripts. +# A local core checkout wins (COMMUNITY_SCRIPTS_CORE_DIR, else a sibling ../core), +# so a fork or branch of core can be tested without editing this file. +_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: Marcos Felipe (mfelipe) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/volcengine/OpenViking + +APP="OpenViking" +var_tags="${var_tags:-ai;memory;rag}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-8}" +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/openviking ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + msg_info "Updating Debian Packages" + $STD apt update + $STD apt -y upgrade + msg_ok "Updated Debian Packages" + + if check_for_gh_release "openviking-server" "volcengine/OpenViking"; then + msg_info "Stopping Service" + systemctl stop openviking + msg_ok "Stopped Service" + + msg_info "Updating ${APP}" + $STD uv pip install --python /opt/openviking/bin/python --upgrade openviking + msg_ok "Updated ${APP}" + + msg_info "Starting Service" + systemctl start openviking + msg_ok "Started Service" + 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 it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:1933/studio${CL}" +echo -e "${INFO}${YW}Root API Key:${CL}" +echo -e "${TAB}${DGN}$(pct exec "$CTID" -- sed -n 's/.*"root_api_key": "\([^"]*\)".*/\1/p' /opt/openviking_data/ov.conf)${CL}" +echo -e "${INFO}${YW}Model API keys are configured in /opt/openviking_data/ov.conf${CL}" +echo -e "${TAB}${DGN}Edit the file and restart the openviking service afterwards${CL}" diff --git a/install/openviking-install.sh b/install/openviking-install.sh new file mode 100644 index 000000000..73715996f --- /dev/null +++ b/install/openviking-install.sh @@ -0,0 +1,109 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: Marcos Felipe (mfelipe) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/volcengine/OpenViking + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt install -y openssl +msg_ok "Installed Dependencies" + +PYTHON_VERSION="3.12" setup_uv + +msg_info "Installing OpenViking" +$STD uv venv --python 3.12 /opt/openviking +$STD uv pip install --python /opt/openviking/bin/python openviking +cat <~/.openviking-server +$(get_latest_github_release "volcengine/OpenViking") +EOF +msg_ok "Installed OpenViking" + +msg_info "Configuring OpenViking" +ROOT_API_KEY=$(openssl rand -hex 32) +mkdir -p /opt/openviking_data +cat </opt/openviking_data/ov.conf +{ + "server": { + "host": "0.0.0.0", + "port": 1933, + "root_api_key": "${ROOT_API_KEY}", + "cors_origins": ["*"] + }, + "storage": { + "workspace": "/opt/openviking_data/data", + "agfs": { "backend": "local" }, + "vectordb": { "backend": "local" } + }, + "embedding": { + "dense": { + "api_base": "https://api.openai.com/v1", + "api_key": "REPLACE_WITH_YOUR_EMBEDDING_API_KEY", + "provider": "openai", + "dimension": 1536, + "model": "text-embedding-3-small" + } + }, + "vlm": { + "api_base": "https://api.openai.com/v1", + "api_key": "REPLACE_WITH_YOUR_VLM_API_KEY", + "provider": "openai", + "model": "gpt-4o" + } +} +EOF +chmod 600 /opt/openviking_data/ov.conf +msg_ok "Configured OpenViking" + +msg_info "Creating Service" +cat </etc/systemd/system/openviking.service +[Unit] +Description=OpenViking HTTP Server +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/openviking_data +Environment="OPENVIKING_CONFIG_FILE=/opt/openviking_data/ov.conf" +ExecStart=/opt/openviking/bin/openviking-server +Restart=always +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now openviking + +ready=0 +for _ in {1..60}; do + if curl -fsS -o /dev/null "http://127.0.0.1:1933/health"; then + ready=1 + break + fi + sleep 2 +done +if [[ "$ready" -ne 1 ]]; then + msg_error "OpenViking did not become healthy within 120 seconds — check 'systemctl status openviking'" + exit 1 +fi +msg_ok "Created Service" + +msg_info "Running OpenViking Doctor" +if OPENVIKING_CONFIG_FILE=/opt/openviking_data/ov.conf /opt/openviking/bin/openviking-server doctor >/dev/null 2>&1; then + msg_ok "Doctor check passed" +else + msg_warn "Doctor check reported warnings — configure the model API keys in /opt/openviking_data/ov.conf and restart the service" +fi + +motd_ssh +customize +cleanup_lxc