-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecs.tf
75 lines (68 loc) · 2.21 KB
/
ecs.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
resource "aws_ecs_cluster" "chroma_cluster" {
name = "chroma-cluster"
}
resource "aws_ecs_task_definition" "chroma_task_definition" {
family = "chroma-task-definition"
network_mode = "awsvpc"
requires_compatibilities = ["FARGATE"]
cpu = 512
memory = 2048
execution_role_arn = aws_iam_role.chroma_ecs_task_execution_role.arn
task_role_arn = aws_iam_role.chroma_ecs_task_role.arn
container_definitions = jsonencode([
{
name = "chroma-container"
image = "ghcr.io/chroma-core/chroma:0.4.7"
essential = true
environment = []
portMappings = [
{
containerPort = 8000
hostPort = 8000
}
]
mountPoints = [
{
containerPath : "/index_data"
sourceVolume : aws_efs_file_system.chroma_efs.creation_token
readOnly : false
}
]
logConfiguration = {
logDriver = "awslogs"
options = {
awslogs-group = module.loggings.chroma_log_group
awslogs-stream-prefix = "chroma"
awslogs-region = var.aws_region
}
}
}
])
volume {
name = aws_efs_file_system.chroma_efs.creation_token
efs_volume_configuration {
file_system_id = aws_efs_file_system.chroma_efs.id
root_directory = "/"
}
}
ephemeral_storage {
size_in_gib = var.fargate_ephemeral_storage_size
}
}
resource "aws_ecs_service" "chroma_ecs_service" {
name = "chroma-service"
cluster = aws_ecs_cluster.chroma_cluster.id
task_definition = aws_ecs_task_definition.chroma_task_definition.arn
desired_count = 1
deployment_minimum_healthy_percent = 50
deployment_maximum_percent = 200
launch_type = "FARGATE"
scheduling_strategy = "REPLICA"
network_configuration {
security_groups = [module.security_groups.security_groups["chroma"].id]
subnets = module.chroma_network.subnet_ids
}
service_registries {
registry_arn = aws_service_discovery_service.backend.arn
}
}