first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 21:52:23 +03:00
commit 880f412e2c
2662 changed files with 866266 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
# Bifrost on GCP GKE
Deploys Bifrost as a Kubernetes workload on Google Kubernetes Engine.
## Prerequisites
- GCP project with billing enabled
- `gcloud` CLI authenticated (`gcloud auth application-default login`)
- Terraform >= 1.0
- GKE API enabled (`gcloud services enable container.googleapis.com`)
## Usage
```bash
# Copy and edit the example variables file
cp terraform.tfvars.example terraform.tfvars
# Deploy
terraform init
terraform plan
terraform apply
```
## Configuration
Two approaches can be combined:
1. **File-based** -- Set `config_json_file` to point to an existing `config.json`.
2. **Variable-based** -- Set individual variables (`config_store`, `logs_store`, `providers_config`). These override matching keys from the file.
See `terraform.tfvars.example` for examples of both.
## Cleanup
```bash
terraform destroy
```

View File

@@ -0,0 +1,49 @@
terraform {
required_version = ">= 1.0"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 5.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "~> 2.0"
}
}
}
provider "google" {
project = var.project_id
region = var.region
}
module "bifrost" {
source = "../../modules/bifrost"
cloud_provider = "gcp"
service = "gke"
region = var.region
gcp_project_id = var.project_id
image_tag = var.image_tag
name_prefix = var.name_prefix
# Config: use a file as base, override with variables
config_json_file = var.config_json_file
# Override specific config sections
config_store = var.config_store
logs_store = var.logs_store
providers_config = var.providers_config
# Compute
desired_count = var.desired_count
cpu = var.cpu
memory = var.memory
create_cluster = var.create_cluster
node_count = var.node_count
create_load_balancer = var.create_load_balancer
# Autoscaling
enable_autoscaling = var.enable_autoscaling
min_capacity = var.min_capacity
max_capacity = var.max_capacity
}

View File

@@ -0,0 +1,9 @@
output "service_url" {
description = "URL to access the Bifrost service."
value = module.bifrost.service_url
}
output "health_check_url" {
description = "URL to the Bifrost health check endpoint."
value = module.bifrost.health_check_url
}

View File

@@ -0,0 +1,66 @@
# =============================================================================
# GCP GKE Example — terraform.tfvars
# WARNING: Do NOT commit this file with real secrets (API keys, passwords).
# Use environment variables, a secrets manager, or .gitignore this file.
# =============================================================================
project_id = "my-gcp-project"
region = "us-central1"
image_tag = "latest"
name_prefix = "bifrost"
# -----------------------------------------------------------------------------
# Config approach 1: File-based
# Point to an existing config.json. Variable overrides below will merge on top.
# -----------------------------------------------------------------------------
# config_json_file = "./config.json"
# -----------------------------------------------------------------------------
# Config approach 2: Variable-based
# Define config sections directly. These override matching keys from the file.
# -----------------------------------------------------------------------------
config_store = {
enabled = true
type = "sqlite"
config = {
path = "/app/data/bifrost.db"
}
}
logs_store = {
enabled = true
type = "sqlite"
config = {
path = "/app/data/bifrost-logs.db"
}
}
providers_config = {
openai = {
api_key = "sk-..."
}
vertex = {
project_id = "my-gcp-project"
region = "us-central1"
}
}
# -----------------------------------------------------------------------------
# Compute
# -----------------------------------------------------------------------------
desired_count = 2
cpu = 500
memory = 1024
create_cluster = true
node_count = 3
create_load_balancer = true
# -----------------------------------------------------------------------------
# Autoscaling
# -----------------------------------------------------------------------------
# NOTE: If you are using OSS version - running multiple nodes has an effect on
# functionality of the system. Please read
# https://docs.getbifrost.ai/deployment-guides/how-to/multinode
enable_autoscaling = false
# min_capacity = 1
# max_capacity = 5

View File

@@ -0,0 +1,110 @@
variable "project_id" {
description = "GCP project ID."
type = string
}
variable "region" {
description = "GCP region to deploy into."
type = string
default = "us-central1"
}
variable "image_tag" {
description = "Bifrost Docker image tag."
type = string
default = "latest"
}
variable "name_prefix" {
description = "Prefix for all resource names."
type = string
default = "bifrost"
}
# --- Config: file-based ---
variable "config_json_file" {
description = "Path to a Bifrost config.json file. Variables below override matching keys."
type = string
default = null
}
# --- Config: variable-based overrides ---
variable "config_store" {
description = "Config store configuration (type: sqlite/postgres)."
type = any
default = null
}
variable "logs_store" {
description = "Logs store configuration (type: sqlite/postgres)."
type = any
default = null
}
variable "providers_config" {
description = "LLM provider configurations (openai, anthropic, vertex, etc.)."
type = any
default = null
}
# --- Compute ---
variable "desired_count" {
description = "Number of Kubernetes pods."
type = number
default = 1
}
variable "cpu" {
description = "CPU in millicores for each pod."
type = number
default = 500
}
variable "memory" {
description = "Memory in MB for each pod."
type = number
default = 1024
}
# --- Cluster ---
variable "create_cluster" {
description = "Create a new GKE cluster. Set to false to use an existing cluster."
type = bool
default = true
}
variable "node_count" {
description = "Number of nodes in the GKE node pool."
type = number
default = 3
}
variable "create_load_balancer" {
description = "Create a load balancer via Kubernetes Ingress."
type = bool
default = true
}
# --- Autoscaling ---
variable "enable_autoscaling" {
description = "Enable Horizontal Pod Autoscaler."
type = bool
default = false
}
variable "min_capacity" {
description = "Minimum number of pods when autoscaling is enabled."
type = number
default = 1
}
variable "max_capacity" {
description = "Maximum number of pods when autoscaling is enabled."
type = number
default = 10
}