Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit b4e2267

Browse files
committed
docs(gcp): add GCP websites config docs
1 parent 976bbaa commit b4e2267

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

docs/providers/pulumi/gcp.mdx

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,14 @@ apis:
129129
# provide domains to be used for the api
130130
description: An Azure API
131131
132+
# Add CDN configuration, required for websites deployments
133+
# Available since v1.20.0
134+
cdn:
135+
# The name of the Google Cloud DNS Zone to use when configuring the website DNS
136+
zone-name: yourzone
137+
# A valid subdomain for the DNS Zone to use for the deployed websites endpoint
138+
domain-name: app.example.com
139+
132140
# Configure your deployed services
133141
config:
134142
# How services without a type will be deployed
@@ -162,6 +170,60 @@ config:
162170
concurrency: 1000
163171
```
164172
173+
### Websites
174+
175+
When deploying [websites](/websites), Google Cloud CDN doesn't automatically provide DNS names for deployed sites, so a DNS name must be provided. To do this you'll need to register a new domain name (or use one you already own), then configure the domain (or a subdomain) so that it uses the Google Name Servers (using a Google Cloud DNS Zone).
176+
177+
The DNS Zone in Google will then allow Nitric to create DNS records that route traffic to the CDN. Here are the steps:
178+
179+
- Purchase/Register a domain name with your domain registrar of choice.
180+
- Navigate to https://console.cloud.google.com/net-services/dns/zones in your GCP Project
181+
- Click `CREATE ZONE`
182+
- Leave `Public` selected
183+
- Enter a `Zone name`, and `Description` of your choice
184+
- Enter your domain name (or subdomain) in the `DNS name` field
185+
- Optionally enable DNSSEC
186+
- Click `CREATE`
187+
188+
Now that the DNS Zone is created, you need to configure your registrar (domain) or existing DNS (subdomain) to point at the new name servers created for the zone.
189+
190+
The configuration detail are available on the `Zone details` page by clicking `REGISTRAR SETUP`. This step is different depending on your chosen domain registrar. Below are some general steps depending on whether your configuring the primary domain or a subdomain.
191+
192+
#### Domain
193+
194+
Your registrar (e.g. Namecheap, GoDaddy, Cloudflare, etc.) will allow you to change the name servers for you domain, sometimes this is called 'Custom DNS'. Add each of the name servers (NS records) from the Registrar setup dialog in the relevant config page for your registrar.
195+
196+
#### Subdomain
197+
198+
If you're configuring a subdomain e.g. app.yourdomain.com, you can simply add the NS records to your existing DNS configuration for the chosen subdomain. Typically, the config will look something like this:
199+
200+
<Note>Substitute your values for `Host` and `Nameserver`</Note>
201+
202+
| Record Type | Host | Nameserver |
203+
| ----------- | ---- | ----------------------------- |
204+
| NS Record | app | ns-cloud-a1.googledomains.com |
205+
| NS Record | app | ns-cloud-a2.googledomains.com |
206+
| NS Record | app | ns-cloud-a3.googledomains.com |
207+
| NS Record | app | ns-cloud-a4.googledomains.com |
208+
209+
<Note>
210+
If you enabled DNSSEC for the zone you will also need to create the relevant
211+
DS record
212+
</Note>
213+
214+
### Stack file configuration
215+
216+
Now that you have your DNS Zone created and Nameservers configured you can add the relevant config to your GCP stack file.
217+
218+
```yaml title:nitric.[stack ID].yaml
219+
# Add to your stack file
220+
cdn:
221+
# The name of the DNS Zone you configured in Google Cloud DNS
222+
zone-name: yourzone
223+
# The domain name or subdomain you want to use for your website (any valid subdomain for the zone is permitted)
224+
domain-name: app.example.com
225+
```
226+
165227
<Note>
166228
Missing something? Let us know by raising an issue in
167229
[GitHub](https://github.com/nitrictech/nitric) or by dropping us a line on

docs/websites.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ If you're interested in the architecture, provisioning, or deployment steps, the
1414
https://github.com/nitrictech/nitric/issues
1515
</Note>
1616

17+
<Note>
18+
When deploying website with the `nitric/gcp` provider a custom domain and DNS
19+
zone will be required. See the [`nitric/gcp`
20+
docs](/providers/pulumi/gcp#websites) for details.
21+
</Note>
22+
1723
## Overview
1824

19-
Nitrics website resource lets you:
25+
Nitric's website resource lets you:
2026

2127
- Serve static files (HTML, JS, CSS, images) from cloud storage.
2228
- Serve your entire Nitric application from a single domain.

0 commit comments

Comments
 (0)