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,36 @@
# Bifrost on AWS ECS
Deploys Bifrost as an ECS Fargate service with optional ALB and autoscaling.
## Prerequisites
- AWS account with appropriate permissions
- AWS CLI configured (`aws configure`)
- Terraform >= 1.0
## 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,41 @@
terraform {
required_version = ">= 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
provider "aws" {
region = var.region
}
module "bifrost" {
source = "../../modules/bifrost"
cloud_provider = "aws"
service = "ecs"
region = var.region
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_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,62 @@
# =============================================================================
# AWS ECS 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.
# =============================================================================
region = "us-east-1"
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-..."
}
anthropic = {
api_key = "sk-ant-..."
}
}
# -----------------------------------------------------------------------------
# Compute
# -----------------------------------------------------------------------------
desired_count = 2
cpu = 512
memory = 1024
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 = true
min_capacity = 1
max_capacity = 5

View File

@@ -0,0 +1,91 @@
variable "region" {
description = "AWS region to deploy into."
type = string
default = "us-east-1"
}
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, bedrock, etc.)."
type = any
default = null
}
# --- Compute ---
variable "desired_count" {
description = "Number of ECS tasks."
type = number
default = 1
}
variable "cpu" {
description = "CPU units for the ECS task (256-4096)."
type = number
default = 512
}
variable "memory" {
description = "Memory in MB for the ECS task."
type = number
default = 1024
}
variable "create_load_balancer" {
description = "Create an Application Load Balancer in front of the service."
type = bool
default = false
}
# --- Autoscaling ---
variable "enable_autoscaling" {
description = "Enable ECS service autoscaling."
type = bool
default = false
}
variable "min_capacity" {
description = "Minimum number of tasks when autoscaling is enabled."
type = number
default = 1
}
variable "max_capacity" {
description = "Maximum number of tasks when autoscaling is enabled."
type = number
default = 10
}

View File

@@ -0,0 +1,36 @@
# Bifrost on Azure AKS
Deploys Bifrost as a Kubernetes workload on Azure Kubernetes Service.
## Prerequisites
- Azure subscription
- Azure CLI authenticated (`az login`)
- Terraform >= 1.0
## 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,50 @@
terraform {
required_version = ">= 1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "~> 2.0"
}
}
}
provider "azurerm" {
features {}
}
module "bifrost" {
source = "../../modules/bifrost"
cloud_provider = "azure"
service = "aks"
region = var.region
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
# Azure-specific
azure_resource_group_name = var.resource_group_name
}

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 @@
# =============================================================================
# Azure AKS 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.
# =============================================================================
region = "eastus"
image_tag = "latest"
name_prefix = "bifrost"
resource_group_name = "bifrost-rg"
# -----------------------------------------------------------------------------
# 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-..."
}
azure = {
api_key = "..."
resource_id = "my-azure-openai-resource"
}
}
# -----------------------------------------------------------------------------
# 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,111 @@
variable "region" {
description = "Azure region to deploy into."
type = string
default = "eastus"
}
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"
}
variable "resource_group_name" {
description = "Azure resource group name. If null, a new one will be created."
type = string
default = null
}
# --- 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, azure, 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 AKS cluster. Set to false to use an existing cluster."
type = bool
default = true
}
variable "node_count" {
description = "Number of nodes in the AKS 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
}

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
}

View File

@@ -0,0 +1,45 @@
# Bifrost on Kubernetes
Deploys Bifrost on any existing Kubernetes cluster using a Deployment, PVC, and optional Ingress + HPA.
## Prerequisites
- A running Kubernetes cluster with `kubectl` access
- A kubeconfig file (default: `~/.kube/config`)
- A StorageClass that supports dynamic provisioning (e.g. `standard`, `gp2`, `premium-rwo`)
- Terraform >= 1.0
## 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.
## Ingress
To expose Bifrost externally, set `create_load_balancer = true` and configure:
- `ingress_class_name` -- Your ingress controller class (e.g. `nginx`, `traefik`, `haproxy`)
- `domain_name` -- The hostname for the Ingress rule
- `ingress_annotations` -- Any annotations your ingress controller needs (e.g. TLS, rate limiting)
## Cleanup
```bash
terraform destroy
```

