|
2 | 2 |
|
3 | 3 |
|
4 | 4 | This CLI tool makes it easy to run Docker Compose applications on [ECS](https://aws.amazon.com/ecs)
|
5 |
| - |
| 5 | + |
| 6 | +# Usage |
| 7 | + |
| 8 | +Starting with a standard [Compose file](https://compose-spec.io/) - with some restrictions: |
| 9 | +```yaml |
| 10 | +services: |
| 11 | + jenkins: |
| 12 | + image: jenkins/jenkins:lts |
| 13 | + ports: |
| 14 | + - 8080:8080 |
| 15 | +``` |
| 16 | +
|
| 17 | +run `compose-ecs up` and watch CloudFormation creating resources matching the Compose application model: |
| 18 | +``` |
| 19 | +$ compose-ecs up |
| 20 | +[+] Running 10/12 |
| 21 | + ⠴ demo CreateInProgress User Initiated 145.6s |
| 22 | + ⠿ LogGroup CreateComplete 2.0s |
| 23 | + ⠿ JenkinsTCP8080TargetGroup CreateComplete 17.0s |
| 24 | + ⠿ CloudMap CreateComplete 46.1s |
| 25 | + ⠿ DefaultNetwork CreateComplete 6.1s |
| 26 | + ⠴ LoadBalancer CreateComplete 142.6s |
| 27 | + ⠿ Cluster CreateComplete 5.1s |
| 28 | + ⠿ JenkinsTaskExecutionRole CreateComplete 19.1s |
| 29 | + ⠿ Default8080Ingress CreateComplete 1.0s |
| 30 | + ⠿ DefaultNetworkIngress CreateComplete 1.0s |
| 31 | + ⠿ JenkinsTaskDefinition CreateComplete 1.0s |
| 32 | + ⠿ JenkinsServiceDiscoveryEntry CreateComplete 1.0s |
| 33 | + ⠋ JenkinsService CreateInProgress Resource creation Initiated 6.0s |
| 34 | + |
| 35 | +``` |
| 36 | +
|
| 37 | +In case of a deployment error, check the CloudFormation console for first failure event(s) and reason |
| 38 | +
|
| 39 | +
|
| 40 | +Access service logs using `compose-ecs logs`like you would do with docker compose: |
| 41 | +``` |
| 42 | +$compose-ecs logs |
| 43 | +jenkins | Running from: /usr/share/jenkins/jenkins.war |
| 44 | +jenkins | webroot: /var/jenkins_home/war |
| 45 | +... |
| 46 | +jenkins | 2023-04-21 09:47:38.075+0000 [id=29] INFO jenkins.install.SetupWizard#init: |
| 47 | +jenkins | ************************************************************* |
| 48 | +jenkins | ************************************************************* |
| 49 | +jenkins | ************************************************************* |
| 50 | +jenkins | Jenkins initial setup is required. An admin user has been created and a password generated. |
| 51 | +jenkins | Please use the following password to proceed to installation: |
| 52 | +jenkins | 47e2e8c8e9e74e5f85d99b56e794e95d |
| 53 | +jenkins | This may also be found at: /var/jenkins_home/secrets/initialAdminPassword |
| 54 | +jenkins | ************************************************************* |
| 55 | +jenkins | ************************************************************* |
| 56 | +jenkins | ************************************************************* |
| 57 | +``` |
| 58 | +
|
| 59 | +Use `compose-ecs ps` to retrieve public URL for exposed service: |
| 60 | +``` |
| 61 | +$ compose-ecs ps |
| 62 | +NAME COMMAND SERVICE STATUS PORTS |
| 63 | +task/demo/97db280b80d1407abe2c7e74de8944e5 "" jenkins Running demo-LoadBa-1V9BXV1VRS6IP-f595d8e2cf1df3d6.elb.eu-west-3.amazonaws.com:8080:8080->8080/tcp |
| 64 | +``` |
| 65 | +
|
| 66 | +Enjoy service running on AWS ... and eventually run `compose-ecs down` to cleanup all resources: |
| 67 | +``` |
| 68 | +$ compose-ecs down |
| 69 | +[+] Running 2/4 |
| 70 | + ⠋ demo DeleteInProgress User Initiated 45.1s |
| 71 | + ⠋ JenkinsService DeleteInProgress 44.1s |
| 72 | + ⠿ DefaultNetworkIngress DeleteComplete 0.0s |
| 73 | + ⠿ Default8080Ingress DeleteComplete 0.0s |
| 74 | +... |
| 75 | +``` |
| 76 | +
|
| 77 | +If you want to review or tweak the applied CloudFormation template, run `compose-ecs convert`: |
| 78 | +``` |
| 79 | +$ compose-ecs convert |
| 80 | +(...) |
| 81 | + LoadBalancer: |
| 82 | + Properties: |
| 83 | + LoadBalancerAttributes: |
| 84 | + - Key: load_balancing.cross_zone.enabled |
| 85 | + Value: "true" |
| 86 | + Scheme: internet-facing |
| 87 | + Subnets: |
| 88 | + - subnet-xxx |
| 89 | + - subnet-yyy |
| 90 | + - subnet-zzz |
| 91 | + Tags: |
| 92 | + - Key: com.docker.compose.project |
| 93 | + Value: demo |
| 94 | + Type: network |
| 95 | + Type: AWS::ElasticLoadBalancingV2::LoadBalancer |
| 96 | + LogGroup: |
| 97 | + Properties: |
| 98 | + LogGroupName: /docker-compose/demo |
| 99 | + Type: AWS::Logs::LogGroup |
| 100 | +``` |
| 101 | +
|
6 | 102 |
|
7 | 103 | Please create [issues](https://github.com/docker/compose-ecs/issues) to leave feedback.
|
8 | 104 |
|
0 commit comments