From e3c0833a664a9cc4ee42620fc92fd6c63bfbaac9 Mon Sep 17 00:00:00 2001 From: Aaron Cohen Date: Sun, 1 Nov 2026 12:27:57 -0800 Subject: [PATCH 1/2] feat: add native Bifrost LXC installer --- ct/bifrost.sh | 79 ++++++++++++++++++++++++++++++++++ install/bifrost-install.sh | 88 ++++++++++++++++++++++++++++++++++++++ json/bifrost.json | 48 +++++++++++++++++++++ 3 files changed, 215 insertions(+) create mode 100644 ct/bifrost.sh create mode 100644 install/bifrost-install.sh create mode 100644 json/bifrost.json diff --git a/ct/bifrost.sh b/ct/bifrost.sh new file mode 100644 index 0000000000..7c7e9ce51f --- /dev/null +++ b/ct/bifrost.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main" +_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: cheesejaguar +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://github.com/maximhq/bifrost + +APP="Bifrost" +var_tags="${var_tags:-ai;proxy}" +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 [[ ! -x /opt/bifrost/bifrost-http || ! -f /opt/bifrost_data/config.json ]]; then + msg_error "No Bifrost Installation Found!" + exit 1 + fi + + if check_for_gh_release "bifrost" "maximhq/bifrost" "${var_appversion:-}" "" "transports/v"; then + # Gateway binaries are published to the upstream CDN, not as GitHub assets. + BIFROST_URL="https://downloads.getmaxim.ai/bifrost/${CHECK_UPDATE_RELEASE##*/}/linux/$(arch_resolve)" + msg_info "Downloading Bifrost Gateway" + mkdir -p /opt/bifrost-update + chmod 700 /opt/bifrost-update + curl_with_retry "${BIFROST_URL}/bifrost-http" /opt/bifrost-update/bifrost-http + curl_with_retry "${BIFROST_URL}/bifrost-http.sha256" /opt/bifrost-update/bifrost-http.sha256 + cd /opt/bifrost-update || exit 1 + $STD sha256sum --check bifrost-http.sha256 + msg_ok "Verified Bifrost Gateway" + + msg_info "Stopping Bifrost" + systemctl stop bifrost + msg_ok "Stopped Bifrost" + + BACKUP_DIR="/opt/bifrost-backup-$(date +%Y%m%d-%H%M%S)" create_backup /opt/bifrost_data /opt/bifrost/bifrost-http ~/.bifrost + + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "bifrost" "maximhq/bifrost" "tarball" "$CHECK_UPDATE_RELEASE" + + msg_info "Installing Bifrost Gateway" + install -m 755 /opt/bifrost-update/bifrost-http /opt/bifrost/bifrost-http + cd /opt/bifrost || exit 1 + rm -rf /opt/bifrost-update + msg_ok "Installed Bifrost Gateway" + + msg_info "Starting Bifrost" + systemctl start bifrost + $STD curl --fail --silent --show-error --retry 30 --retry-connrefused --retry-delay 2 --retry-max-time 120 --max-time 5 http://127.0.0.1:8080/health + systemctl is-active --quiet bifrost + msg_ok "Started Bifrost" + msg_ok "Updated Bifrost 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 "${GATEWAY}${BGN}http://${IP}:8080${CL}" +echo -e "${INFO}${YW}Bifrost username: admin. Find BIFROST_ADMIN_PASSWORD in /opt/bifrost_data/.env inside the container.${CL}" diff --git a/install/bifrost-install.sh b/install/bifrost-install.sh new file mode 100644 index 0000000000..307260ce14 --- /dev/null +++ b/install/bifrost-install.sh @@ -0,0 +1,88 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: cheesejaguar +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://github.com/maximhq/bifrost + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +# The monorepo also releases SDKs and plugins; select only stable gateway releases. +fetch_and_deploy_gh_release "bifrost" "maximhq/bifrost" "tarball" "latest" "/opt/bifrost" "" "transports/v" + +msg_info "Installing Bifrost Gateway" +BIFROST_VERSION=$(cat ~/.bifrost) +BIFROST_URL="https://downloads.getmaxim.ai/bifrost/${BIFROST_VERSION##*/}/linux/$(arch_resolve)" +mkdir -p /opt/bifrost-update +chmod 700 /opt/bifrost-update +curl_with_retry "${BIFROST_URL}/bifrost-http" /opt/bifrost-update/bifrost-http +curl_with_retry "${BIFROST_URL}/bifrost-http.sha256" /opt/bifrost-update/bifrost-http.sha256 +cd /opt/bifrost-update || exit 1 +$STD sha256sum --check bifrost-http.sha256 +install -m 755 /opt/bifrost-update/bifrost-http /opt/bifrost/bifrost-http +cd /opt/bifrost || exit 1 +rm -rf /opt/bifrost-update +msg_ok "Installed Bifrost Gateway" + +msg_info "Configuring Bifrost" +mkdir -p /opt/bifrost_data +chmod 700 /opt/bifrost_data +cat </opt/bifrost_data/.env +BIFROST_ADMIN_PASSWORD=$(random_password 32) +BIFROST_ENCRYPTION_KEY=$(random_password 64) +BIFROST_SETUP_TOKEN=$(random_password 32) +EOF +cat <<'EOF' >/opt/bifrost_data/config.json +{ + "encryption_key": "env.BIFROST_ENCRYPTION_KEY", + "setup_token": "env.BIFROST_SETUP_TOKEN", + "client": { + "enforce_auth_on_inference": true + }, + "governance": { + "auth_config": { + "admin_username": "admin", + "admin_password": "env.BIFROST_ADMIN_PASSWORD", + "is_enabled": true + } + } +} +EOF +chmod 600 /opt/bifrost_data/.env /opt/bifrost_data/config.json +msg_ok "Configured Bifrost" + +msg_info "Creating Bifrost Service" +cat </etc/systemd/system/bifrost.service +[Unit] +Description=Bifrost AI Gateway +Wants=network-online.target +After=network-online.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/bifrost_data +EnvironmentFile=/opt/bifrost_data/.env +UMask=0077 +ExecStart=/opt/bifrost/bifrost-http -host 0.0.0.0 -port 8080 -app-dir /opt/bifrost_data +Restart=on-failure +RestartSec=5 +TimeoutStopSec=60 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now bifrost +$STD curl --fail --silent --show-error --retry 30 --retry-connrefused --retry-delay 2 --retry-max-time 120 --max-time 5 http://127.0.0.1:8080/health +systemctl is-active --quiet bifrost +msg_ok "Created Bifrost Service" + +motd_ssh +customize +cleanup_lxc diff --git a/json/bifrost.json b/json/bifrost.json new file mode 100644 index 0000000000..04c1f1fd6c --- /dev/null +++ b/json/bifrost.json @@ -0,0 +1,48 @@ +{ + "name": "Bifrost", + "slug": "bifrost", + "categories": [20], + "date_created": "2026-11-01", + "type": "ct", + "updateable": true, + "privileged": false, + "architectures": ["amd64", "arm64"], + "interface_port": 8080, + "documentation": "https://docs.getbifrost.ai/", + "website": "https://www.getmaxim.ai/bifrost", + "repository": "https://github.com/maximhq/bifrost", + "logo": "https://raw.githubusercontent.com/maximhq/bifrost/dev/docs/media/bifrost-logo.png", + "description": "Bifrost is an AI gateway with a unified API for multiple model providers. It provides a web dashboard, virtual keys, usage budgets, request logs, load balancing, and automatic fallbacks.", + "install_methods": [ + { + "type": "default", + "script": "ct/bifrost.sh", + "config_path": "/opt/bifrost_data/config.json", + "resources": { + "cpu": 2, + "ram": 1024, + "hdd": 4, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": "admin", + "password": null + }, + "notes": [ + { + "text": "Find the generated BIFROST_ADMIN_PASSWORD in /opt/bifrost_data/.env inside the container. Add provider credentials and create virtual keys in the dashboard.", + "type": "info" + }, + { + "text": "Use an HTTPS reverse proxy for access beyond a trusted network. Authentication is enabled for both the dashboard and inference API.", + "type": "warning" + }, + { + "text": "Keep a backup of /opt/bifrost_data, including .env. Losing or changing BIFROST_ENCRYPTION_KEY makes stored provider credentials unreadable.", + "type": "warning" + } + ] +} From f46960720728ccd14c6a465241084ee3c20e17d6 Mon Sep 17 00:00:00 2001 From: Aaron Cohen Date: Sun, 1 Nov 2026 12:40:17 -0800 Subject: [PATCH 2/2] fix: simplify Bifrost releases and report failed updates accurately --- ct/bifrost.sh | 10 ++++++++-- install/bifrost-install.sh | 15 ++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/ct/bifrost.sh b/ct/bifrost.sh index 7c7e9ce51f..e1928499e1 100644 --- a/ct/bifrost.sh +++ b/ct/bifrost.sh @@ -50,8 +50,6 @@ function update_script() { BACKUP_DIR="/opt/bifrost-backup-$(date +%Y%m%d-%H%M%S)" create_backup /opt/bifrost_data /opt/bifrost/bifrost-http ~/.bifrost - CLEAN_INSTALL=1 fetch_and_deploy_gh_release "bifrost" "maximhq/bifrost" "tarball" "$CHECK_UPDATE_RELEASE" - msg_info "Installing Bifrost Gateway" install -m 755 /opt/bifrost-update/bifrost-http /opt/bifrost/bifrost-http cd /opt/bifrost || exit 1 @@ -62,8 +60,16 @@ function update_script() { systemctl start bifrost $STD curl --fail --silent --show-error --retry 30 --retry-connrefused --retry-delay 2 --retry-max-time 120 --max-time 5 http://127.0.0.1:8080/health systemctl is-active --quiet bifrost + cat <~/.bifrost +${CHECK_UPDATE_RELEASE} +EOF msg_ok "Started Bifrost" msg_ok "Updated Bifrost successfully!" + else + RELEASE_CHECK_STATUS=$? + if [[ "$RELEASE_CHECK_STATUS" -ne 1 ]]; then + exit "$RELEASE_CHECK_STATUS" + fi fi exit } diff --git a/install/bifrost-install.sh b/install/bifrost-install.sh index 307260ce14..7106c25d80 100644 --- a/install/bifrost-install.sh +++ b/install/bifrost-install.sh @@ -13,13 +13,15 @@ setting_up_container network_check update_os -# The monorepo also releases SDKs and plugins; select only stable gateway releases. -fetch_and_deploy_gh_release "bifrost" "maximhq/bifrost" "tarball" "latest" "/opt/bifrost" "" "transports/v" +# Gateway binaries live on the upstream CDN; GitHub also releases unrelated SDKs and plugins. +if ! check_for_gh_release "bifrost" "maximhq/bifrost" "${var_appversion:-}" "" "transports/v"; then + msg_error "Could not select a Bifrost gateway release" + exit 1 +fi msg_info "Installing Bifrost Gateway" -BIFROST_VERSION=$(cat ~/.bifrost) -BIFROST_URL="https://downloads.getmaxim.ai/bifrost/${BIFROST_VERSION##*/}/linux/$(arch_resolve)" -mkdir -p /opt/bifrost-update +BIFROST_URL="https://downloads.getmaxim.ai/bifrost/${CHECK_UPDATE_RELEASE##*/}/linux/$(arch_resolve)" +mkdir -p /opt/bifrost /opt/bifrost-update chmod 700 /opt/bifrost-update curl_with_retry "${BIFROST_URL}/bifrost-http" /opt/bifrost-update/bifrost-http curl_with_retry "${BIFROST_URL}/bifrost-http.sha256" /opt/bifrost-update/bifrost-http.sha256 @@ -81,6 +83,9 @@ EOF systemctl enable -q --now bifrost $STD curl --fail --silent --show-error --retry 30 --retry-connrefused --retry-delay 2 --retry-max-time 120 --max-time 5 http://127.0.0.1:8080/health systemctl is-active --quiet bifrost +cat <~/.bifrost +${CHECK_UPDATE_RELEASE} +EOF msg_ok "Created Bifrost Service" motd_ssh