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

Commit 71d3ef9

Browse files
docs: add GCP websites config docs and Azure TF updates (#722)
Co-authored-by: David Moore <[email protected]>
1 parent ae6e2e6 commit 71d3ef9

File tree

10 files changed

+155
-10
lines changed

10 files changed

+155
-10
lines changed

dictionary.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,10 @@ deployable
258258
VMs
259259
CDN
260260
subdirectories
261+
DNSSEC
261262
AzureTF
262263
VSCode
264+
https
263265
[0-9]+px
264266
^.+[-:_]\w+$
265267
[a-z]+([A-Z0-9]|[A-Z0-9]\w+)

docs/architecture/websites.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ async function fetchData() {
136136
**Operations** will use or extend the Nitric infrastructure modules, including both Terraform and Pulumi:
137137

138138
- Terraform Modules:
139-
- Not yet available
139+
- [Azure Website Terraform Module](https://github.com/nitrictech/nitric/blob/main/cloud/azure/deploytf/.nitric/modules/website/main.tf)
140+
- [Google Cloud Website Terraform Module](https://github.com/nitrictech/nitric/blob/main/cloud/gcp/deploytf/.nitric/modules/website/main.tf)
140141
- Pulumi Modules:
141142
- [AWS Website Pulumi Module](https://github.com/nitrictech/nitric/blob/main/cloud/aws/deploy/website.go)
142143
- [Azure Website Pulumi Module](https://github.com/nitrictech/nitric/blob/main/cloud/azure/deploy/website.go)
144+
- [Google Cloud Website Pulumi Module](https://github.com/nitrictech/nitric/blob/main/cloud/gcp/deploy/website.go)

docs/providers/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Currently, both the Pulumi and Terraform providers use the same underlying cloud
4040
| [Batch](/batch) | [AWS Batch](/providers/mappings/aws/batch) | Coming soon | [GCP Batch](/providers/mappings/gcp/batch) | Custom |
4141
| [Schedules](/schedules) | [CloudWatch Event Bridge](/providers/mappings/aws/schedules) | [Dapr Binding](/providers/mappings/azure/schedules) | [Cloud Scheduler](/providers/mappings/gcp/schedules) | Custom |
4242
| [Websockets](/websockets) | [API Gateway](/providers/mappings/aws/websockets) | Not implemented | Not implemented | Custom |
43-
| [Websites](/websites) | [AWS Cloudfront](/providers/mappings/aws/websites) | [Front Door](/providers/mappings/azure/websites) | Not implemented | Custom |
43+
| [Websites](/websites) | [AWS Cloudfront](/providers/mappings/aws/websites) | [Front Door](/providers/mappings/azure/websites) | [Cloud CDN](/providers/mappings/gcp/websites) | Custom |
4444
| [Storage](/storage#buckets) | [S3](/providers/mappings/aws/storage) | [Blob Storage](/providers/mappings/azure/storage) | [Cloud Storage](/providers/mappings/gcp/storage) | SeaweedFS |
4545
| [Key Value Stores](/keyvalue) | [DynamoDB](/providers/mappings/aws/keyvalue) | [Table Storage](/providers/mappings/azure/keyvalue) | [FireStore](/providers/mappings/gcp/keyvalue) | BoltDB |
4646
| [SQL Databases](/sql) | [RDS](/providers/mappings/aws/sql) | [Azure Database](/providers/mappings/azure/sql) | [Cloud SQL](/providers/mappings/gcp/sql) | Docker |
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
description: 'How Nitric deploys Websites to Google Cloud Platform'
3+
---
4+
5+
# Google Cloud Resources - Websites
6+
7+
Nitric Websites are deployed to Google Cloud using [Cloud Storage](https://cloud.google.com/storage), [Cloud CDN](https://cloud.google.com/cdn), [Cloud DNS](https://cloud.google.com/dns), [Cloud Load Balancing](https://cloud.google.com/load-balancing) and [Certificate Manager](https://cloud.google.com/certificate-manager).
8+
9+
## Google Cloud Resources
10+
11+
The following resources are created when deploying Websites to Google Cloud:
12+
13+
- Storage Bucket
14+
- Cloud CDN Backends
15+
- Load Balancer Target Https Proxy
16+
- DNS Zone Entries
17+
- A Certificate Manager Certificate
18+
19+
## Deployment
20+
21+
During deployment the Nitric CLI creates a storage bucket for each website, uploading each static asset as an object. Then configures a target https proxy, certificate, and CDN as described to serve those assets:
22+
23+
- A Cloud Storage Bucket, per website
24+
- Cloud CDN to cache and serve static files
25+
- A Cloud Load Balancer to route traffic to buckets and APIs, including URL rewrites
26+
- Cloud DNS to configure a domain name for the Load Balancer
27+
- Certificate Manager to issue a certificate for the Load Balancer, enabling HTTPS

docs/providers/pulumi/gcp.mdx

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,21 @@ 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+
# The following configuration values are optional
140+
# Specify the TTL the CDN sends in the Cache-Control or Expires headers to clients
141+
client-ttl: 3600
142+
# Specify the TTL for content cached by the CDN when the origin server does not provide any caching directives
143+
default-ttl: 604800
144+
# Skip CDN cache invalidation during deployments (defaults to false)
145+
skip-cache-invalidation: true
146+
132147
# Configure your deployed services
133148
config:
134149
# How services without a type will be deployed
@@ -162,6 +177,60 @@ config:
162177
concurrency: 1000
163178
```
164179
180+
### Websites
181+
182+
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).
183+
184+
The DNS Zone in Google will then allow Nitric to create DNS records that route traffic to the CDN. Here are the steps:
185+
186+
- Purchase/Register a domain name with your domain registrar of choice.
187+
- Navigate to https://console.cloud.google.com/net-services/dns/zones in your GCP Project
188+
- Click `CREATE ZONE`
189+
- Leave `Public` selected
190+
- Enter a `Zone name`, and `Description` of your choice
191+
- Enter your domain name (or subdomain) in the `DNS name` field
192+
- Optionally enable DNSSEC
193+
- Click `CREATE`
194+
195+
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.
196+
197+
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.
198+
199+
#### Domain
200+
201+
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.
202+
203+
#### Subdomain
204+
205+
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:
206+
207+
<Note>Substitute your values for `Host` and `Nameserver`</Note>
208+
209+
| Record Type | Host | Nameserver |
210+
| ----------- | ---- | ----------------------------- |
211+
| NS Record | app | ns-cloud-a1.googledomains.com |
212+
| NS Record | app | ns-cloud-a2.googledomains.com |
213+
| NS Record | app | ns-cloud-a3.googledomains.com |
214+
| NS Record | app | ns-cloud-a4.googledomains.com |
215+
216+
<Note>
217+
If you enabled DNSSEC for the zone you will also need to create the relevant
218+
DS record
219+
</Note>
220+
221+
### Stack file configuration
222+
223+
Now that you have your DNS Zone created and Nameservers configured you can add the relevant config to your GCP stack file.
224+
225+
```yaml title:nitric.[stack ID].yaml
226+
# Add to your stack file
227+
cdn:
228+
# The name of the DNS Zone you configured in Google Cloud DNS
229+
zone-name: yourzone
230+
# The domain name or subdomain you want to use for your website (any valid subdomain for the zone is permitted)
231+
domain-name: app.example.com
232+
```
233+
165234
<Note>
166235
Missing something? Let us know by raising an issue in
167236
[GitHub](https://github.com/nitrictech/nitric) or by dropping us a line on

docs/providers/terraform/azure.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@ adminemail: [email protected]
110110

111111
# Subscription ID to associate deployed services with
112112
subscription-id: example-subscription-id
113+
114+
# Add CDN configuration, required for custom domains for website deployments
115+
# Available since v1.23.0
116+
cdn:
117+
# The name of the Azure DNS Zone to use when configuring the website DNS
118+
zone-name: example.com
119+
# The resource group name of the DNS Zone you configured in Azure DNS Zones
120+
zone-resource-group: yourzone-rg
121+
# A valid domain or subdomain for the DNS Zone to use for the deployed websites endpoint
122+
domain-name: app.example.com
123+
# Skip CDN cache invalidation during deployments (defaults to false)
124+
skip-cache-invalidation: true
113125
```
114126
115127
<Note>

docs/providers/terraform/gcp.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,21 @@ gcp-project-id: my-gcp-project-id
8787
# https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
8888
schedule-timezone: Australia/Sydney
8989
90+
# Add CDN configuration, required for websites deployments
91+
# Available since v1.22.0
92+
cdn:
93+
# The name of the Google Cloud DNS Zone to use when configuring the website DNS
94+
zone-name: yourzone
95+
# A valid subdomain for the DNS Zone to use for the deployed websites endpoint
96+
domain-name: app.example.com
97+
# The following configuration values are optional
98+
# Specify the TTL the CDN sends in the Cache-Control or Expires headers to clients
99+
client-ttl: 3600
100+
# Specify the TTL for content cached by the CDN when the origin server does not provide any caching directives
101+
default-ttl: 604800
102+
# Skip CDN cache invalidation during deployments (defaults to false)
103+
skip-cache-invalidation: true
104+
90105
# Configure your deployed services
91106
config:
92107
# How services without a type will be deployed

docs/reference/preview-features/index.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ Each preview feature will have its own documentation page, which will include in
1212

1313
## Current Preview Features
1414

15-
| Features | Preview Released | Feedback Issue |
16-
| -------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
17-
| [docker-providers](/providers/custom/docker) | CLI v1.39.0 | [feedback](https://github.com/nitrictech/nitric/issues/605) |
18-
| [sql-databases](/sql) | CLI v1.42.0<br/>AWS Provider v1.6.0<br/>Azure Provider v1.9.0<br/>AWS Terraform Provider v1.8.0 | [feedback](https://github.com/nitrictech/nitric/issues/684) |
19-
| [batch-services](/batch) | CLI v1.54.0<br/>AWS Provider v1.14.0<br/>GCP Provider v1.14.0 | [feedback](https://github.com/nitrictech/nitric/issues/685) |
20-
| [websites](/websites) | CLI v1.58.0<br/>AWS Provider v1.18.0<br/>Azure Provider v1.19.4 | [feedback](https://github.com/nitrictech/nitric/issues/748) |
15+
| Features | Preview Released | Feedback Issue |
16+
| -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
17+
| [docker-providers](/providers/custom/docker) | CLI v1.39.0 | [feedback](https://github.com/nitrictech/nitric/issues/605) |
18+
| [sql-databases](/sql) | CLI v1.42.0<br/>AWS Provider v1.6.0<br/>Azure Provider v1.9.0<br/>AWS Terraform Provider v1.8.0 | [feedback](https://github.com/nitrictech/nitric/issues/684) |
19+
| [batch-services](/batch) | CLI v1.54.0<br/>AWS Provider v1.14.0<br/>GCP Provider v1.14.0 | [feedback](https://github.com/nitrictech/nitric/issues/685) |
20+
| [websites](/websites) | CLI v1.58.0<br/>AWS Provider v1.18.0<br/>Azure Provider v1.19.4<br/>GCP Provider v1.20.0<br/>Azure Terraform Provider v1.23.0<br/>GCP Terraform Provider v1.22.0 | [feedback](https://github.com/nitrictech/nitric/issues/748) |
2121

2222
## Released Preview Features
2323

docs/websites.mdx

Lines changed: 16 additions & 2 deletions
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.
@@ -192,12 +198,20 @@ websites:
192198
url: http://localhost:4322
193199
```
194200
201+
## Custom Domains
202+
203+
You can configure a custom domain for your website by following the instructions in the cloud provider documentation:
204+
205+
- [AWS](/providers/pulumi/aws#websites)
206+
- [Azure](/providers/pulumi/azure#websites)
207+
- [Google Cloud](/providers/pulumi/gcp#websites)
208+
195209
## Cloud Service Mapping
196210
197211
Each cloud provider comes with a set of default services used when deploying resources. You can find the default services for each cloud provider below.
198212
199213
- [AWS](/providers/mappings/aws/websites)
200214
- [Azure](/providers/mappings/azure/websites)
201-
- Google Cloud - Not implemented
215+
- [Google Cloud](/providers/mappings/gcp/websites)
202216
203217
If you need support for additional clouds or website types, let us know by [opening an issue](https://github.com/nitrictech/nitric/issues) or joining the conversation on [Discord](https://nitric.io/chat).

src/config/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,10 @@ export const navigation: NavEntry[] = [
382382
title: 'Schedules',
383383
href: '/providers/mappings/gcp/schedules',
384384
},
385+
{
386+
title: 'Websites',
387+
href: '/providers/mappings/gcp/websites',
388+
},
385389
{
386390
title: 'Storage',
387391
href: '/providers/mappings/gcp/storage',

0 commit comments

Comments
 (0)