diff --git a/docs/providers/gcp.md b/docs/providers/gcp.md index 2a9de67ac..19ba5d48d 100644 --- a/docs/providers/gcp.md +++ b/docs/providers/gcp.md @@ -4,10 +4,64 @@ description: Defang will allow you to easily create and manage full, scalable ap sidebar_position: 3000 --- -# GCP +# Google Cloud Platform (GCP) :::info -Google Cloud Platform (GCP) support is coming soon to Defang. Stay tuned for updates! +The Defang GCP provider is available for Public Preview as of December 2024. ::: -This page will be updated soon. In the meantime, you can learn more about other cloud [providers](/docs/category/providers/). \ No newline at end of file +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! + +## Getting Started + +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`. + +```bash +export GCP_PROJECT_ID= +``` + +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: + +```bash +gcloud init +gcloud auth application-default login +``` + +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. + +```bash +$ defang up --provider=gcp +# or +$ DEFANG_PROVIDER=gcp defang up +``` + +## Location + +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. + +## Architecture + +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. + +### Deployment + +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. + +### Runtime + +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. + +### Secrets + +The GCP provider does not currently support storing sensitive config values. + +### Future Improvements + +The following features are in active development for GCP: +- [Configuration and management of secrets](/docs/concepts//configuration.md) +- [Networking and Load Balancing](/docs/concepts//networking.mdx) +- [Custom Domains](/docs/concepts//domains.mdx) +- [Managed Redis](/docs/concepts//managed-storage/managed-redis.md) +- [Managed Postgres](/docs/concepts/managed-storage/managed-postgres.md) + +Stayed tuned for future updates! diff --git a/docs/tutorials/deploy-to-gcp.mdx b/docs/tutorials/deploy-to-gcp.mdx index f57c4159a..d61023b76 100644 --- a/docs/tutorials/deploy-to-gcp.mdx +++ b/docs/tutorials/deploy-to-gcp.mdx @@ -6,9 +6,39 @@ sidebar_position: 11 # Deploying to Google Cloud Platform (GCP) With Defang -This tutorial is coming soon. +This tutorial will show you how to deploy your services to your own GCP project using Defang. ---- +## Pre-requisites +* [A Dockerfile in your project](https://docs.docker.com/get-started/docker-concepts/building-images/writing-a-dockerfile/) +* [A `compose.yaml` file in your project](https://docs.docker.com/compose/gettingstarted/) +* [A Defang Account](/docs/concepts/authentication) +* [The Defang CLI](/docs/getting-started#install-the-defang-cli) +* [GCP Account Credentials](https://cloud.google.com/docs/authentication) -For a deeper discussion of the Defang GCP Architecture, see our [GCP docs](/docs/providers/gcp). +## Step 1 - Navigate to your project directory +Head to the folder where your project is located. +```bash +$ cd path/to/your/project +``` + +## Step 2 - Authenticate Defang to use your GCP Account + +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`. + +## Step 3 - Deploy + +Invoke the `defang up` CLI command with the `--provider=gcp` flag or set the `DEFANG_PROVIDER=gcp` environment variable. +For example: + +```bash +$ defang up --provider=gcp +``` + +## Step 4 - Inspect your deployment + +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/). + +*** + +For a deeper discussion of the Defang GCP Architecture, see our [GCP docs](/docs/providers/gcp).