2

I tried to run Multicontainer Docker in AWS Elastic Beanstalk. Here is my Dockerrun.aws.json

{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
    {
        "command": ["python", "manage.py", "runserver", "0.0.0.0:8000"
        ],
        "environment": [
            {
                "name": "JAEGER_AGENT_HOST",
                "value": "jaeger"
            },
            {
                "name": "STOREFRONT_URL",
                "value": "http://localhost:3000/"
            },
            {
                "name": "DASHBOARD_URL",
                "value": "http://localhost:9000/"
            }
        ],
        "memory": 512,
        "image": "saleor-platform_api",
        "essential": true,
        "links": [
               "api",
               "POSTGRES_USER",
               "redis",
               "worker",
               "jaeger"
            ],
        "mountPoints": [
            {
                "containerPath": "/app/tests",
                "sourceVolume": "_SaleorTests"
            },
            {
                "containerPath": "/app/media",
                "sourceVolume": "Saleor-Media"
            },
            {
                "containerPath": "/app/saleor",
                "sourceVolume": "_Saleor"
            },
            {
                "containerPath": "/app/templates",
                "sourceVolume": "Saleor-templates"
            }
        ],
        "name": "api",
        "portMappings": [
            {
                "containerPort": 8000,
                "hostPort": 8000
            }
        ]
    },
    {
        "environment": [
            {
                "name": "POSTGRES_USER",
                "value": "saleor"
            },
            {
                "name": "POSTGRES_PASSWORD",
                "value": "saleor"
            }
        ],
        "essential": true,
        "memory": 256,
        "image": "library/postgres:11.1-alpine",
        "links": [
               "api",
               "POSTGRES_USER",
               "redis",
               "worker",
               "jaeger"
        ],
        "mountPoints": [
            {
                "containerPath": "/var/lib/postgresql",
                "sourceVolume": "Saleor-Db"
            }
        ],
        "name": "db",
        "portMappings": [
            {
                "containerPort": 5432,
                "hostPort": 5432
            }
        ]
    },
    {
        "essential": true,
        "image": "jaegertracing/all-in-one",
        "name": "jaeger",
        "memory": 256,
        "links": [
               "api",
               "POSTGRES_USER",
               "redis",
               "worker",
               "jaeger"
        ],
        "portMappings": [
            {
                "containerPort": 5775,
                "hostPort": 5775,
                "protocol": "udp"
            },
            {
                "containerPort": 6831,
                "hostPort": 6831,
                "protocol": "udp"
            },
            {
                "containerPort": 6832,
                "hostPort": 6832,
                "protocol": "udp"
            },
            {
                "containerPort": 5778,
                "hostPort": 5778
            },
            {
                "containerPort": 16686,
                "hostPort": 16686
            },
            {
                "containerPort": 14268,
                "hostPort": 14268
            },
            {
                "containerPort": 9411,
                "hostPort": 9411
            }
        ]
    },
    {
        "essential": true,
        "image": "library/redis:5.0-alpine",
        "memory": 256,
        "links": [
               "api",
               "POSTGRES_USER",
               "redis",
               "worker",
               "jaeger"
        ],
        "mountPoints": [
            {
                "containerPath": "/data",
                "sourceVolume": "Saleor-Redis"
            }
        ],
        "name": "redis",
        "portMappings": [
            {
                "containerPort": 6379,
                "hostPort": 6379
            }
        ]
    },
    {
        "command": [
            "celery",
            "-A",
            "saleor",
            "worker",
            "--app=saleor.celeryconf:app",
            "--loglevel=info"
        ],
        "image": "saleor-platform_worker",
        "memory": 256,
        "essential": true,
        "links": [
               "api",
               "POSTGRES_USER",
               "redis",
               "worker",
               "jaeger"
        ],
        "mountPoints": [
            {
                "containerPath": "/app/media",
                "sourceVolume": "Saleor-Media"
            }
        ],
        "name": "worker"
    }
],
"family": "",
"volumes": [

    {
        "host": {
            "sourcePath": "./saleor/saleor/"
        },
        "name": "_Saleor"
    },
    {
        "host": {
            "sourcePath": "./saleor/templates/"
        },
        "name": "Saleor-templates"
    },
    {
        "host": {
            "sourcePath": "./saleor/tests/"
        },
        "name": "_SaleorTests"
    },
    {
        "host": {
            "sourcePath": "saleor-media"
        },
        "name": "Saleor-Media"
    },
    {
        "host": {
            "sourcePath": "saleor-db"
        },
        "name": "Saleor-Db"
    },
    {
        "host": {
            "sourcePath": "saleor-redis"
        },
        "name": "Saleor-Redis"
    }


]

}

However, when I typed "eb local run", it gives me the error "ERROR: ValidationError - The AWSEBDockerrunVersion key in the Dockerrun.aws.json file is not valid or is not included." Does anyone know why? Thanks

Jerry Zhang
  • 215
  • 1
  • 10
  • Can you double check your EB platform? Are you sure its multidocker, and not single-docker? – Marcin Aug 24 '20 at 09:49
  • How do I check whether my EB platform is multidocker and single-docker? I also suspect that I am using a single-docker EB. However, when I use "eb init", it never asks me whether I want a multidocker or single-docker. Thanks – Jerry Zhang Aug 24 '20 at 16:44
  • You can check in the confing file, `cat ./.elasticbeanstalk/config.yml` or `eb platform show` – Marcin Aug 24 '20 at 22:48
  • I think i am using a single-docker right now. Here is my config.yml https://github.com/hkbluesky/settings/blob/master/config.yml How do I change it to multidocker? Thanks – Jerry Zhang Aug 24 '20 at 22:54
  • Strange, it does not show which docker. You can re-select it using `eb platform select`. – Marcin Aug 24 '20 at 22:57
  • 1
    After "eb platform select", it seems running now. But it possibly takes a moment. – Jerry Zhang Aug 24 '20 at 23:01
  • Glad to hear. I will make an answer then for future reference if you don't mind :-) – Marcin Aug 24 '20 at 23:02
  • 1
    No problem. Thanks for your help! – Jerry Zhang Aug 24 '20 at 23:24

1 Answers1

4

Based on the comments.

The issue was that a EB Docker platform was incorrect and/or not chosen.

The solution was to select a correct platform using:

eb platform select
Marcin
  • 215,873
  • 14
  • 235
  • 294
  • 1
    The platform is correct now. But the project still does not work. Should I continue comments here? – Jerry Zhang Aug 24 '20 at 23:27
  • @JerryZhang I think new question with new error messages would be warranted. This will allow others to also contribute and see the new question. – Marcin Aug 24 '20 at 23:28
  • 1
    Yes. I will create a new post for my new question. Thanks – Jerry Zhang Aug 24 '20 at 23:30
  • https://stackoverflow.com/questions/63571928/from-docker-compose-yml-to-dockerrun-aws-json This is my new question. If you can have a look, it will be great. – Jerry Zhang Aug 25 '20 at 04:11
  • I published another post. https://stackoverflow.com/questions/63572956/difficult-fields-from-docker-compose-yml-to-dockerrun-aws-json I will really appreciate your help If you have time to have a look. – Jerry Zhang Aug 25 '20 at 13:35