Skip to content

Commit

Permalink
chore(docs): update operational commands, cdn, static site pages (#5047)
Browse files Browse the repository at this point in the history
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
  • Loading branch information
huanjani authored Jul 7, 2023
1 parent 28f0de0 commit e1e5e52
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 38 deletions.
2 changes: 1 addition & 1 deletion internal/pkg/describe/backend_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func (w *backendSvcDesc) HumanString() string {
}
}
if len(w.ServiceConnect) > 0 || len(w.ServiceDiscovery) > 0 {
fmt.Fprint(writer, color.Bold.Sprint("\nInternal Service Endpoint\n\n"))
fmt.Fprint(writer, color.Bold.Sprint("\nInternal Service Endpoints\n\n"))
writer.Flush()
endpoints := serviceEndpoints{
discoveries: w.ServiceDiscovery,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/describe/backend_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ Rollback Alarms
alarmName1 test alarm description 1
alarmName2 prod alarm description 2
Internal Service Endpoint
Internal Service Endpoints
Endpoint Environment Type
-------- ----------- ----
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/describe/lb_web_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ func (w *webSvcDesc) HumanString() string {
fmt.Fprintf(writer, " %s\t%s\n", route.Environment, route.URL)
}
if len(w.ServiceConnect) > 0 || len(w.ServiceDiscovery) > 0 {
fmt.Fprint(writer, color.Bold.Sprint("\nInternal Service Endpoint\n\n"))
fmt.Fprint(writer, color.Bold.Sprint("\nInternal Service Endpoints\n\n"))
writer.Flush()
endpoints := serviceEndpoints{
discoveries: w.ServiceDiscovery,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/describe/lb_web_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ Routes
test http://my-pr-Publi.us-west-2.elb.amazonaws.com/frontend
prod http://my-pr-Publi.us-west-2.elb.amazonaws.com/backend
Internal Service Endpoint
Internal Service Endpoints
Endpoint Environment Type
-------- ----------- ----
Expand Down
2 changes: 1 addition & 1 deletion site/content/blogs/release-v124.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ After successfully deploying with the updated manifest, Service Connect should b
$ copilot svc show --name front-end

...
Internal Service Endpoint
Internal Service Endpoints

Endpoint Environment Type
-------- ----------- ----
Expand Down
2 changes: 1 addition & 1 deletion site/content/blogs/release-v124.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ network:
$ copilot svc show --name front-end

...
Internal Service Endpoint
Internal Service Endpoints

Endpoint Environment Type
-------- ----------- ----
Expand Down
11 changes: 8 additions & 3 deletions site/content/docs/commands/svc-logs.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@ $ copilot svc logs

## What does it do?

`copilot svc logs` displays the logs of a deployed service.
`copilot svc logs` displays the logs of a deployed service.
(Logs are not available for Static Site services.)

## What are the flags?

```
-a, --app string Name of the application.
-a, --app string Name of the application. (default "testing-buildspec")
--container string Optional. Return only logs from a specific container.
--end-time string Optional. Only return logs before a specific date (RFC3339).
Defaults to all logs. Only one of end-time / follow may be used.
-e, --env string Name of the environment.
--follow Optional. Specifies if the logs should be streamed.
-h, --help help for logs
--json Optional. Output in JSON format.
--limit int Optional. The maximum number of log events returned. (default 10)
--limit int Optional. The maximum number of log events returned. Default is 10
unless any time filtering flags are set.
--log-group string Optional. Only return logs from specific log group.
-n, --name string Name of the service.
-p, --previous Optional. Print logs for the last stopped task if exists.
--since duration Optional. Only return logs newer than a relative duration like 5s, 2m, or 3h.
Defaults to all logs. Only one of start-time / since may be used.
--start-time string Optional. Only return logs after a specific date (RFC3339).
Expand Down
4 changes: 2 additions & 2 deletions site/content/docs/commands/svc-show.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $ copilot svc show

## What does it do?

`copilot svc show` shows info about a deployed service, including endpoints, capacity and related resources per environment.
`copilot svc show` shows info about a deployed service. Depending on the service type, output may include endpoints, configuration, variables, and/or associated S3 objects per environment.

## What are the flags?

Expand All @@ -16,7 +16,7 @@ $ copilot svc show
--manifest string Optional. Name of the environment in which the service was deployed;
output the manifest file used for that deployment.
-n, --name string Name of the service.
--resources Optional. Show the resources in your service.
--resources Optional. Show the resources in your service.
```

## Examples
Expand Down
2 changes: 1 addition & 1 deletion site/content/docs/commands/svc-status.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $ copilot svc status
```

## What does it do?
`copilot svc status` shows the health status of a deployed service, including service status, task status, and related CloudWatch alarms.
`copilot svc status` shows the health status of a deployed service. Depending on the service type, output may include service, task, and associated alarm statuses; logs; or S3 bucket data.

## What are the flags?
```
Expand Down
114 changes: 89 additions & 25 deletions site/content/docs/concepts/services.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ Unlike ECS, App Runner services are not connected by default to a VPC. In order
you can configure the [`network`](../manifest/rd-web-service.en.md#network) field in the manifest.

#### Static Site
An Amazon CloudFront distribution-served, S3-hosted static website.
Caching with the [CloudFront Content Delivery Network (CDN)](../developing/content-delivery.en.md) optimizes cost and speed. Copilot uploads your static assets into a new S3 bucket configured for static website hosting.
An Amazon CloudFront distribution-served, S3-hosted static website. Copilot uploads your static assets into a new S3 bucket configured for static website hosting. Caching with the [CloudFront Content Delivery Network (CDN)](../developing/content-delivery.en.md) optimizes cost and speed. With each redeployment, the previous cache is invalidated.

#### Load Balanced Web Service
An ECS Service running tasks on Fargate with an Application Load Balancer, a Network Load Balancer or both, as ingress.
Expand Down Expand Up @@ -139,7 +138,7 @@ Now that we've got a service up and running, we can check on it using Copilot. B

### What's in your service?

Running `copilot svc show` will show you a summary of your service. Here's an example of the output you might see for a load balanced web application. This output includes the configuration of your service for each environment, all the endpoints for your service, and the environment variables passed into your service. You can also provide an optional `--resources` flag to see all AWS resources associated with your service.
Running `copilot svc show` will show you a summary of your service. Here's an example of the output you might see for a __Load Balanced Web Service__. This output includes the configuration of your service for each environment, any rollback alarms you have configured, all the endpoints for your service, and the environment variables and secrets passed into your service. You can also provide an optional `--resources` flag to see all AWS resources associated with your service.

```console
$ copilot svc show
Expand All @@ -152,26 +151,78 @@ About
Configurations

Environment Tasks CPU (vCPU) Memory (MiB) Port
----------- ----- ---------- ------------ ----
test 1 0.25 512 80

Rollback Alarms

Name Environment Description
---- ----------- -----------
my-app-test-front-end-CopilotRol test Roll back ECS service if CPU utilizat
lbackCPUAlarm ion is greater than or equal to 50% t
wice in 3 minutes.
Routes

Environment URL
----------- ---
test http://my-ap-Publi-1RV8QEBNTEQCW-1762184596.ca-central-1.elb.amazonaws.com

Service Discovery

Environment Namespace
test front-end.test.my-app.local:8080
Internal Service Endpoints

Endpoint Environment Type
-------- ----------- ----
front-end:80 test Service Connect
front-end.test.my-app.local:8080 test Service Discovery
Variables

Name Environment Value
COPILOT_APPLICATION_NAME test my-app
COPILOT_ENVIRONMENT_NAME test test
COPILOT_LB_DNS test my-ap-Publi-1RV8QEBNTEQCW-1762184596.ca-central-1.elb.amazonaws.com
COPILOT_SERVICE_DISCOVERY_ENDPOINT test test.my-app.local
COPILOT_SERVICE_NAME test front-end
Name Container Environment Value
---- --------- ----------- -----
COPILOT_APPLICATION_NAME front-end test my-app
COPILOT_ENVIRONMENT_NAME " test test
COPILOT_LB_DNS " test my-ap-Publi-1RV8QEBNTEQCW-1762184596.ca-central-1.elb.amazonaws.com
COPILOT_SERVICE_DISCOVERY_ENDPOINT " test test.my-app.local
COPILOT_SERVICE_NAME " test front-end
Secrets

Name Container Environment Value
---- --------- ----------- -----
GITHUB_WEBHOOK_SECRET front-end test parameter/GH_WEBHOOK_SECRET
```
The output of `copilot svc show` varies depending on your service type. For example, the summary for a __Static Site__ includes a tree representation of your S3 bucket's contents.
```console
% copilot svc show
Service name: static-site
About

Application my-app
Name static-site
Type Static Site

Routes

Environment URL
----------- ---
test https://d399t9j1xbplme.cloudfront.net/

S3 Bucket Objects

Environment test
.
├── ReadMe.md
├── error.html
├── index.html
├── Images
│ ├── SomeImage.PNG
│ └── AnotherImage.PNG
├── css
│ ├── Style.css
│ ├── all.min.css
│ └── bootstrap.min.css
└── images
└── bg-masthead.jpg
```

### What's your service status?
Expand All @@ -181,25 +232,36 @@ Often it's handy to be able to check on the status of your service. Are all the

```console
$ copilot svc status
Service Status

ACTIVE 1 / 1 running tasks (0 pending)

Last Deployment
Service: front-end
Task Summary

Updated At 12 minutes ago
Task Definition arn:aws:ecs:ca-central-1:693652174720:task-definition/my-app-test-front-end:1
Running ██████████ 1/1 desired tasks are running
Health ██████████ 1/1 passes HTTP health checks
██████████ 1/1 passes container health checks

Task Status
Tasks

ID Image Digest Last Status Health Status Started At Stopped At
37236ed3 da3cfcdd RUNNING HEALTHY 12 minutes ago -
ID Status Revision Started At Cont. Health HTTP Health
-- ------ -------- ---------- ------------ -----------
37236ed3 RUNNING 9 12 minutes ago HEALTHY HEALTHY

Alarms

Name Health Last Updated Reason
CPU-Utilization OK 5 minutes ago -
Name Type Condition Last Updated Health
---- ---- --------- ------------ ------
TargetTracking-service/my-app- Auto Scaling CPUUtilization > 70.00 for 3 d 5 minutes ago OK
test-Cluster-0jTKWTNBKviF/my-a atapoints within 3 minutes
pp-test-front-end-Service-r5h6
hMZVbWkz-AlarmHigh-f0f31c7b-74
61-415c-9dfd-81b983cbe0df
TargetTracking-service/my-app- Auto Scaling CPUUtilization < 63.00 for 15 5 minutes ago ALARM
test-Cluster-0jTKWTNBKviF/my-a datapoints within 15 minutes
pp-test-front-end-Service-r5h6
hMZVbWkz-AlarmLow-698f9f17-6c0
c-4db1-8f1d-e23de97f5459
```
Just like with `copilot svc show`, the output of `copilot svc status` varies with service type. For instance, a __Request-Driven Web Service__'s output includes system logs, and a __Static Site__'s output includes the S3 bucket's object count and size.

### Where are my service logs?

Expand All @@ -213,3 +275,5 @@ $ copilot svc logs
37236ed 10.0.0.30 🚑 Health-check ok!
37236ed 10.0.0.30 🚑 Health-check ok!
```
!!! info
Logs are not available for Static Site services.
2 changes: 1 addition & 1 deletion site/content/docs/developing/content-delivery.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ After getting the environment deployed using the env manifest, you need to updat
```

## How do I use CloudFront to serve a static website?
Use the [copilot init](../commands/init.en.md) or [copilot svc init](../commands/svc-init.en.md) command to create a Static Site [workload](../concepts/services.en.md). After you select files to upload, Copilot will provision a separate, dedicated CloudFront distribution, as well as an S3 bucket with your assets.
Use the [copilot init](../commands/init.en.md) or [copilot svc init](../commands/svc-init.en.md) command to create a Static Site [workload](../concepts/services.en.md). After you select files to upload, Copilot will provision a separate, dedicated CloudFront distribution, as well as an S3 bucket with your assets. With each redeployment, Copilot will invalidate the existing cache for more dynamic development.

0 comments on commit e1e5e52

Please sign in to comment.