-
Notifications
You must be signed in to change notification settings - Fork 881
add: ECS example template #3915
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
Conversation
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.
Thanks for doing this! Tested it out and left some comments which seem to scale up/down the service based on stop and add support for 2 workspaces.
I don't know too much about ECS, but my basic understanding is:
- You create a cluster, typically with AWS instances (VMs)
- You deploy "services" which are containers that run across the VMs
Does this use case aim to provision 1 cluster per workspace, or provision workspaces on an existing cluster, similar to Kubernetes? After the proposed changes are added, this template somehow:
- provisions a cluster when workspace 1 is created + a service + autoscaling group
- provisions services, autoscaling groups on the existing cluster created by workspace 1
It's kinda nice, but doesn't seem like the expected behavior given the Terraform code. I expected it would provision 1 cluster per developer, which seems overkill.
If we don't want this template to create a cluster (at least 1 VM) per developer, we might want to recommend that the Coder admin provisions the cluster (and perhaps the autoscaling group, capacity provider) outside of Coder and then just uses 1 aws_ecs_service
per workspace, similar to our K8s examples.
The cluster can still be provisioned with Terraform, just via a single terraform apply
, outside of Coder not as a part of each workspace.
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.
Worked great for me!
|
||
variable "ecs-cluster" { | ||
description = "Input the ECS cluster ARN to host the workspace" | ||
default = "" |
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.
default = "" | |
sensitive = true |
We're currently using this to indicate whether this is a developer-level variable or template-wide variable. I assume the intended behavior is that the admin picks which cluster workspaces are deploying to?
I also suggest not setting a default value since it will skip it on coder templates create
Some docs: https://coder.com/docs/coder-oss/latest/templates#parameters
Co-authored-by: Ben Potter <ben@coder.com>
this PR adds an example template for creating a workspace as an Elastic Container Service (ECS) hosted container.
I'm submitting this as a draft because of a current issue with stop/start. the workspace builds fine initially, but does not shut down the resources once stopped. I tinkered with adding the
count = data.coder_workspace.me.start_count
argument to the Task Definition resource, but am receiving an odd error when building the template:I haven't been able to debug this error, and would like some extra eyes to assist.