### Minimal Langfuse Installation with Providers Source: https://context7.com/langfuse/langfuse-terraform-aws/llms.txt Demonstrates a minimal Langfuse deployment using the Terraform module, including essential configurations for the domain and name. It also sets up the Kubernetes and Helm providers, configuring them to connect to the provisioned EKS cluster using AWS CLI for token retrieval. ```hcl module "langfuse" { source = "github.com/langfuse/langfuse-terraform-aws?ref=0.6.2" domain = "langfuse.example.com" name = "langfuse" } provider "kubernetes" { host = module.langfuse.cluster_host cluster_ca_certificate = module.langfuse.cluster_ca_certificate token = module.langfuse.cluster_token exec { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" args = ["eks", "get-token", "--cluster-name", module.langfuse.cluster_name] } } provider "helm" { kubernetes { host = module.langfuse.cluster_host cluster_ca_certificate = module.langfuse.cluster_ca_certificate token = module.langfuse.cluster_token exec { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" args = ["eks", "get-token", "--cluster-name", module.langfuse.cluster_name] } } } ``` -------------------------------- ### Customize Langfuse Resource Allocations with Terraform Source: https://github.com/langfuse/langfuse-terraform-aws/blob/main/README.md This example shows how to override default resource allocations for Langfuse components, specifically increasing ClickHouse Keeper CPU and memory. This allows for fine-tuning performance based on specific production requirements. ```hcl module "langfuse" { source = "github.com/langfuse/langfuse-terraform-aws?ref=0.2.6" domain = "langfuse.example.com" # Increase ClickHouse Keeper resources clickhouse_keeper_cpu = "2" clickhouse_keeper_memory = "4Gi" } ``` -------------------------------- ### Troubleshooting and Post-Deployment Restart Source: https://github.com/langfuse/langfuse-terraform-aws/blob/main/README.md Commands to resolve race conditions during initial deployment by restarting CoreDNS and ClickHouse pods. ```bash aws eks update-kubeconfig --name langfuse kubectl --namespace kube-system rollout restart deploy coredns kubectl --namespace langfuse delete pod langfuse-clickhouse-shard0-{0,1,2} langfuse-zookeeper-{0,1,2} ``` -------------------------------- ### Terraform Deployment Commands Source: https://github.com/langfuse/langfuse-terraform-aws/blob/main/README.md Standard CLI commands to initialize and apply the Terraform configuration for the Langfuse stack. ```bash terraform init terraform apply --target module.langfuse.aws_route53_zone.zone terraform apply ``` -------------------------------- ### Langfuse Terraform Deployment Commands (Bash) Source: https://context7.com/langfuse/langfuse-terraform-aws/llms.txt Execute the necessary Terraform commands to deploy Langfuse. This includes initialization, applying the DNS zone, applying the full stack, and configuring kubectl. ```bash # Initialize Terraform terraform init # Step 1: Apply the DNS zone first terraform apply --target module.langfuse.aws_route53_zone.zone # Step 2: Configure NS records with your DNS provider # Get nameservers with: dig NS langfuse.example.com # Expected output: # ns-1.awsdns-00.org. # ns-2.awsdns-01.net. # ns-3.awsdns-02.com. # ns-4.awsdns-03.co.uk. # Step 3: Apply the full stack terraform apply # Step 4: Connect kubectl to the EKS cluster aws eks update-kubeconfig --name langfuse # Step 5: Restart containers to resolve initial race conditions kubectl --namespace kube-system rollout restart deploy coredns kubectl --namespace langfuse delete pod langfuse-clickhouse-shard0-{0,1,2} langfuse-zookeeper-{0,1,2} ``` -------------------------------- ### Deploy Langfuse in Existing VPC with Terraform Source: https://github.com/langfuse/langfuse-terraform-aws/blob/main/README.md This configuration demonstrates how to deploy Langfuse into an existing VPC by providing the VPC ID and subnet IDs. It also shows how to configure Kubernetes and Helm providers to connect to the EKS cluster. Ensure your VPC has DNS hostnames and support enabled, and subnets are spread across availability zones. ```hcl module "langfuse" { source = "github.com/langfuse/langfuse-terraform-aws?ref=0.5.1" domain = "langfuse.example.com" # Use existing VPC vpc_id = "vpc-12345678" private_subnet_ids = ["subnet-aaa11111", "subnet-bbb22222", "subnet-ccc33333"] public_subnet_ids = ["subnet-xxx11111", "subnet-yyy22222", "subnet-zzz33333"] # Optional: Provide route table IDs for S3 VPC Gateway endpoint # If not provided, S3 endpoint will not be created private_route_table_ids = ["rtb-11111111", "rtb-22222222"] } provider "kubernetes" { host = module.langfuse.cluster_host cluster_ca_certificate = module.langfuse.cluster_ca_certificate token = module.langfuse.cluster_token exec { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" args = ["eks", "get-token", "--cluster-name", module.langfuse.cluster_name] } } provider "helm" { kubernetes { host = module.langfuse.cluster_host cluster_ca_certificate = module.langfuse.cluster_ca_certificate token = module.langfuse.cluster_token exec { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" args = ["eks", "get-token", "--cluster-name", module.langfuse.cluster_name] } } } ``` -------------------------------- ### Full Production Langfuse Configuration Source: https://context7.com/langfuse/langfuse-terraform-aws/llms.txt Provides a comprehensive configuration for a highly available Langfuse deployment on AWS. This includes detailed settings for VPC, Kubernetes, PostgreSQL, ElastiCache Redis, ClickHouse, and Langfuse container resources, alongside network access control. ```hcl module "langfuse" { source = "github.com/langfuse/langfuse-terraform-aws?ref=0.6.2" domain = "langfuse.example.com" name = "langfuse-prod" # Security configuration use_encryption_key = true # Enable encryption for LLM API credentials # VPC configuration vpc_cidr = "10.0.0.0/16" use_single_nat_gateway = false # One NAT gateway per AZ for resilience # Kubernetes cluster configuration kubernetes_version = "1.32" fargate_profile_namespaces = ["kube-system", "langfuse", "default"] # PostgreSQL Serverless v2 configuration postgres_instance_count = 2 # High availability with 2 instances postgres_min_capacity = 0.5 # Minimum ACU capacity postgres_max_capacity = 4.0 # Maximum ACU capacity for production postgres_version = "15.12" # ElastiCache Redis configuration cache_node_type = "cache.t4g.medium" cache_instance_count = 2 redis_at_rest_encryption = true redis_multi_az = true # ClickHouse configuration clickhouse_replicas = 3 clickhouse_cpu = "4" clickhouse_memory = "16Gi" clickhouse_keeper_cpu = "2" clickhouse_keeper_memory = "4Gi" enable_clickhouse_log_tables = false # Disable to reduce EFS load # Langfuse container resources langfuse_cpu = "4" langfuse_memory = "8Gi" langfuse_web_replicas = 2 langfuse_worker_replicas = 2 langfuse_helm_chart_version = "1.5.14" # Network access control alb_scheme = "internet-facing" ingress_inbound_cidrs = ["0.0.0.0/0"] } provider "kubernetes" { host = module.langfuse.cluster_host cluster_ca_certificate = module.langfuse.cluster_ca_certificate token = module.langfuse.cluster_token exec { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" args = ["eks", "get-token", "--cluster-name", module.langfuse.cluster_name] } } provider "helm" { kubernetes { host = module.langfuse.cluster_host cluster_ca_certificate = module.langfuse.cluster_ca_certificate token = module.langfuse.cluster_token exec { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" args = ["eks", "get-token", "--cluster-name", module.langfuse.cluster_name] } } } ``` -------------------------------- ### Configure Langfuse Terraform Module and Providers Source: https://github.com/langfuse/langfuse-terraform-aws/blob/main/README.md Defines the Langfuse module configuration including VPC, database, and cache settings, alongside the necessary Kubernetes and Helm providers for EKS integration. ```hcl module "langfuse" { source = "github.com/langfuse/langfuse-terraform-aws?ref=0.6.2" domain = "langfuse.example.com" name = "langfuse" vpc_cidr = "10.0.0.0/16" use_single_nat_gateway = false kubernetes_version = "1.32" fargate_profile_namespaces = ["kube-system", "langfuse", "default"] postgres_instance_count = 2 postgres_min_capacity = 0.5 postgres_max_capacity = 2.0 cache_node_type = "cache.t4g.small" cache_instance_count = 2 langfuse_helm_chart_version = "1.5.14" enable_clickhouse_log_tables = false additional_env = [ { name = "CUSTOM_ENV_VAR" value = "custom-value" }, { name = "DATABASE_PASSWORD" valueFrom = { secretKeyRef = { name = "my-database-secret" key = "password" } } } ] } provider "kubernetes" { host = module.langfuse.cluster_host cluster_ca_certificate = module.langfuse.cluster_ca_certificate token = module.langfuse.cluster_token exec { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" args = ["eks", "get-token", "--cluster-name", module.langfuse.cluster_name] } } provider "helm" { kubernetes { host = module.langfuse.cluster_host cluster_ca_certificate = module.langfuse.cluster_ca_certificate token = module.langfuse.cluster_token exec { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" args = ["eks", "get-token", "--cluster-name", module.langfuse.cluster_name] } } } ``` -------------------------------- ### Deploy Cost-Optimized Langfuse on AWS with Terraform Source: https://context7.com/langfuse/langfuse-terraform-aws/llms.txt This configuration deploys a cost-effective Langfuse instance on AWS, suitable for development or low-traffic environments. It optimizes VPC, database, cache, ClickHouse, and Langfuse resource settings for minimal cost. Encryption is disabled, which is not recommended for production. ```hcl module "langfuse" { source = "github.com/langfuse/langfuse-terraform-aws?ref=0.6.2" domain = "langfuse-dev.example.com" name = "langfuse-dev" # Cost-optimized VPC (single NAT gateway) use_single_nat_gateway = true # Minimal database configuration postgres_instance_count = 1 postgres_min_capacity = 0.5 postgres_max_capacity = 1.0 # Minimal cache configuration cache_node_type = "cache.t4g.micro" cache_instance_count = 1 # Minimal ClickHouse (minimum 2 replicas required) clickhouse_replicas = 2 clickhouse_cpu = "1" clickhouse_memory = "4Gi" clickhouse_keeper_cpu = "0.5" clickhouse_keeper_memory = "1Gi" # Minimal Langfuse resources langfuse_cpu = "1" langfuse_memory = "2Gi" langfuse_web_replicas = 1 langfuse_worker_replicas = 1 # Disable encryption for dev (not recommended for production) use_encryption_key = false } ``` -------------------------------- ### Configure Required Terraform Providers for AWS Langfuse Source: https://context7.com/langfuse/langfuse-terraform-aws/llms.txt This configuration sets up the necessary Terraform providers, including AWS, Kubernetes, and Helm, with minimum version constraints. It also defines the AWS provider region. Ensure these providers are correctly configured before applying the Terraform module. ```hcl terraform { required_version = ">= 1.0" required_providers { aws = { source = "hashicorp/aws" version = ">= 5.79.0" } kubernetes = { source = "hashicorp/kubernetes" version = "~> 2.0" } helm = { source = "hashicorp/helm" version = "~> 2.0" } } } provider "aws" { region = "us-east-1" # Change to your preferred region } ``` -------------------------------- ### Deploy Langfuse in Existing VPC (Terraform) Source: https://context7.com/langfuse/langfuse-terraform-aws/llms.txt Configure Langfuse to deploy within an existing Virtual Private Cloud (VPC) by specifying the VPC ID and subnet IDs. This avoids creating new networking resources. It also shows how to configure Kubernetes and Helm providers to connect to the EKS cluster. ```hcl module "langfuse" { source = "github.com/langfuse/langfuse-terraform-aws?ref=0.6.2" domain = "langfuse.example.com" # Use existing VPC vpc_id = "vpc-12345678" private_subnet_ids = ["subnet-aaa11111", "subnet-bbb22222", "subnet-ccc33333"] public_subnet_ids = ["subnet-xxx11111", "subnet-yyy22222", "subnet-zzz33333"] # Optional: Provide route table IDs for S3 VPC Gateway endpoint private_route_table_ids = ["rtb-11111111", "rtb-22222222"] } provider "kubernetes" { host = module.langfuse.cluster_host cluster_ca_certificate = module.langfuse.cluster_ca_certificate token = module.langfuse.cluster_token exec { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" args = ["eks", "get-token", "--cluster-name", module.langfuse.cluster_name] } } provider "helm" { kubernetes { host = module.langfuse.cluster_host cluster_ca_certificate = module.langfuse.cluster_ca_certificate token = module.langfuse.cluster_token exec { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" args = ["eks", "get-token", "--cluster-name", module.langfuse.cluster_name] } } } ``` -------------------------------- ### Reference AWS Langfuse Terraform Module Source: https://context7.com/langfuse/langfuse-terraform-aws/llms.txt This snippet shows how to reference the Langfuse Terraform module from GitHub in your Terraform configuration. It requires specifying the source and a reference (e.g., a Git tag or commit). ```hcl module "langfuse" { source = "github.com/langfuse/langfuse-terraform-aws?ref=0.6.2" domain = "langfuse.example.com" } ``` -------------------------------- ### Langfuse Module Outputs (Terraform) Source: https://context7.com/langfuse/langfuse-terraform-aws/llms.txt Access essential connection details and infrastructure information provided by the Langfuse Terraform module. This includes EKS cluster details, network configuration, DNS settings, and S3 bucket information. ```hcl # EKS cluster connection details output "langfuse_cluster_name" { value = module.langfuse.cluster_name } output "langfuse_cluster_endpoint" { value = module.langfuse.cluster_host } output "langfuse_cluster_ca" { value = module.langfuse.cluster_ca_certificate sensitive = true } output "langfuse_cluster_token" { value = module.langfuse.cluster_token sensitive = true } # Network information output "langfuse_private_subnets" { value = module.langfuse.private_subnet_ids } output "langfuse_public_subnets" { value = module.langfuse.public_subnet_ids } # DNS configuration output "langfuse_nameservers" { value = module.langfuse.route53_nameservers } # S3 bucket details output "langfuse_bucket_name" { value = module.langfuse.bucket_name } output "langfuse_bucket_id" { value = module.langfuse.bucket_id } ``` -------------------------------- ### Configure Internal ALB for Langfuse (Terraform) Source: https://context7.com/langfuse/langfuse-terraform-aws/llms.txt Deploy Langfuse with an internal Application Load Balancer (ALB) to restrict network access to private IP ranges. This is useful for internal-only deployments. ```hcl module "langfuse" { source = "github.com/langfuse/langfuse-terraform-aws?ref=0.6.2" domain = "langfuse.internal.example.com" # Internal ALB configuration alb_scheme = "internal" ingress_inbound_cidrs = ["10.0.0.0/8", "172.16.0.0/12"] # Private CIDR ranges only } ``` -------------------------------- ### Add Custom Environment Variables to Langfuse (Terraform) Source: https://context7.com/langfuse/langfuse-terraform-aws/llms.txt Extend Langfuse's configuration by adding custom environment variables. These can be set directly with values or by referencing values from Kubernetes secrets or ConfigMaps. ```hcl module "langfuse" { source = "github.com/langfuse/langfuse-terraform-aws?ref=0.6.2" domain = "langfuse.example.com" additional_env = [ # Direct value { name = "CUSTOM_ENV_VAR" value = "custom-value" }, # Reference to Kubernetes secret { name = "DATABASE_PASSWORD" valueFrom = { secretKeyRef = { name = "my-database-secret" key = "password" } } }, # Reference to ConfigMap { name = "APP_CONFIG" valueFrom = { configMapKeyRef = { name = "my-config-map" key = "app-config" } } } ] } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.