This repository allows you to automatically set up Google Cloud resources using Terraform and deploy Dify in a highly available configuration.
- Serverless hosting
- Auto-scaling
- Data persistence
- Google Cloud account
- Terraform installed
- gcloud CLI installed
- Set environment-specific values in the
terraform/environments/dev/terraform.tfvars
file. - Create a GCS bucket to manage Terraform state in advance, and replace "your-tfstate-bucket" in the
terraform/environments/dev/provider.tf
file with the name of the created bucket.
-
Clone the repository:
git clone https://github.com/DeNA/dify-google-cloud-terraform.git
-
Initialize Terraform:
cd terraform/environments/dev terraform init
-
Make Artifact Registry repository:
terraform apply -target=module.registry
-
Build & push container images:
cd ../../.. sh ./docker/cloudbuild.sh <your-project-id> <your-region>
You can also specify a version of the dify-api image.
sh ./docker/cloudbuild.sh <your-project-id> <your-region> <dify-api-version>
If no version is specified, the latest version is used by default.
-
Terraform plan:
cd terraform/environments/dev terraform plan
-
Terraform apply:
terraform apply
terraform destroy
Note: Cloud Storage, Cloud SQL, VPC, and VPC Peering cannot be deleted with the terraform destroy
command. These are critical resources for data persistence. Access the console and carefully delete them. After that, use the terraform destroy
command to ensure all resources have been deleted.
This software is licensed under the MIT License. See the LICENSE file for more details.