I have deployed quay.io/keycloak/keycloak:15.1.1
on an AWS ECS Cluster.The container logs are showing the following errors when running.
Database connection is working properly. However, I can only see errors related to Wildfly. The AWS ECS Cluster is running on private subnets, and internet traffic is routed through a load balancer.
(I have successfully run this image on Kubernetes with the same environment variables, but on ECS, it is not working.)
Can you guys help me to fix this problem?
ECS Container CloudWatch Logs
[0m [31m16:46:23,137 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service org.wildfly.network.interface.private: org.jboss.msc.service.StartException in service org.wildfly.network.interface.private: WFLYSRV0082: failed to resolve interface private
[0m [31m16:46:23,162 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("interface" => "private")]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.network.interface.private" => "WFLYSRV0082: failed to resolve interface private"}}
[0m [31m16:46:23,628 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: Keycloak 15.1.1 (WildFly Core 15.0.1.Final) started (with errors) in 13879ms - Started 492 of 950 services (54 services failed or missing dependencies, 701 services are lazy, passive or on-demand)
ECS Deployment Configurations
- Terraform Task Definition
resource "aws_ecs_task_definition" "task_def" {
family = "keycloak-ecs-task-definition"
network_mode = "awsvpc"
requires_compatibilities = ["FARGATE"]
execution_role_arn = aws_iam_role.keycloak_ecs_task_execution_role.arn
task_role_arn = aws_iam_role.keycloak_ecs_task_role.arn
cpu = 1024
memory = 2048
container_definitions = file("task-def/keycloak.json")
}
- AWS ECS Task Definition JSON File
[
{
"essential": true,
"name": "keycloak-container",
"cpu": 1000,
"memory": 2000,
"image": "quay.io/keycloak/keycloak:15.1.1",
"mountPoints": [],
"systemControls": [],
"volumesFrom": [],
"environment": [
{
"name": "PROXY_ADDRESS_FORWARDING",
"value": "true"
},
{
"name": "DB_VENDOR",
"value": "postgres"
},
{
"name": "DB_ADDR",
"value": ""
},
{
"name": "DB_PORT",
"value": "5432"
},
{
"name": "DB_DATABASE",
"value": ""
},
{
"name": "KEYCLOAK_HOSTNAME",
"value": ""
},
{
"name": "KEYCLOAK_USER",
"value": ""
},
{
"name": "KEYCLOAK_PASSWORD",
"value": ""
},
{
"name": "KEYCLOAK_ADMIN",
"value": ""
},
{
"name": "KEYCLOAK_ADMIN_PASSWORD",
"value": ""
},
{
"name": "DB_USER",
"value": ""
},
{
"name": "DB_PASSWORD",
"value": ""
}
],
"portMappings": [
{
"containerPort": 8080,
"hostPort": 8080,
"protocol": "tcp",
"name" : "http"
},
{
"containerPort": 8443,
"hostPort": 8443,
"protocol": "tcp",
"name" : "https"
}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "keycloak/ecs",
"awslogs-region": "us-west-1",
"awslogs-stream-prefix": "keycloak-ecs-log-stream",
"awslogs-create-group": "true"
}
}
}
]