-
-
Notifications
You must be signed in to change notification settings - Fork 32
DEV-3798 Document the new ECS Strategy #856
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
base: master
Are you sure you want to change the base?
Conversation
…o ecs-atmos-deployment * 'ecs-atmos-deployment' of github.com:cloudposse/docs: Fix release versioning by storing library docs in draft releases (#854) docs: Add RunsOn regional availability guidance to primary region decision (#851) Add redirects for all Spacelift tutorials (#853) Add redirect for Spacelift tutorial (#850)
milldr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix build (broken links)
docs/jumpstart/action-items.mdx
Outdated
| ### <StepNumber/> PATs for ECS with `ecspresso` (Deprecated) | ||
|
|
||
| :::note | ||
| This step can likely be skipped. The ecspresso-based ECS deployment approach is deprecated in favor of [ECS with Atmos](/layers/software-delivery/ecs-atmos/), which does not require these PATs. | ||
| ::: | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just remove this whole section from this page and move all requirements for ecspresso to that ecspresso page, docs/layers/software-delivery/ecs-ecspresso/ecs-ecspresso.mdx
| ### <StepNumber/> Deploy Platform Infrastructure | ||
|
|
||
| Deploy the foundational infrastructure components in your `infra` repository. | ||
|
|
||
| Ensure the following components are deployed in your target AWS accounts: | ||
|
|
||
| ```bash | ||
| # Deploy VPC | ||
| atmos terraform deploy vpc -s plat-use1-dev | ||
| atmos terraform deploy vpc -s plat-use1-staging | ||
| atmos terraform deploy vpc -s plat-use1-prod | ||
|
|
||
| # Deploy ECS Cluster | ||
| atmos terraform deploy ecs/cluster -s plat-use1-dev | ||
| atmos terraform deploy ecs/cluster -s plat-use1-staging | ||
| atmos terraform deploy ecs/cluster -s plat-use1-prod | ||
|
|
||
| # Deploy Github OIDC Provider | ||
| atmos terraform deploy github-oidc-provider -s plat-gbl-dev | ||
| atmos terraform deploy github-oidc-provider -s plat-gbl-staging | ||
| atmos terraform deploy github-oidc-provider -s plat-gbl-prod | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of asking the user to redeploy these specific three components, we should have a task list that lists what is required for the ECS app. (see the "TaskList" component).
Phrasing like we have in now implies that the user has to redeploy a VPC, EKS cluster, and GitHub OIDC, but in reality, those are already all deployed by this point.
| The template includes: | ||
| - Sample Go application with Dockerfile | ||
| - GitHub Actions workflows for CI/CD | ||
| - Terraform/OpenTofu components for ECS task definitions | ||
| - Atmos stack configurations for each environment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| tfstate-backend-apps: | ||
| vars: | ||
| privileged_principal_arns: | ||
| - !terraform.state example-app/iam-role .role.arn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the valid format
milldr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see comments.
milldr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see comments.
| ### ECS with Atmos (Recommended) | ||
|
|
||
| The [app-on-ecs-v2](https://github.com/cloudposse-examples/app-on-ecs-v2) example demonstrates a self-contained approach where workflows are defined directly in the application repository. This approach uses Atmos for configuration orchestration and OpenTofu for infrastructure management. | ||
|
|
||
| With this approach, you need only a few workflows in your application repository: | ||
|
|
||
| 1. `feature-branch.yml` - Build and deploy to preview environments | ||
| 2. `preview-cleanup.yml` - Clean up preview environments when PRs close | ||
| 3. `main-branch.yaml` - Build, deploy to dev, and create draft release | ||
| 4. `release.yaml` - Promote and deploy to staging/production | ||
| 5. (optional) `validate.yml` - Run validation checks | ||
| 6. (optional) `labeler.yaml` - Auto-label PRs | ||
|
|
||
| ```console | ||
| app-on-ecs-v2/ | ||
| ├── .github/ | ||
| │ └── workflows/ | ||
| │ ├── feature-branch.yml | ||
| │ ├── preview-cleanup.yml | ||
| │ ├── main-branch.yaml | ||
| │ ├── release.yaml | ||
| │ ├── validate.yml | ||
| │ └── labeler.yaml | ||
| ├── app/ | ||
| │ ├── main.go | ||
| │ └── Dockerfile | ||
| ├── terraform/ | ||
| │ ├── components/ | ||
| │ │ └── ecs-task/ | ||
| │ └── stacks/ | ||
| │ ├── dev.yaml | ||
| │ ├── staging.yaml | ||
| │ ├── prod.yaml | ||
| │ └── preview.yaml | ||
| └── .opentofu-version | ||
| ``` | ||
|
|
||
| ### ECS with Ecspresso (Deprecated) | ||
|
|
||
| :::warning | ||
| The ecspresso-based approach is deprecated. For new projects, use [ECS with Atmos](/layers/software-delivery/ecs-atmos/) instead. | ||
| ::: | ||
|
|
||
| <details> | ||
| <summary>View deprecated ecspresso workflow structure</summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should be on the given page for the implementation. For instance move ECS with Atmos (Recommended) to the ecs-atmos.mdx and ECS with Ecspresso to ecs-ecspresso.mdx
Or if it's a high-level description, it should be included in the tab content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you add this to refarch-scaffold?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
| ```yaml title="terraform/stacks/deps/vpc.yaml" | ||
| components: | ||
| terraform: | ||
| vpc: | ||
| metadata: | ||
| component: vpc | ||
| type: abstract | ||
| terraform_workspace: "{{ .vars.tenant }}-{{ .vars.environment }}-{{ .vars.deps_stage }}" | ||
| backend_type: s3 | ||
| backend: | ||
| s3: | ||
| bucket: "acme-core-gbl-root-tfstate" | ||
| region: "us-east-1" | ||
| encrypt: true | ||
| key: terraform.tfstate | ||
| acl: bucket-owner-full-control | ||
| assume_role: | ||
| role_arn: "arn:aws:iam::111111111111:role/acme-core-gbl-root-tfstate-ro" | ||
| ``` | ||
|
|
||
| ```yaml title="terraform/stacks/deps/ecs-cluster.yaml" | ||
| components: | ||
| terraform: | ||
| vpc: | ||
| metadata: | ||
| component: vpc | ||
| type: abstract | ||
| terraform_workspace: "{{ .vars.tenant }}-{{ .vars.environment }}-{{ .vars.deps_stage }}" | ||
| backend_type: s3 | ||
| backend: | ||
| s3: | ||
| bucket: "acme-core-gbl-root-tfstate" | ||
| region: "us-east-1" | ||
| encrypt: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second YAML example appears to have a copy-paste error—it defines vpc: instead of ecs-cluster::
components:
terraform:
ecs-cluster: # <-- Should be ecs-cluster, not vpc
metadata:
component: ecs-cluster # <-- And here
...
| - [ ] Container definitions configured in `terraform/stacks/default/app.yaml` | ||
| - [ ] `atmos terraform plan app -s preview` runs successfully | ||
| </TaskList> | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add call to action for trigger workflows. See the CTA component
| ### <StepNumber/> Create a Pull Request | ||
|
|
||
| Create a PR and add the `deploy` label to deploy a preview environment: | ||
|
|
||
| ```bash | ||
| git checkout -b feature/test-preview | ||
| # Make changes | ||
| git push origin feature/test-preview | ||
| ``` | ||
|
|
||
| Then add the `deploy` label to the PR in GitHub. | ||
| </Step> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Where can the user see this preview environment? (github ui has deployment link)
- What are the different CI or CD steps that are being run for a preview environment? (add simple explanation)
- What cluster is this deployed to by default? (dev)
|
|
||
| Then add the `deploy` label to the PR in GitHub. | ||
| </Step> | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR clean up steps?
| ### <StepNumber/> Merge PR into Main Branch | ||
|
|
||
| Push any change to the `main` branch to trigger the main branch workflow: | ||
|
|
||
| ```bash | ||
| git add . | ||
| git commit -m "Initial setup" | ||
| git push origin main | ||
| ``` | ||
|
|
||
| This will: | ||
| - Build and push a Docker image to ECR | ||
| - Deploy to the `dev` environment | ||
| - Create a draft release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- What CI or CD steps are being run now?
- Where can the engineer see the deployment?
- What ECS cluster is this deployed to? How is that determined?
| <Step> | ||
| ### <StepNumber/> Publish a Release | ||
|
|
||
| Edit the draft release created by the main branch workflow and click "Publish release". This will: | ||
| - Promote the Docker image tag | ||
| - Deploy to `staging` | ||
| - Wait for approval (if configured) | ||
| - Deploy to `prod` | ||
| </Step> | ||
| </Steps> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Again, now what CI / CD steps are being run?
- Where can the engineer see the deployment?
- How do we configure approval?
Co-authored-by: Dan Miller <miller0daniel@gmail.com>


what
why