mirror of
https://github.com/hanzoai/o11y-foundry.git
synced 2026-11-02 09:38:05 +00:00
#### Features - Adds forge for the ecs ec2 terraform casting - Adds cast for terraform - Adds tooler for terraform Related: https://github.com/SigNoz/platform-pod/issues/1772
95 lines
2.7 KiB
Go Template
95 lines
2.7 KiB
Go Template
{{- $name := $.Metadata.Name -}}
|
|
{
|
|
"locals": {
|
|
"containers": [
|
|
{
|
|
"name": "{{ $name }}-metastore-{{ $.Spec.MetaStore.Kind }}-0",
|
|
"image": "{{ $.Spec.MetaStore.Spec.Image }}",
|
|
"essential": true,
|
|
{{- $env := list }}
|
|
{{- range $key, $value := $.Spec.MetaStore.Spec.Env }}
|
|
{{- $env = append $env (dict "name" $key "value" $value) }}
|
|
{{- end }}
|
|
"environment": {{ toJson $env }},
|
|
"portMappings": [
|
|
{"name": "postgres", "containerPort": 5432, "protocol": "tcp"}
|
|
],
|
|
"mountPoints": [
|
|
{
|
|
"sourceVolume": "postgres-data",
|
|
"containerPath": "/var/lib/postgresql/data"
|
|
}
|
|
],
|
|
"cpu": 256,
|
|
"memory": 256,
|
|
"memoryReservation": 256,
|
|
"healthCheck": {
|
|
"command": ["CMD-SHELL", "pg_isready -U postgres || exit 1"],
|
|
"interval": 30,
|
|
"timeout": 5,
|
|
"retries": 3,
|
|
"startPeriod": 30
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"resource": {
|
|
"aws_ecs_task_definition": {
|
|
"metastore": {
|
|
"family": "{{ $name }}-metastore-{{ $.Spec.MetaStore.Kind }}-0",
|
|
"network_mode": "awsvpc",
|
|
"requires_compatibilities": ["EC2"],
|
|
"task_role_arn": "${var.task_role_arn}",
|
|
"execution_role_arn": "${var.task_execution_role_arn}",
|
|
"container_definitions": "${jsonencode(local.containers)}",
|
|
"volume": [
|
|
{
|
|
"name": "postgres-data",
|
|
"docker_volume_configuration": {
|
|
"scope": "task",
|
|
"driver": "local"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"aws_service_discovery_service": {
|
|
"metastore": {
|
|
"name": "metastore-{{ $.Spec.MetaStore.Kind }}",
|
|
"dns_config": {
|
|
"namespace_id": "${aws_service_discovery_private_dns_namespace.main.id}",
|
|
"dns_records": [
|
|
{
|
|
"ttl": 10,
|
|
"type": "A"
|
|
}
|
|
],
|
|
"routing_policy": "MULTIVALUE"
|
|
}
|
|
}
|
|
},
|
|
"aws_ecs_service": {
|
|
"metastore": {
|
|
"name": "{{ $name }}-metastore-{{ $.Spec.MetaStore.Kind }}-0",
|
|
"cluster": "${var.ecs_cluster_id}",
|
|
"task_definition": "${aws_ecs_task_definition.metastore.arn}",
|
|
"desired_count": 1,
|
|
"capacity_provider_strategy": [
|
|
{
|
|
"capacity_provider": "${var.capacity_provider}",
|
|
"weight": 1,
|
|
"base": 0
|
|
}
|
|
],
|
|
"network_configuration": {
|
|
"subnets": "${var.subnet_ids}",
|
|
"security_groups": "${var.security_group_ids}"
|
|
},
|
|
"service_registries": {
|
|
"registry_arn": "${aws_service_discovery_service.metastore.arn}"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|