Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Add support for installing Waypoint server to AWS ECS #1564

Merged
merged 17 commits into from
Jun 3, 2021
Merged

Conversation

catsby
Copy link
Contributor

@catsby catsby commented Jun 1, 2021

This PR adds initial support for installing the Waypoint server into AWS ECS as a service. The installation borrowed heavily from the previous impelemention of ECS applications created by waypoint, and has a similar architecture.

UX

$ waypoint install --platform=ecs -accept-tos -ecs-cluster waypoint-server 
✓ Networking setup
✓ Created new ECS cluster: waypoint-server
✓ EFS ready
✓ Found existing IAM role to use: waypoint-server-execution-role
✓ Created CloudWatchLogs group to store logs in: waypoint-server-logs
✓ Network load balancer created
✓ Created ECS Service (waypoint, cluster-name: waypoint-server)
✓ Waiting for target group to be healthy...
✓ Service launched!
✓ Server installed and configured!
✓ Installing runner...
✓ Found existing IAM role to use: waypoint-server-execution-role
✓ Created CloudWatchLogs group to store logs in: waypoint-runner-logs
✓ Runner service created
Waypoint server successfully installed and configured!

The CLI has been configured to connect to the server automatically. This
connection information is saved in the CLI context named "install-1622563419".
Use the "waypoint context" CLI to manage CLI contexts.

The server has been configured to advertise the following address for
entrypoint communications. This must be a reachable address for all your
deployments. If this is incorrect, manually set it using the CLI command
"waypoint server config-set".

To launch and authenticate into the Web UI, run:
waypoint ui -authenticate

Advertise Address: <NLB-public-dns>.elb.us-west-2.amazonaws.com:9701
Web UI Address: https://<NLB-public-dns>.elb.us-west-2.amazonaws.com:9702

Infrastructure used

The main components installed are detailed below:

  • EFS Filesystem: used for persisting the Waypoint server database
  • EC2 Security Group: authorizing traffic in to the cluster, as well as enabling access to the EFS FileSystem from the Cluster
  • CloudWatch Log Groups: a log group is created for each of the Waypoint server and runner services
  • IAM Execution role
  • Network load balancer: required to enable both HTTP and gRPC connections*
  • Load balancing target groups: a target group is created for each of the Waypoint server and runner services
  • ECS Cluster: a cluster dedicated to running the Waypoint server and runner
  • ECS server service: runs the Waypoint server task
  • ECS runner service: runs the default Waypoint runner task
  • ECS Task Definitions: for both the server and runner

* A Network Load Balancer is required because user-supplied TLS certificates are not yet supported

- Working with dynamic efs
- Server installs, runner installs, everything gets destroyed
- Upgrade works except for occasional health check problems
@github-actions github-actions bot added the core label Jun 1, 2021
internal/serverinstall/ecs.go Outdated Show resolved Hide resolved
internal/serverinstall/ecs.go Outdated Show resolved Hide resolved
internal/serverinstall/ecs.go Show resolved Hide resolved
Copy link
Member

@briancain briancain left a comment

Choose a reason for hiding this comment

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

Generally looks good! Nice job 😄

The other major comment is instead of using lots of Status outputs, we should use StepGroups for things like this for example:

These messages have green checks but read like Waypoint is still checking on them

✓ Waiting for EFS mount targets to become available...
✓ Installing runner...

Once it becomes available or installed we should update the stepgroup to refresh the line to say the waiting or installing has completed.

Another example, we can combine some of these messages into stepgroups so we aren't printing too much output on install:

✓ Examining existing CloudWatchLogs groups...
✓ Created CloudWatchLogs group to store logs in: waypoint-server-logs

internal/serverinstall/ecs.go Outdated Show resolved Hide resolved
internal/serverinstall/ecs.go Outdated Show resolved Hide resolved
internal/serverinstall/ecs.go Outdated Show resolved Hide resolved
internal/serverinstall/ecs.go Show resolved Hide resolved
Copy link
Member

@briancain briancain left a comment

Choose a reason for hiding this comment

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

Looks good to me! I just ran through the code and left some suggestions around output and flag doc strings. 🎉

.changelog/1564.txt Outdated Show resolved Hide resolved
internal/serverinstall/ecs.go Outdated Show resolved Hide resolved
internal/serverinstall/ecs.go Outdated Show resolved Hide resolved
internal/serverinstall/ecs.go Outdated Show resolved Hide resolved
internal/serverinstall/ecs.go Outdated Show resolved Hide resolved
internal/serverinstall/ecs.go Outdated Show resolved Hide resolved
internal/serverinstall/ecs.go Outdated Show resolved Hide resolved
Co-authored-by: Brian Cain <bcain@hashicorp.com>
Co-authored-by: Brian Cain <bcain@hashicorp.com>
@briancain briancain added this to the 0.4.0 milestone Jun 2, 2021
Copy link
Contributor

@evanphx evanphx left a comment

Choose a reason for hiding this comment

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

Looks good!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants