Skip to content

Commit

Permalink
fixes #3: delivering requirements.txt to container over the user data…
Browse files Browse the repository at this point in the history
… in container instance
  • Loading branch information
jakubberezowski authored and charlie4gfk committed Jan 19, 2021
1 parent b197335 commit 701ff28
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 8 deletions.
Binary file modified docs/module_architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ resource "aws_ecs_task_definition" "webserver" {
requires_compatibilities = [var.ecs_launch_type]
task_role_arn = aws_iam_role.ecs_task_role.arn

volume {
name = "requirements_on_ec2"
host_path = "/home/ec2-user/airflow/docker/requirements.txt"
}

volume {
name = "requirements"
efs_volume_configuration {
Expand Down Expand Up @@ -134,6 +139,11 @@ resource "aws_ecs_task_definition" "scheduler" {
requires_compatibilities = [var.ecs_launch_type]
task_role_arn = aws_iam_role.ecs_task_role.arn

volume {
name = "requirements_on_ec2"
host_path = "/home/ec2-user/airflow/docker/requirements.txt"
}

volume {
name = "requirements"
efs_volume_configuration {
Expand Down Expand Up @@ -186,6 +196,11 @@ resource "aws_ecs_task_definition" "worker" {
requires_compatibilities = [var.ecs_launch_type]
task_role_arn = aws_iam_role.ecs_task_role.arn

volume {
name = "requirements_on_ec2"
host_path = "/home/ec2-user/airflow/docker/requirements.txt"
}

volume {
name = "requirements"
efs_volume_configuration {
Expand Down
10 changes: 5 additions & 5 deletions templates/scheduler.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@
"containerPath": "/usr/local/airflow/dags",
"sourceVolume": "dags"
},
{
"readOnly": true,
"containerPath": "/requirements.txt",
"sourceVolume": "requirements_on_ec2"
},
{
"readOnly": false,
"containerPath": "/usr/local/airflow/logs",
"sourceVolume": "scheduler_logs"
},
{
"readOnly": true,
"containerPath": "/requirements.txt",
"sourceVolume": "requirements"
}
],
"workingDirectory": null,
Expand Down
2 changes: 1 addition & 1 deletion templates/webserver.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
{
"readOnly": true,
"containerPath": "/requirements.txt",
"sourceVolume": "requirements"
"sourceVolume": "requirements_on_ec2"
},
{
"readOnly": false,
Expand Down
2 changes: 1 addition & 1 deletion templates/worker.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
{
"readOnly": true,
"containerPath": "/requirements.txt",
"sourceVolume": "requirements"
"sourceVolume": "requirements_on_ec2"
},
{
"readOnly": false,
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ variable "key_name" {
variable "ecs_ami_id" {
type = string
description = "ECS container instance ami."
default = "ami-0b7f40a0eabbcc8c0"
default = "ami-0e781777db20a4f7f"
}

variable "ecs_instance_type" {
Expand Down

0 comments on commit 701ff28

Please sign in to comment.