Skip to content

Commit 0f06fa5

Browse files
authored
Merge pull request #127 from DefangLabs/edw/gcp
Add GCP documentation
2 parents 87b3074 + a5b3927 commit 0f06fa5

File tree

2 files changed

+90
-6
lines changed

2 files changed

+90
-6
lines changed

docs/providers/gcp.md

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,64 @@ description: Defang will allow you to easily create and manage full, scalable ap
44
sidebar_position: 3000
55
---
66

7-
# GCP
7+
# Google Cloud Platform (GCP)
88

99
:::info
10-
Google Cloud Platform (GCP) support is coming soon to Defang. Stay tuned for updates!
10+
The Defang GCP provider is available for Public Preview as of December 2024.
1111
:::
1212

13-
This page will be updated soon. In the meantime, you can learn more about other cloud [providers](/docs/category/providers/).
13+
Defang enables you to effortlessly develop and deploy full, scalable applications with GCP. It is designed to simplify deploying your services to the cloud. As one of the leading cloud providers globally, GCP offers powerful tools and resources, and with Defang, you can bypass the complexities of the GCP platform. Let Defang handle the heavy lifting so you can focus on what matters most to you!
14+
15+
## Getting Started
16+
17+
After signing in to your GCP account, select an existing project or [create a new project](https://developers.google.com/workspace/guides/create-project), make sure [billing is enabled](https://cloud.google.com/billing/docs/how-to/modify-project), and note down the project ID and set it as environment variable `GCP_PROJECT_ID`.
18+
19+
```bash
20+
export GCP_PROJECT_ID=<your-project-id>
21+
```
22+
23+
Next step is to [authenticate your local environment with GCP](https://cloud.google.com/docs/authentication). Our preferred method is to setup [Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc) with the Google Cloud CLI. Once the [Google Cloud CLI is installed](https://cloud.google.com/sdk/docs/install), run the following command to authenticate:
24+
25+
```bash
26+
gcloud init
27+
gcloud auth application-default login
28+
```
29+
30+
The Defang CLI will automatically check if `GCP_PROJECT_ID` environment variable is set and correctly authenticated with GCP before running. Once you are ready to go, add the `--provider=gcp` to your command to tell the Defang CLI to use the GCP provider.
31+
32+
```bash
33+
$ defang up --provider=gcp
34+
# or
35+
$ DEFANG_PROVIDER=gcp defang up
36+
```
37+
38+
## Location
39+
40+
The Defang BYOC GCP Provider will use the location specified in the `GCP_LOCATION` environment variable. For a list of locations available in GCP, see the [location documentation](https://cloud.google.com/about/locations). If the `GCP_LOCATION` environment variable is not set, the default location `us-central1` (Iowa) will be used.
41+
42+
## Architecture
43+
44+
Defang uses GCP cloud run to build, deploy, and run your services. The following describes the current state of Defang's support for GCP, the specific resources that Defang uses, and the roadmap for future support.
45+
46+
### Deployment
47+
48+
To deploy your services, the Defang CLI sets up some basic resources needed, including enabling required APIs in the project, creating service accounts used to build and deploy your service with the required permissions, and creating a [Google Cloud Storage](https://cloud.google.com/storage) bucket where the Defang CLI uploads your source code to. The CLI then deploys a GCP Cloud Run Job that uses Pulumi to build your container image and run your services.
49+
50+
### Runtime
51+
52+
The Provider builds and deploys your services using [Google Cloud Run](https://cloud.google.com/run) jobs, and runs your workloads using the [Google Cloud Run](https://cloud.google.com/run) service.
53+
54+
### Secrets
55+
56+
The GCP provider does not currently support storing sensitive config values.
57+
58+
### Future Improvements
59+
60+
The following features are in active development for GCP:
61+
- [Configuration and management of secrets](/docs/concepts//configuration.md)
62+
- [Networking and Load Balancing](/docs/concepts//networking.mdx)
63+
- [Custom Domains](/docs/concepts//domains.mdx)
64+
- [Managed Redis](/docs/concepts//managed-storage/managed-redis.md)
65+
- [Managed Postgres](/docs/concepts/managed-storage/managed-postgres.md)
66+
67+
Stayed tuned for future updates!

docs/tutorials/deploy-to-gcp.mdx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,39 @@ sidebar_position: 11
66

77
# Deploy to Google Cloud Platform (GCP)
88

9-
This tutorial is coming soon.
9+
This tutorial will show you how to deploy your services to your own GCP project using Defang.
1010

11-
---
11+
## Pre-requisites
12+
* [A Dockerfile in your project](https://docs.docker.com/get-started/docker-concepts/building-images/writing-a-dockerfile/)
13+
* [A `compose.yaml` file in your project](https://docs.docker.com/compose/gettingstarted/)
14+
* [A Defang Account](/docs/concepts/authentication)
15+
* [The Defang CLI](/docs/getting-started#install-the-defang-cli)
16+
* [GCP Account Credentials](https://cloud.google.com/docs/authentication)
1217

13-
For a deeper discussion of the Defang GCP Architecture, see our [GCP docs](/docs/providers/gcp).
18+
## Step 1 - Navigate to your project directory
19+
Head to the folder where your project is located.
20+
```bash
21+
$ cd path/to/your/project
22+
```
23+
24+
## Step 2 - Authenticate Defang to use your GCP Account
25+
26+
After signing in to your GCP account, select an existing project or [create a new project](https://developers.google.com/workspace/guides/create-project). Make sure [billing is enabled](https://cloud.google.com/billing/docs/how-to/modify-project). Then, note down the project ID and set it as environment variable `GCP_PROJECT_ID`.
27+
28+
## Step 3 - Deploy
29+
30+
Invoke the `defang up` CLI command with the `--provider=gcp` flag or set the `DEFANG_PROVIDER=gcp` environment variable.
1431

32+
For example:
33+
34+
```bash
35+
$ defang up --provider=gcp
36+
```
37+
38+
## Step 4 - Inspect your deployment
39+
40+
Defang will provision resources in your GCP account and deploy your services. You can inspect the resources created in your [GCP Dashboard](https://console.cloud.google.com/).
41+
42+
***
43+
44+
For a deeper discussion of the Defang GCP Architecture, see our [GCP docs](/docs/providers/gcp).

0 commit comments

Comments
 (0)