[taskserv]
name = "vapora-backend"
type = "service"
version = "0.2.0"
description = "VAPORA REST API Backend (Axum)"

[source]
repository = "ssh://git@repo.jesusperez.pro:32225/jesus/Vapora.git"
branch = "main"
path = "vapora-backend/"

[build]
runtime = "rust"
build_command = "cargo build --release -p vapora-backend"
binary_path = "target/release/vapora-backend"

[deployment]
namespace = "vapora-system"
replicas = 3
image = "vapora/backend"
image_tag = "${version}"
image_pull_policy = "Always"

[ports]
http = 8080
metrics = 9090

[resources]
requests = { cpu = "1000m", memory = "2Gi" }
limits = { cpu = "2000m", memory = "4Gi" }

[health_check]
type = "http"
path = "/api/v1/health"
initial_delay_secs = 30
interval_secs = 10
timeout_secs = 5
success_threshold = 1
failure_threshold = 3

[dependencies]
required = ["surrealdb", "nats", "redis"]
optional = []

[environment]
DATABASE_URL = "surrealdb://surrealdb-0.vapora-system:8000"
NATS_URL = "nats://nats-0.vapora-system:4222"
REDIS_URL = "redis://redis-0.vapora-system:6379"
RUST_LOG = "debug,vapora=trace"
LOG_FORMAT = "json"

[secrets]
JWT_SECRET = "secret:vapora-secrets:jwt-secret"
DATABASE_PASSWORD = "secret:vapora-secrets:db-password"
API_KEY_ENCRYPTION = "secret:vapora-secrets:api-key-enc"

[scaling]
min_replicas = 3
max_replicas = 10
target_cpu_utilization_percent = 70
target_memory_utilization_percent = 80

[networking]
expose_externally = true
service_type = "ClusterIP"
session_affinity = "ClientIP"

[persistence]
enabled = false

[update_strategy]
type = "RollingUpdate"
max_surge = 1
max_unavailable = 0

[lifecycle_hooks]
startup_probe = true
startup_probe_path = "/api/v1/startup"
startup_probe_failure_threshold = 30

[monitoring]
prometheus_metrics = true
metrics_port = 9090
