Skip to content

Commit 43cc1ec

Browse files
carmenlaugitbook-bot
authored andcommitted
GitBook: [master] 3 pages modified
1 parent f590bf4 commit 43cc1ec

File tree

3 files changed

+96
-2
lines changed

3 files changed

+96
-2
lines changed

Diff for: SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* [How to call API of a deployed service on Skygear](how-to/how-to-call-service-apis-at-the-frontend.md)
1919
* [How to upload templates to Skygear](how-to/how-to-upload-templates-to-skygear.md)
2020
* [How to view the logs of microservices](how-to/how-to-view-the-logs-of-microservices.md)
21+
* [How to setup a custom domain](how-to/how-to-setup-a-custom-domain.md)
2122

2223
## Auth
2324

Diff for: how-to/how-to-setup-a-custom-domain.md

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# How to setup a custom domain
2+
3+
## Introduction
4+
5+
Skygear provides default suffixed domain `.skygearapp.com` for you to access your application. You can update your application to use a custom domain which owned by you instead of the skygear generated domain.
6+
7+
## Prerequisites
8+
9+
To setup custom domain, you need to install and configure `skycli` properly. Please follow [this guide](../set-up/set-up-steps.md) to setup skycli.
10+
11+
## Setup custom domain
12+
13+
### 1. Add custom domain
14+
15+
```bash
16+
$ skycli domain add <your_domain>
17+
18+
#example
19+
$ skycli domain add www.example.com --app=myapp
20+
```
21+
22+
### 2. Verify domain ownership
23+
24+
#### Add DNS records in your DNS provider
25+
26+
After adding the custom domain, please follow the instructions shown in the console and add dns records in your dns provider.
27+
28+
```bash
29+
#exmaple
30+
$ skycli domain add www.example.com --app=myapp
31+
Added domain www.example.com successfully!
32+
33+
Add following DNS records in your DNS provider.
34+
35+
TYPE HOST VALUE
36+
TXT _skygear.example.com <txt_record_value>
37+
A www.example.com <a_record_value>
38+
39+
After updating DNS records, run `skycli domain verify www.example.com` to verify domain.
40+
```
41+
42+
#### Ask Skygear Cluster to verify the domain
43+
44+
```bash
45+
$ skycli domain verify <your_domain>
46+
47+
#example
48+
$ skycli domain verify www.example.com --app=myapp
49+
Success! You can now access your app through www.example.com.
50+
Your site may show a security certificate warning until the certificate has been provisioned.
51+
```
52+
53+
After verifying the domain successfully, you can now access your application with the new domain.
54+
55+
### 3. \(Optional\) Setup custom certificate
56+
57+
Skygear Cluster by default provisions SSL certificate signed by [Let's Encrypt](https://letsencrypt.org/). If you want to use your own certificate, you can update it with `skycli domain update` command.
58+
59+
```bash
60+
# Create tls secret
61+
$ skycli secret create <your_tls_secret_name> --type=tls --cert=<path/to/tls-cert.pem> --key=<path/to/tls-key.pem>
62+
# Update domain to use tls secret
63+
$ skycli domain update <your_domain> --tls-secret=<your_tls_secret_name>
64+
65+
66+
#example
67+
$ skycli secret create myapp-tls --type=tls --cert=path/to/tls-cert.pem --key=path/to/tls-key.pem --app=myapp
68+
Success! Created secret myapp-tls
69+
70+
$ skycli domain update example.com --tls-secret=myapp-tls --app=myapp
71+
Success! Updated domain example.com
72+
73+
$ skycli domain list --app=myapp
74+
DOMAIN VERIFIED CUSTOM_CERT REDIRECT SSL_CERT_EXPIRY CREATED_AT
75+
example.com true true - 2020-11-26 20:00:00 +08:00 2020-01-01 18:00:00 +08:00
76+
```
77+
78+
### 4. \(Optional\) Setup redirect
79+
80+
For some case, you may want to redirect all requests of a custom domain to another specific domain \(e.g. Redirect `example.com` to `www.example.com`\).
81+
82+
```bash
83+
$ skycli domain update example.com --redirect-domain=www.example.com
84+
Success! Updated domain example.com
85+
86+
$ skycli domain list --app=myapp
87+
DOMAIN VERIFIED CUSTOM_CERT REDIRECT SSL_CERT_EXPIRY CREATED_AT
88+
www.example.com true false - - 2019-11-26 18:00:00 +08:00
89+
example.com true false www.example.com - 2019-11-26 18:00:00 +08:00
90+
```
91+
92+
93+

Diff for: skycli/deployment-configuration/routing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ For example, in the following configuration:
1010

1111
```yaml
1212
deployments:
13-
backend:
13+
- name: backend
1414
path: /api
1515
port: 8080
1616
# ...
17-
frontend:
17+
- name: frontend
1818
path: /
1919
port: 8080
2020
# ...

0 commit comments

Comments
 (0)