Task configuration for aws-ecs-cloudreactor-deploy
The aws-ecs-cloudreactor-deploy Docker image can be used to deploy projects to both AWS ECS and CloudReactor. It reads configuration from your deploy_config
directory set properties in both the ECS task definition and the CloudReactor Task. We’ll show you how to modify the files in this directory below.
Configuration hierarchy
The settings are all (deeply) merged together with Ansible’s Jinja2 combine filter. The precedence of settings, from lowest to highest is:
- Settings found in your Run Environment that you set via the CloudReactor dashboard
- Deployment environment AWS settings – found in
project_aws
indeploy_config/vars/<environment>.yml
- Default Task settings – found in
default_task_config
indeploy_config/vars/common.yml
- Per Task settings – found in
task_name_to_config.<task_name>
indeploy_config/var/common.yml
- Per environment settings – found in
default_env_task_config
indeploy_config/vars/<environment>.yml
. Seedeploy_config/vars/example.yml
an example. - Per Task, per environment settings – found in
task_name_to_env_config.<task_name>
indeploy_config/vars/<environment>.yml
ECS Task Definition settings
- You can add additional properties to the main container running each Task, such as
mountPoints
andportMappings
by settingextra_main_container_properties
in common.yml ordeploy_config/vars/<environment>.yml
. See thefile_io
Task for an example of this. - You can add AWS ECS task properties, such as
volumes
andsecrets
, by settingextra_task_definition_properties
in theecs
property of each task configuration. See thefile_io
Task for an example of this. - You can add additional containers to the Task by setting
extra_container_definitions
indeploy_config/vars/common.yml
ordeploy_config/vars/<environment>.yml
.
Setting management
We recommend that you keep as many default settings in CloudReactor as possible and don’t override them in your project unless required. To manage a setting in the CloudReactor UI, omit the property name and value. That will tell CloudReactor to use the value that you have set either in the Task or Run Environment editor.
It’s possible that you overrode a Task setting during a previous deployment, but later decide to use the default value in the Run Environment. To do that, set the property value to null.
Removing Tasks
To remove a Task, delete the Tasks within the CloudReactor dashboard. This will remove the Task rom AWS also.
You should also remove the reference to the Tasks in ./deploy_config/vars/common.yml
.
- If you don’t, if you run
./cr_deploy.sh [environment]
(without task names), this will (re-)push all tasks – which might include tasks you had intended to remove.
You may also want to remove the task code itself from /src/
For example, if you want to delete the task_1
Task:
- In dash.cloudreactor.io, hit the delete icon next to
task_1
and hit “confirm”. -
Open
./deploy_config/vars/common.yml
and delete the entiretask_1:
code block i.e.:task_1: <<: *default_task_config description: "This description shows up in CloudReactor dashboard" command: "python src/task_1.py" schedule: cron(9 15 * * ? *) wrapper: <<: *default_task_wrapper enable_status_updates: true
- Optionally, delete
/src/task_1.py
.