Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 10 additions & 51 deletions ct/openviking.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,24 @@ source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_

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}"
if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then
var_os=$(msg_menu "Choose the container OS" \
"debian" "Debian 13 (recommended)" \
"alpine" "Alpine 3.24 (smaller footprint)")
fi

if [[ "${var_os:-}" == "alpine" ]]; then
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-1024}"
var_disk="${var_disk:-8}"
var_version="${var_version:-3.24}"
else
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-8}"
var_version="${var_version:-13}"
fi

header_info "$APP"
variables
color
catch_errors

update_deb_based() {
function update_script() {
header_info
check_container_storage
check_container_resources

if [[ ! -d /opt/openviking ]]; then
msg_error "No ${APP} Installation Found!"
exit
Expand All @@ -62,39 +54,6 @@ update_deb_based() {
msg_ok "Started Service"
msg_ok "Updated successfully!"
fi
}

update_alpine() {
if [[ ! -d /opt/openviking ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi

msg_info "Updating Alpine Packages"
$STD apk -U upgrade
msg_ok "Updated Alpine Packages"

if check_for_gh_release "openviking-server" "volcengine/OpenViking"; then
msg_info "Stopping Service"
$STD rc-service openviking stop
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"
$STD rc-service openviking start
msg_ok "Started Service"
msg_ok "Updated successfully!"
fi
}

function update_script() {
header_info
check_container_storage
check_container_resources
run_os_update
exit
}

Expand Down
118 changes: 33 additions & 85 deletions install/openviking-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@ setting_up_container
network_check
update_os

_ov_install_server() {
PYTHON_VERSION="3.12" setup_uv
msg_info "Installing Dependencies"
$STD apt install -y openssl
msg_ok "Installed Dependencies"

msg_info "Installing OpenViking"
$STD uv venv --python 3.12 /opt/openviking
$STD uv pip install --python /opt/openviking/bin/python openviking
cat <<EOF >~/.openviking-server
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 <<EOF >~/.openviking-server
$(get_latest_github_release "volcengine/OpenViking")
EOF
msg_ok "Installed OpenViking"
msg_ok "Installed OpenViking"

msg_info "Configuring OpenViking"
ROOT_API_KEY=$(openssl rand -hex 32)
mkdir -p /opt/openviking_data
cat <<EOF >/opt/openviking_data/ov.conf
msg_info "Configuring OpenViking"
ROOT_API_KEY=$(openssl rand -hex 32)
mkdir -p /opt/openviking_data
cat <<EOF >/opt/openviking_data/ov.conf
{
"server": {
"host": "0.0.0.0",
Expand Down Expand Up @@ -57,34 +60,11 @@ EOF
}
}
EOF
chmod 600 /opt/openviking_data/ov.conf
msg_ok "Configured OpenViking"
}

_ov_wait_ready() {
local ready=0
for _ in {1..30}; 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 60 seconds — check 'systemctl status openviking' (Debian) or 'rc-service openviking status' (Alpine)"
exit 1
fi
}

setup_deb_based() {
msg_info "Installing Dependencies"
$STD apt install -y openssl
msg_ok "Installed Dependencies"
chmod 600 /opt/openviking_data/ov.conf
msg_ok "Configured OpenViking"

_ov_install_server

msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/openviking.service
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/openviking.service
[Unit]
Description=OpenViking HTTP Server
After=network.target
Expand All @@ -101,53 +81,21 @@ RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now openviking
_ov_wait_ready
msg_ok "Created Service"
}

setup_alpine() {
msg_info "Installing Dependencies"
$STD apk add openssl
msg_ok "Installed Dependencies"

_ov_install_server

msg_info "Creating Service"
cat <<'EOF' >/etc/init.d/openviking
#!/sbin/openrc-run
name="OpenViking"
description="OpenViking - a self-evolving context database for AI agents"
systemctl enable -q --now openviking

command="/opt/openviking/bin/openviking-server"
command_user="root"
supervisor=supervise-daemon
output_log="/var/log/openviking.log"
error_log="/var/log/openviking.log"
pidfile="/run/${RC_SVCNAME}.pid"
respawn_delay=10

depend() {
need net
after firewall
}

start_pre() {
checkpath -d -m 0750 -o root:root /opt/openviking_data
checkpath -f -m 0640 "$output_log"
}
EOF
chmod +x /etc/init.d/openviking
cat <<EOF >/etc/conf.d/openviking
export OPENVIKING_CONFIG_FILE=/opt/openviking_data/ov.conf
EOF
$STD rc-update add openviking default
$STD rc-service openviking start
_ov_wait_ready
msg_ok "Created Service"
}

run_os_setup
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
Expand All @@ -158,4 +106,4 @@ fi

motd_ssh
customize
cleanup_lxc
cleanup_lxc
12 changes: 0 additions & 12 deletions json/openviking.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@
"os": "Debian",
"version": "13"
}
},
{
"type": "alpine",
"script": "ct/openviking.sh",
"config_path": "/opt/openviking_data/ov.conf",
"resources": {
"cpu": 1,
"ram": 1024,
"hdd": 8,
"os": "Alpine",
"version": "3.24"
}
}
],
"default_credentials": {
Expand Down
Loading