mirror of
https://github.com/hanzoai/o11y-foundry.git
synced 2026-11-02 14:03: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
167 lines
5.8 KiB
Go Template
167 lines
5.8 KiB
Go Template
{{- $name := $.Metadata.Name -}}
|
|
{
|
|
"locals": {
|
|
"containers": [
|
|
{
|
|
"name": "init-clickhouse",
|
|
"image": "alpine:3.18.2",
|
|
"essential": false,
|
|
"command": ["/bin/sh", "-c", "cd /tmp && wget -O histogram-quantile.tar.gz 'https://github.com/SigNoz/signoz/releases/download/histogram-quantile%2Fv0.0.1/histogram-quantile_linux_amd64.tar.gz' && tar -xzf histogram-quantile.tar.gz && mv histogram-quantile /var/lib/clickhouse/user_scripts/histogramQuantile"],
|
|
"mountPoints": [
|
|
{
|
|
"sourceVolume": "shared-binary-volume",
|
|
"containerPath": "/var/lib/clickhouse/user_scripts"
|
|
}
|
|
],
|
|
"cpu": 256,
|
|
"memory": 256,
|
|
"memoryReservation": 256
|
|
},
|
|
{
|
|
"name": "config-fetcher",
|
|
"image": "amazon/aws-cli:2.27.32",
|
|
"essential": false,
|
|
"entryPoint": ["/bin/sh", "-c"],
|
|
"command": ["aws s3 cp s3://${var.config_bucket}/{{ $name }}/telemetrystore/{{ $.Spec.TelemetryStore.Kind }}/ /configs/telemetrystore/ --recursive"],
|
|
"mountPoints": [
|
|
{
|
|
"sourceVolume": "telemetrystore-{{ $.Spec.TelemetryStore.Kind }}-config",
|
|
"containerPath": "/configs/telemetrystore"
|
|
}
|
|
],
|
|
"cpu": 10,
|
|
"memory": 102,
|
|
"memoryReservation": 102
|
|
},
|
|
{
|
|
"name": "{{ $name }}-telemetrystore-{{ $.Spec.TelemetryStore.Kind }}-0-0",
|
|
"image": "{{ $.Spec.TelemetryStore.Spec.Image }}",
|
|
"essential": true,
|
|
{{- $env := list (dict "name" "CLICKHOUSE_SKIP_USER_SETUP" "value" "1") }}
|
|
{{- range $key, $value := $.Spec.TelemetryStore.Spec.Env }}
|
|
{{- $env = append $env (dict "name" $key "value" $value) }}
|
|
{{- end }}
|
|
"environment": {{ toJson $env }},
|
|
"portMappings": [
|
|
{"name": "native", "containerPort": 9000, "protocol": "tcp"},
|
|
{"name": "http", "containerPort": 8123, "protocol": "tcp", "appProtocol": "http"},
|
|
{"name": "prometheus", "containerPort": 9363, "protocol": "tcp", "appProtocol": "http"}
|
|
],
|
|
"mountPoints": [
|
|
{
|
|
"sourceVolume": "shared-binary-volume",
|
|
"containerPath": "/var/lib/clickhouse/user_scripts"
|
|
},
|
|
{
|
|
"sourceVolume": "telemetrystore-{{ $.Spec.TelemetryStore.Kind }}-config",
|
|
"containerPath": "/etc/clickhouse-server/config.d"
|
|
},
|
|
{
|
|
"sourceVolume": "clickhouse-data",
|
|
"containerPath": "/var/lib/clickhouse"
|
|
}
|
|
],
|
|
"dependsOn": [
|
|
{"containerName": "init-clickhouse", "condition": "SUCCESS"},
|
|
{"containerName": "config-fetcher", "condition": "SUCCESS"}
|
|
],
|
|
"cpu": 1024,
|
|
"memory": 512,
|
|
"memoryReservation": 512,
|
|
"healthCheck": {
|
|
"command": ["CMD-SHELL", "wget --spider -q 0.0.0.0:8123/ping || exit 1"],
|
|
"interval": 30,
|
|
"timeout": 5,
|
|
"retries": 3,
|
|
"startPeriod": 30
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"resource": {
|
|
"aws_s3_object": {
|
|
"telemetrystore_configs": {
|
|
"for_each": "${fileset(\"${path.module}/telemetrystore/{{ $.Spec.TelemetryStore.Kind }}\", \"**\")}",
|
|
"bucket": "${var.config_bucket}",
|
|
"key": "{{ $name }}/telemetrystore/{{ $.Spec.TelemetryStore.Kind }}/${each.value}",
|
|
"source": "${path.module}/telemetrystore/{{ $.Spec.TelemetryStore.Kind }}/${each.value}",
|
|
"etag": "${filemd5(\"${path.module}/telemetrystore/{{ $.Spec.TelemetryStore.Kind }}/${each.value}\")}"
|
|
}
|
|
},
|
|
"aws_ecs_task_definition": {
|
|
"telemetrystore": {
|
|
"family": "{{ $name }}-telemetrystore-{{ $.Spec.TelemetryStore.Kind }}-0-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": "shared-binary-volume",
|
|
"docker_volume_configuration": {
|
|
"scope": "task",
|
|
"driver": "local"
|
|
}
|
|
},
|
|
{
|
|
"name": "telemetrystore-{{ $.Spec.TelemetryStore.Kind }}-config",
|
|
"docker_volume_configuration": {
|
|
"scope": "task",
|
|
"driver": "local"
|
|
}
|
|
},
|
|
{
|
|
"name": "clickhouse-data",
|
|
"docker_volume_configuration": {
|
|
"scope": "task",
|
|
"driver": "local"
|
|
}
|
|
}
|
|
],
|
|
"depends_on": ["aws_s3_object.telemetrystore_configs"]
|
|
}
|
|
},
|
|
"aws_service_discovery_service": {
|
|
"telemetrystore": {
|
|
"name": "telemetrystore-{{ $.Spec.TelemetryStore.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": {
|
|
"telemetrystore": {
|
|
"name": "{{ $name }}-telemetrystore-{{ $.Spec.TelemetryStore.Kind }}-0-0",
|
|
"cluster": "${var.ecs_cluster_id}",
|
|
"task_definition": "${aws_ecs_task_definition.telemetrystore.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.telemetrystore.arn}"
|
|
},
|
|
"depends_on": [
|
|
"aws_ecs_service.telemetrykeeper"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|