-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgpu_folding_task.tf
More file actions
99 lines (88 loc) · 2.28 KB
/
gpu_folding_task.tf
File metadata and controls
99 lines (88 loc) · 2.28 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
resource "aws_ecs_task_definition" "folding_gpu_task" {
family = "folding-gpu-task"
requires_compatibilities = ["EC2"]
network_mode = "awsvpc"
cpu = "2048"
memory = "4096"
execution_role_arn = aws_iam_role.ecs_tasks_execution_role.arn
task_role_arn = aws_iam_role.ecs_tasks_role.arn
container_definitions = jsonencode([
{
name = "folding-gpu"
image = "foldingathome/fah-gpu:latest"
cpu = 2048
memory = 4096
essential = true
environment = [
{
name = "TEAM"
value = "0" # Equipo por defecto
},
{
name = "POWER"
value = "full"
},
{
name = "PUID"
value = "1000"
},
{
name = "PGID"
value = "1000"
},
{
name = "FAH_USER"
value = "Anonymous"
},
{
name = "FAH_PASSKEY"
value = var.folding_passkey
}
]
resourceRequirements = [
{
type = "GPU"
value = "1"
}
]
logConfiguration = {
logDriver = "awslogs"
options = {
awslogs-group = "/ecs/folding-gpu-task"
awslogs-region = var.aws_region
awslogs-stream-prefix = "folding"
}
}
}
])
}
resource "aws_cloudwatch_log_group" "folding_logs" {
name = "/ecs/folding-gpu-task"
retention_in_days = 30
}
resource "aws_ecs_service" "folding_service" {
name = "folding-service"
cluster = aws_ecs_cluster.my_cluster.id
task_definition = aws_ecs_task_definition.folding_gpu_task.arn
desired_count = 1
network_configuration {
subnets = aws_subnet.private_subnet[*].id
security_groups = [aws_security_group.ecs_tasks_sg.id]
assign_public_ip = false
}
capacity_provider_strategy {
capacity_provider = aws_ecs_capacity_provider.ecs_asg_capacity_provider.name
weight = 1
base = 1
}
placement_constraints {
type = "memberOf"
expression = "attribute:ecs.instance-type == g4dn.xlarge"
}
deployment_circuit_breaker {
enable = true
rollback = true
}
}
*/