Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate 2017 API ECS services Budget and Emergency Services from EC2 to Fargate #69

Merged
merged 11 commits into from
Jun 30, 2019

Conversation

MikeTheCanuck
Copy link
Collaborator

Resolves hackoregon/civic-devops#244 for two of the five 2017 API services, and provides a working pathway to begin addressing hackoregon/civic-devops#238.

Converts two non-identical ECS services from EC2-based deployment to Fargate-based deployment.

These two Django APIs have dissimilar configurations (e.g. one logs its incoming requests to CloudWatch, the other does not), and have been migrated to Fargate tasks such that:

  • Listener priorities are preserved (note: this doesn't generally work when replacing directly - I had to do some interim juggling by setting the new Fargate tasks to different Listener priorities, so that the existing ones would drain, and then reset the Listener priorities for the new Fargate tasks back to their original values)
  • a Task Execution role is now defined as part of the ECS cluster that provides the ECS Fargate tasks the same level of access to AWS as the ECS EC2 services have
  • a new security group is defined for access to the ECS Fargate Tasks
  • TaskCpu, TaskMemory, ECSTaskExecutionRole, SecurityGroup and Subnets configurations are passed into the Fargate services from the master template

We are taking the opportunity - as part of our goals this season to reduce the AWS costs for our "staging" deploys - to reduce the number of container instances (Tasks) deployed in Fargate to 1 from the 2 that we have always deployed for every container since 2017.

Removed from/to combination intended for health check that I learned since defaults to its FromPort on the same port as the target listens on
…requests

Can now confirm CloudWatch records healthcheck and external requests in the 2107-emergency-response-api task's CloudWatch logs
Only allow the port that's used by ALB to reach the containerized app
Moved from a temporary master-fargate-experiments.yaml that we no longer need
Removing no-longer-needed templates and template configurations for the 2017 Budget and Emergency services that have been migrated to Fargate
Copy link
Contributor

@DingoEatingFuzz DingoEatingFuzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really awesome start to this migration!

fargate-services/2017-budget-api.yaml Show resolved Hide resolved
]
}
]
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an open issue to refactor these TaskRoles to be provided to the stack rather than duplicated across every service?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was on my list of to-do's, and there is now:
hackoregon/civic-devops#249

@MikeTheCanuck MikeTheCanuck merged commit 04e0f75 into master Jun 30, 2019
@MikeTheCanuck MikeTheCanuck changed the title Deploying two 2017 API containers to ECS using Fargate Migrate 2017 API ECS services Budget and Emergency Services from EC2 to Fargate Aug 10, 2019
@MikeTheCanuck MikeTheCanuck deleted the civic-devops-244 branch September 25, 2019 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert 2017 & 2018 API services from EC2 to Fargate
2 participants