https://github.com/lkysow/containers-couch-consul-ecs
Demo of Consul on ECS
https://github.com/lkysow/containers-couch-consul-ecs
aws consul containersfromthecouch ecs
Last synced: 4 months ago
JSON representation
Demo of Consul on ECS
- Host: GitHub
- URL: https://github.com/lkysow/containers-couch-consul-ecs
- Owner: lkysow
- Created: 2021-11-16T00:19:18.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-17T19:24:41.000Z (over 4 years ago)
- Last Synced: 2025-10-10T14:42:27.359Z (9 months ago)
- Topics: aws, consul, containersfromthecouch, ecs
- Language: HCL
- Homepage: https://www.consul.io/docs/ecs
- Size: 25.4 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Consul on ECS Demo for Containers on the Couch
This demo stands up Consul on ECS and deploys three example appliations: greeter, greeting, and name. The service architecture is:
```
user => ALB => greeter => greeting
=> name
```
The greeter service depends on the greeting and name services. When it receives a request, it makes a further request to the greeting and name services
to retrieve a greeting (e.g. "Hello") and a name (e.g. "Torres"). It then responds back with `Hello, Torres`.
## Deployment
To deploy, first find out your IP address:
```
curl ifconfig.me
123.456.789.123%
```
This IP address will be used to secure the load balancers.
Clone this repo, `cd` into its directory and create a `terraform.tfvars` file with that IP:
```hcl
lb_ingress_ip = "207.6.233.68"
```
Run `terraform apply` to spin up:
* VPC
* ECS cluster
* The three applications
* Prometheus
Three URLs to the Consul UI, greeter service, and Prometheus will be output. You should be able to navigate to the greeter service URL.
### Metrics
In order to configure Consul to emit metrics to Prometheus, you must set some [configuration entries](https://www.consul.io/docs/connect/config-entries).
Use the Consul UI URL from your installation:
```
export CONSUL_HTTP_ADDR=http://consul-server-123.us-east-1.elb.amazonaws.com:8500
```
[Download Consul](https://www.consul.io/downloads) and run:
```
consul config write consul-configs/proxy-defaults.hcl
```
Now you need to restart the greeter, greeting, and name, tasks so they pick up this new config.
You can do this through the AWS console by stopping the tasks so new ones spin up.
Now you should see Prometheus metrics in the Consul UI.
### Routing
In order to try out Consul's routing configuration, apply the splitter and resolver configs:
```
consul config write consul-configs/service-resolver.hcl
consul config write consul-configs/service-splitter.hcl
```
When set to the `green` subset, the greeting will always be `Guten Tag!`. Try modifying the splitter configuration to point at the `blue` subset.