Search code examples
amazon-web-servicesdockerdocker-composeamazon-ecsstrapi

Strapi v3.0.0.alpha.12.4 not working with AWS


I am new to AWS ECS. I launched a ECS instance with old version of strapi alpha.12 which is working fine on the launch side but it has some bugs. A new version alpha.12.4 has come up fixing these bugs. I ran a container locally and it is working fine. I used docker-compose with version 3.

The problem is with when I deployed this container in AWS. I used the same task defintion as the previous working instance and just changed the tag. I used the specific tag for the recent version instead of latest just to rule out any caching possibility. Of course, I tried with latest tag too. None of them seem to work.

As one last try, I deployed the container with ECS CLI and the problem persists.

Any pointers to address this issue would be great.

Update

{
  "executionRoleArn": null,
  "containerDefinitions": [
    {
      "dnsSearchDomains": [],
      "logConfiguration": null,
      "entryPoint": [],
      "portMappings": [
        {
          "hostPort": 80,
          "protocol": "tcp",
          "containerPort": 1337
        }
      ],
      "command": [],
      "linuxParameters": {
        "capabilities": {
          "add": null,
          "drop": null
        },
        "sharedMemorySize": null,
        "tmpfs": null,
        "devices": null,
        "initProcessEnabled": null
      },
      "cpu": 10,
      "environment": [
        {
          "name": "APP_NAME",
          "value": "strapi-app"
        },
        {
          "name": "DATABASE_CLIENT",
          "value": "mongo"
        },
        {
          "name": "DATABASE_HOST",
          "value": "db"
        },
        {
          "name": "DATABASE_NAME",
          "value": "strapi"
        },
        {
          "name": "DATABASE_PASSWORD",
          "value": ""
        },
        {
          "name": "DATABASE_PORT",
          "value": "27017"
        },
        {
          "name": "DATABASE_USERNAME",
          "value": ""
        }
      ],
      "ulimits": null,
      "dnsServers": [],
      "mountPoints": [
        {
          "readOnly": false,
          "containerPath": "/usr/src/api/strapi-app",
          "sourceVolume": "volume-0"
        }
      ],
      "workingDirectory": null,
      "dockerSecurityOptions": [],
      "memory": 512,
      "memoryReservation": null,
      "volumesFrom": [],
      "image": "strapi/strapi",
      "disableNetworking": null,
      "healthCheck": null,
      "essential": true,
      "links": [
        "db"
      ],
      "hostname": null,
      "extraHosts": null,
      "user": null,
      "readonlyRootFilesystem": false,
      "dockerLabels": null,
      "privileged": false,
      "name": "api"
    },
    {
      "dnsSearchDomains": [],
      "logConfiguration": null,
      "entryPoint": [],
      "portMappings": [
        {
          "hostPort": 27017,
          "protocol": "tcp",
          "containerPort": 27017
        }
      ],
      "command": [],
      "linuxParameters": {
        "capabilities": {
          "add": null,
          "drop": null
        },
        "sharedMemorySize": null,
        "tmpfs": null,
        "devices": null,
        "initProcessEnabled": null
      },
      "cpu": 10,
      "environment": [
        {
          "name": "MONGO_INITDB_DATABASE",
          "value": "strapi"
        }
      ],
      "ulimits": null,
      "dnsServers": [],
      "mountPoints": [
        {
          "readOnly": false,
          "containerPath": "/data/db",
          "sourceVolume": "volume-2"
        }
      ],
      "workingDirectory": null,
      "dockerSecurityOptions": [],
      "memory": 512,
      "memoryReservation": null,
      "volumesFrom": [],
      "image": "mongo",
      "disableNetworking": null,
      "healthCheck": null,
      "essential": true,
      "links": [],
      "hostname": null,
      "extraHosts": null,
      "user": null,
      "readonlyRootFilesystem": false,
      "dockerLabels": null,
      "privileged": false,
      "name": "db"
    }
  ],
  "placementConstraints": [],
  "memory": null,
  "taskRoleArn": "arn:aws:iam::**myaccount**:role/ecsTaskExecutionRole",
  "compatibilities": [
    "EC2"
  ],
  "taskDefinitionArn": "arn:aws:ecs:eu-central-1:**myaccount**:task-definition/sriharsha:16",
  "family": "sriharsha",
  "requiresAttributes": [
    {
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "com.amazonaws.ecs.capability.docker-remote-api.1.17"
    },
    {
      "targetId": null,
      "targetType": null,
      "value": null,
      "name": "com.amazonaws.ecs.capability.task-iam-role"
    }
  ],
  "requiresCompatibilities": [
    "EC2"
  ],
  "networkMode": "bridge",
  "cpu": null,
  "revision": 16,
  "status": "ACTIVE",
  "volumes": [
    {
      "name": "volume-2",
      "host": {
        "sourcePath": "/db"
      }
    },
    {
      "name": "volume-0",
      "host": {
        "sourcePath": "/strapi-app"
      }
    },
    {
      "name": "volume-1",
      "host": {
        "sourcePath": "/usr/src/api/strapi-app/node_modules"
      }
    }
  ]
}

Solution

  • Answering my own question.

    I built a new custom image based on 12.5 release and it is working good with AWS EKS.

    The image is not found in the official repository on dockerhub yet.

    My custom image can be pulled from spolimetla/strapi