Skip to content

Task definition

Naomichi Yamakita edited this page Jun 18, 2024 · 23 revisions

The task definition needs to be placed in config/deploy/xxx.yml in the application repository. Please refer to the Task definition parameters for the supported parameters.

  • The parameter names must be converted to snake_case format. For example, if it is memoryReservation, please change it to memory_reservation.

Sample

# config/deploy/xxx.yml
family: frontend
network_mode: bridge
container_definitions:
  - name: web
    image: ***.dkr.ecr.ap-northeast-1.amazonaws.com/frontend-web:{{tag}}
    memory: 512
    port_mappings:
      - container_port: 80
        host_port: 0
        protocol: tcp
...

Registering the Initial Task

In ECS, it is necessary to register the task definition of your application before creating resources such as services or scheduled tasks. Genova updates the task definition every time the deploy command is executed, based on the task definition registered in the application repository. However, for the initial task registration only, it is necessary to register the task via a command. It is also acceptable to register a dummy task from the ECS console.

docker-compose run --rm rails thor genova:register-task -r {REPOSITORY} --path config/deploy/***.yml