|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Engine comes from community-scripts/core; this repo only ships the scripts. |
| 3 | +# A local core checkout wins (COMMUNITY_SCRIPTS_CORE_DIR, else a sibling ../core), |
| 4 | +# so a fork or branch of core can be tested without editing this file. |
| 5 | +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" |
| 6 | +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") |
| 7 | +# Copyright (c) 2021-2026 community-scripts ORG |
| 8 | +# Author: Marcos Felipe (mfelipe) |
| 9 | +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE |
| 10 | +# Source: https://github.com/volcengine/OpenViking |
| 11 | + |
| 12 | +APP="OpenViking" |
| 13 | +var_tags="${var_tags:-ai;memory;rag}" |
| 14 | +var_arm64="${var_arm64:-yes}" |
| 15 | +var_unprivileged="${var_unprivileged:-1}" |
| 16 | +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then |
| 17 | + var_os=$(msg_menu "Choose the container OS" \ |
| 18 | + "debian" "Debian 13 (recommended)" \ |
| 19 | + "alpine" "Alpine 3.24 (smaller footprint)") |
| 20 | +fi |
| 21 | + |
| 22 | +if [[ "${var_os:-}" == "alpine" ]]; then |
| 23 | + var_cpu="${var_cpu:-1}" |
| 24 | + var_ram="${var_ram:-1024}" |
| 25 | + var_disk="${var_disk:-8}" |
| 26 | + var_version="${var_version:-3.24}" |
| 27 | +else |
| 28 | + var_cpu="${var_cpu:-2}" |
| 29 | + var_ram="${var_ram:-2048}" |
| 30 | + var_disk="${var_disk:-8}" |
| 31 | + var_version="${var_version:-13}" |
| 32 | +fi |
| 33 | + |
| 34 | +header_info "$APP" |
| 35 | +variables |
| 36 | +color |
| 37 | +catch_errors |
| 38 | + |
| 39 | +update_deb_based() { |
| 40 | + if [[ ! -d /opt/openviking ]]; then |
| 41 | + msg_error "No ${APP} Installation Found!" |
| 42 | + exit |
| 43 | + fi |
| 44 | + |
| 45 | + msg_info "Updating Debian Packages" |
| 46 | + $STD apt update |
| 47 | + $STD apt -y upgrade |
| 48 | + msg_ok "Updated Debian Packages" |
| 49 | + |
| 50 | + if check_for_gh_release "openviking-server" "volcengine/OpenViking"; then |
| 51 | + msg_info "Stopping Service" |
| 52 | + systemctl stop openviking |
| 53 | + msg_ok "Stopped Service" |
| 54 | + |
| 55 | + msg_info "Updating ${APP}" |
| 56 | + $STD uv pip install --python /opt/openviking/bin/python --upgrade openviking |
| 57 | + msg_ok "Updated ${APP}" |
| 58 | + |
| 59 | + msg_info "Starting Service" |
| 60 | + systemctl start openviking |
| 61 | + msg_ok "Started Service" |
| 62 | + msg_ok "Updated successfully!" |
| 63 | + fi |
| 64 | +} |
| 65 | + |
| 66 | +update_alpine() { |
| 67 | + if [[ ! -d /opt/openviking ]]; then |
| 68 | + msg_error "No ${APP} Installation Found!" |
| 69 | + exit |
| 70 | + fi |
| 71 | + |
| 72 | + msg_info "Updating Alpine Packages" |
| 73 | + $STD apk -U upgrade |
| 74 | + msg_ok "Updated Alpine Packages" |
| 75 | + |
| 76 | + if check_for_gh_release "openviking-server" "volcengine/OpenViking"; then |
| 77 | + msg_info "Stopping Service" |
| 78 | + $STD rc-service openviking stop |
| 79 | + msg_ok "Stopped Service" |
| 80 | + |
| 81 | + msg_info "Updating ${APP}" |
| 82 | + $STD uv pip install --python /opt/openviking/bin/python --upgrade openviking |
| 83 | + msg_ok "Updated ${APP}" |
| 84 | + |
| 85 | + msg_info "Starting Service" |
| 86 | + $STD rc-service openviking start |
| 87 | + msg_ok "Started Service" |
| 88 | + msg_ok "Updated successfully!" |
| 89 | + fi |
| 90 | +} |
| 91 | + |
| 92 | +function update_script() { |
| 93 | + header_info |
| 94 | + check_container_storage |
| 95 | + check_container_resources |
| 96 | + run_os_update |
| 97 | + exit |
| 98 | +} |
| 99 | + |
| 100 | +start |
| 101 | +build_container |
| 102 | +description |
| 103 | + |
| 104 | +msg_ok "Completed Successfully!\n" |
| 105 | +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" |
| 106 | +echo -e "${INFO}${YW}Access it using the following URL:${CL}" |
| 107 | +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:1933/studio${CL}" |
| 108 | +echo -e "${INFO}${YW}Root API Key:${CL}" |
| 109 | +echo -e "${TAB}${DGN}$(pct exec "$CTID" -- sed -n 's/.*"root_api_key": "\([^"]*\)".*/\1/p' /opt/openviking_data/ov.conf)${CL}" |
| 110 | +echo -e "${INFO}${YW}Model API keys are configured in /opt/openviking_data/ov.conf${CL}" |
| 111 | +echo -e "${TAB}${DGN}Edit the file and restart the openviking service afterwards${CL}" |
0 commit comments