View File

@@ -0,0 +1,50 @@
terraform {
required_version = ">= 1.0"
required_providers {
kubernetes = {
source = "hashicorp/kubernetes"
version = "~> 2.0"
}
}
}
provider "kubernetes" {
config_path = pathexpand(var.kubeconfig_path)
config_context = var.kubeconfig_context
}
module "bifrost" {
source = "../../modules/bifrost"
cloud_provider = "kubernetes"
service = "deployment"
region = "local"
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
kubernetes_namespace = var.kubernetes_namespace
volume_size_gb = var.volume_size_gb
storage_class_name = var.storage_class_name
# Ingress
create_load_balancer = var.create_load_balancer
ingress_class_name = var.ingress_class_name
ingress_annotations = var.ingress_annotations
domain_name = var.domain_name
# 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,77 @@
# =============================================================================
# Generic Kubernetes 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.
# =============================================================================
image_tag = "latest"
name_prefix = "bifrost"
# -----------------------------------------------------------------------------
# Kubernetes connection
# -----------------------------------------------------------------------------
# kubeconfig_path = "~/.kube/config"
# kubeconfig_context = "my-cluster"
# -----------------------------------------------------------------------------
# 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-..."
}
anthropic = {
api_key = "sk-ant-..."
}
}
# -----------------------------------------------------------------------------
# Compute
# -----------------------------------------------------------------------------
desired_count = 1
cpu = 512
memory = 1024
kubernetes_namespace = "bifrost"
volume_size_gb = 10
storage_class_name = "standard"
# -----------------------------------------------------------------------------
# Ingress (optional)
# -----------------------------------------------------------------------------
create_load_balancer = false
# ingress_class_name = "nginx"
# ingress_annotations = { "cert-manager.io/cluster-issuer" = "letsencrypt-prod" }
# domain_name = "bifrost.example.com"
# -----------------------------------------------------------------------------
# Autoscaling (optional)
# -----------------------------------------------------------------------------
# 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,139 @@
# --- Kubernetes connection ---
variable "kubeconfig_path" {
description = "Path to the kubeconfig file."
type = string
default = "~/.kube/config"
}
variable "kubeconfig_context" {
description = "Kubeconfig context to use. Defaults to current context."
type = string
default = null
}
# --- Bifrost ---
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, etc.)."
type = any
default = null
}
# --- Compute ---
variable "desired_count" {
description = "Number of pod replicas."
type = number
default = 1
}
variable "cpu" {
description = "CPU allocation in millicores (e.g. 500)."
type = number
default = 512
}
variable "memory" {
description = "Memory allocation in MB."
type = number
default = 1024
}
variable "kubernetes_namespace" {
description = "Kubernetes namespace to deploy into."
type = string
default = "bifrost"
}
variable "volume_size_gb" {
description = "Persistent volume claim size in GB."
type = number
default = 10
}
variable "storage_class_name" {
description = "Kubernetes StorageClass name for dynamic PVC provisioning."
type = string
default = "standard"
}
# --- Ingress ---
variable "create_load_balancer" {
description = "Create a Kubernetes Ingress resource."
type = bool
default = false
}
variable "ingress_class_name" {
description = "Ingress class name (e.g. nginx, traefik, haproxy)."
type = string
default = "nginx"
}
variable "ingress_annotations" {
description = "Annotations to add to the Ingress resource."
type = map(string)
default = {}
}
variable "domain_name" {
description = "Custom domain name for the Ingress host rule."
type = string
default = null
}
# --- Autoscaling ---
variable "enable_autoscaling" {
description = "Enable Horizontal Pod Autoscaler."
type = bool
default = false
}
variable "min_capacity" {
description = "Minimum number of replicas when autoscaling is enabled."
type = number
default = 1
}
variable "max_capacity" {
description = "Maximum number of replicas when autoscaling is enabled."
type = number
default = 10
}