You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 20, 2025. It is now read-only.
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
Copy file name to clipboardExpand all lines: docs/providers/pulumi/gcp.mdx
+69Lines changed: 69 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,6 +129,21 @@ apis:
129
129
# provide domains to be used for the api
130
130
description: An Azure API
131
131
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
+
132
147
# Configure your deployed services
133
148
config:
134
149
# How services without a type will be deployed
@@ -162,6 +177,60 @@ config:
162
177
concurrency: 1000
163
178
```
164
179
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>
- Serve your entire Nitric application from a single domain.
@@ -192,12 +198,20 @@ websites:
192
198
url: http://localhost:4322
193
199
```
194
200
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
+
195
209
## Cloud Service Mapping
196
210
197
211
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.
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).
0 commit comments