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
}