Пример #1
0
def create_queue_worker_task_definition_resource(template, queue_worker_task_definition_family_variable,
                                                 docker_repository_resource, queue_worker_log_group_resource,
                                                 default_queue_name_variable, notifications_queue_name_variable,
                                                 search_queue_name_variable):
    return template.add_resource(
        ecs.TaskDefinition(
            'QueueWorkerTaskDefinition',
            Family=queue_worker_task_definition_family_variable,
            NetworkMode='bridge',
            RequiresCompatibilities=['EC2'],
            ContainerDefinitions=[ecs.ContainerDefinition(
                Name='api',
                Image=Join('.', [
                    Ref('AWS::AccountId'),
                    'dkr.ecr',
                    Ref('AWS::Region'),
                    Join('/', [
                        'amazonaws.com',
                        Ref(docker_repository_resource)
                    ])
                ]),
                MemoryReservation='256',
                Essential=True,
                LogConfiguration=ecs.LogConfiguration(
                    LogDriver='awslogs',
                    Options={
                        'awslogs-group': Ref(queue_worker_log_group_resource),
                        'awslogs-region': Ref('AWS::Region'),
                        'awslogs-stream-prefix': 'ecs'
                    }
                ),
                Command=[
                    'php',
                    'artisan',
                    'queue:work',
                    '--tries=1',
                    '--queue=default,notifications,search'
                ],
                WorkingDirectory='/var/www/html',
                HealthCheck=ecs.HealthCheck(
                    Command=[
                        'CMD-SHELL',
                        'php -v || exit 1'
                    ],
                    Interval=30,
                    Retries=3,
                    Timeout=5
                )
            )]
        )
    )
Пример #2
0
    def test_allow_container_healthcheck(self):
        health_check_def = ecs.HealthCheck(
            Command=["CMD-SHELL", "curl -f http://localhost/ || exit 1"],
            Interval=5,
            Timeout=30,
            Retries=5,
        )
        container_definition = ecs.ContainerDefinition(
            Image="myimage",
            Memory="300",
            Name="mycontainer",
            HealthCheck=health_check_def,
        )

        container_definition.to_dict()
Пример #3
0
                    'awslogs-stream-prefix': 'ecs'
                }
            ),
            Command=[
                'php',
                'artisan',
                'queue:work',
                '--tries=1',
                Join('=', ['--queue', Join(',', [Ref(sqs_default_queue_name), Ref(sqs_notifications_queue_name)])])
            ],
            WorkingDirectory='/var/www/html',
            HealthCheck=ecs.HealthCheck(
                Command=[
                    'CMD-SHELL',
                    'php -v || exit 1'
                ],
                Interval=30,
                Retries=3,
                Timeout=5
            )
        )]
    )
)

scheduler_task_definition = template.add_resource(
    ecs.TaskDefinition(
        'SchedulerTaskDefinition',
        Family=Ref(scheduler_task_definition_name),
        NetworkMode='bridge',
        RequiresCompatibilities=['EC2'],
        ContainerDefinitions=[ecs.ContainerDefinition(
Пример #4
0
 ecs.ContainerDefinition(
     Environment=[
         ecs.Environment(
             Name='APPMESH_VIRTUAL_NODE_NAME',
             Value=
             'mesh/my-service-mesh/virtualNode/currency-exchange-service-vn'
         ),
         ecs.Environment(Name='ENABLE_ENVOY_XRAY_TRACING',
                         Value='1'),
         ecs.Environment(Name='ENVOY_LOG_LEVEL', Value='trace')
     ],
     Essential=True,
     HealthCheck=ecs.HealthCheck(Command=[
         'CMD-SHELL',
         'curl -s http://localhost:9901/server_info | grep state | grep -q LIVE'
     ],
                                 Interval=5,
                                 Timeout=2,
                                 Retries=3,
                                 StartPeriod=10),
     Image=
     '840364872350.dkr.ecr.us-west-2.amazonaws.com/aws-appmesh-envoy:v1.12.1.0-prod',
     LogConfiguration=ecs.LogConfiguration(
         LogDriver='awslogs',
         Options={
             "awslogs-group":
             '/ecs/aws-currency-exchange-service-h2-xray',
             "awslogs-region": 'us-east-2',
             "awslogs-stream-prefix": 'ecs'
         }),
     Memory=500,
     Name='envoy',