Skip to content

Commit 82df36a

Browse files
authored
chore: add docs and e2e for alias (#2379)
<!-- Provide summary of changes --> Part of #1188. <!-- Issue number, if available. E.g. "Fixes #31", "Addresses #42, 77" --> By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 38721e9 commit 82df36a

File tree

14 files changed

+78
-18
lines changed

14 files changed

+78
-18
lines changed

e2e/app-with-domain/app_with_domain_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
var _ = Describe("App With Domain", func() {
1717
const domainName = "copilot-e2e-tests.ecs.aws.dev"
18-
const svcName = "nginx"
18+
const svcName = "hello"
1919
const envName = "test"
2020

2121
Context("when creating a new app", func() {
@@ -70,10 +70,10 @@ var _ = Describe("App With Domain", func() {
7070

7171
BeforeAll(func() {
7272
_, svcInitErr = cli.SvcInit(&client.SvcInitRequest{
73-
Name: svcName,
74-
SvcType: "Load Balanced Web Service",
75-
Image: "nginx",
76-
SvcPort: "80",
73+
Name: svcName,
74+
SvcType: "Load Balanced Web Service",
75+
Dockerfile: "./hello/Dockerfile",
76+
SvcPort: "80",
7777
})
7878
})
7979

@@ -107,7 +107,7 @@ var _ = Describe("App With Domain", func() {
107107
// Validate route has the expected HTTPS endpoint.
108108
route := svc.Routes[0]
109109
Expect(route.Environment).To(Equal(envName))
110-
Expect(route.URL).To(Equal(fmt.Sprintf("https://%s.%s.%s.%s", svcName, envName, appName, domainName)))
110+
Expect(route.URL).To(Equal(fmt.Sprintf("https://%s", domainName)))
111111

112112
// Make sure the response is OK.
113113
// Since the www app was added second, it should have app appended to the name.
@@ -118,7 +118,7 @@ var _ = Describe("App With Domain", func() {
118118
return resp.StatusCode, fetchErr
119119
}, "60s", "1s").Should(Equal(200))
120120
Eventually(func() (int, error) {
121-
httpRoute := fmt.Sprintf("http://%s.%s.%s.%s", svcName, envName, appName, domainName)
121+
httpRoute := fmt.Sprintf("http://%s", domainName)
122122
resp, fetchErr = http.Get(httpRoute)
123123
return resp.StatusCode, fetchErr
124124
}, "60s", "1s").Should(Equal(200))
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# We're creating the manifest ahead of time as we want to test the service with a count > 1.
2+
name: hello
3+
type: Load Balanced Web Service
4+
image:
5+
build:
6+
dockerfile: hello/Dockerfile
7+
context: hello
8+
port: 80
9+
10+
http:
11+
path: '/'
12+
alias: copilot-e2e-tests.ecs.aws.dev
13+
14+
cpu: 256
15+
memory: 512
16+
count: 1

e2e/app-with-domain/hello/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM nginx
2+
EXPOSE 80
3+
COPY index.html /usr/share/nginx/html

e2e/app-with-domain/hello/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hello

mkdocs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ nav:
4242
- Scheduled Job: docs/manifest/scheduled-job.en.md
4343
- Pipeline: docs/manifest/pipeline.en.md
4444
- Developing:
45+
- Domain: docs/developing/domain.en.md
4546
- Environment Variables: docs/developing/environment-variables.en.md
4647
- Custom Environment Resources: docs/developing/custom-environment-resources.en.md
4748
- Secrets: docs/developing/secrets.en.md
@@ -167,8 +168,8 @@ plugins:
167168
- search
168169
- redirects:
169170
redirect_maps:
170-
'docs/installing.md': 'docs/getting-started/install.md'
171-
'docs/getting-started.md': 'docs/getting-started/first-app-tutorial.md'
171+
'docs/installing.md': 'docs/getting-started/install.en.md'
172+
'docs/getting-started.md': 'docs/getting-started/first-app-tutorial.en.md'
172173
- i18n:
173174
default_language: en
174175
languages:

site/content/community/get-involved.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Welcome to the AWS Copilot Community ❤️
22

3-
This is a place to share your [[applications, articles, videos](https://aws.github.io/copilot-cli/community/guides/)] and any other resources related to the AWS Copilot CLI 👩‍✈️.
3+
This is a place to share your [[applications, articles, videos](../community/guides.en.md)] and any other resources related to the AWS Copilot CLI 👩‍✈️.
44

55
You can get involved with the CLI by:
66

site/content/community/get-involved.ja.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AWS Copilot コミュニティへようこそ ❤️
22

3-
[[アプリケーション、ブログ記事、動画](https://aws.github.io/copilot-cli/community/guides/)] のような AWS Copilot CLI に関連するリソースを皆で共有しましょう👩‍✈️
3+
[[アプリケーション、ブログ記事、動画](../community/guides.ja.md)] のような AWS Copilot CLI に関連するリソースを皆で共有しましょう👩‍✈️
44

55
コミュニティへの参加方法は他にもあります!
66

site/content/docs/commands/secret-init.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ $ copilot secret init --cli-input-yaml input.yml
4444
## What's next?
4545

4646
Copilot will create SSM parameters named `/copilot/<app name>/<env name>/secrets/<secret name>`.
47-
Using the parameter names, you can then modify the `secrets` section in your [service's](https://aws.github.io/copilot-cli/docs/manifest/backend-service/#secrets) or [job's](https://aws.github.io/copilot-cli/docs/manifest/scheduled-job/#secrets) manifest to reference the secrets that were created.
47+
Using the parameter names, you can then modify the `secrets` section in your [service's](../manifest/backend-service.en.md#secrets) or [job's](../manifest/scheduled-job.en.md#secrets) manifest to reference the secrets that were created.
4848

4949
For example, suppose you have an application `my-app`, and you've created a secret `db_host` in your `prod` and `dev` environments.
5050
You can modify your service's manifest as follows:

site/content/docs/commands/secret-init.ja.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ $ copilot secret init --cli-input-yaml input.yml
4444
## 作成したシークレットをアプリケーションから参照する
4545

4646
Copilot は `/copilot/<app name>/<env name>/secrets/<secret name>` という名前の SSM パラメータを作成します。
47-
[Service](https://aws.github.io/copilot-cli/ja/docs/manifest/backend-service/#secrets) あるいは [Job](https://aws.github.io/copilot-cli/ja/docs/manifest/scheduled-job/#secrets) Manifest の `secrets` セクションでこのパラメータ名を指定することでこのシークレットをアプリケーションから参照できます。
47+
[Service](../manifest/backend-service.ja.md#secrets) あるいは [Job](../manifest/scheduled-job.ja.md#secrets) Manifest の `secrets` セクションでこのパラメータ名を指定することでこのシークレットをアプリケーションから参照できます。
4848

4949
例えば、`my-app` という Application があり、その `prod``dev` Environment に `db_host` というシークレットを作ったとすると、Service の Manifest は以下のようになるでしょう。
5050
```yaml
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Domain
2+
3+
As mentioned in the [Application Guide](../concepts/applications.en.md#additional-app-configurations), you can configure the domain name of your app when running `copilot app init`. After deploying your [Load Balanced Web Services](../concepts/services.en.md#load-balanced-web-service), you should be able to access them publicly via
4+
5+
```
6+
${SvcName}.${EnvName}.${AppName}.${DomainName}
7+
```
8+
9+
For example:
10+
11+
```
12+
https:kudo.test.coolapp.example.aws
13+
```
14+
15+
## How do I configure an alias for my service?
16+
If you don't like the default domain name Copilot assigns to your service, setting an [alias](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-choosing-alias-non-alias.html) for your service is also very easy. You can add it directly to your [manifest's](../manifest/overview.en.md) `alias` section. The following snippet will set an alias to your service.
17+
18+
``` yaml
19+
# in copilot/{service name}/manifest.yml
20+
http:
21+
path: '/'
22+
alias: example.aws
23+
```
24+
25+
!!!info
26+
Currently, you can only use aliases under the domain you specified when creating the application. We'll make this feature more powerful in the future by allowing you to import certificates and use any aliases!
27+
28+
## What happens under the hood?
29+
Under the hood, Copilot
30+
31+
* creates a hosted zone in your app account for the new app subdomain `${AppName}.${DomainName}`
32+
* creates another hosted zone in your env account for the new env subdomain `${EnvName}.${AppName}.${DomainName}`
33+
* creates and validates an ACM certificate for the env subdomain
34+
* associates the certificate with your HTTPS listener and redirects HTTP traffic to HTTPS
35+
* creates an optional A record for your alias

0 commit comments

Comments
 (0)