dify-google-cloud-terraform

dify-google-cloud-terraform

Terraform configuration for deploying Dify on Google Cloud with scalability, high availability, and production-level readiness.

Stars: 72

Visit
 screenshot

This repository provides Terraform configurations to automatically set up Google Cloud resources and deploy Dify in a highly available configuration. It includes features such as serverless hosting, auto-scaling, and data persistence. Users need a Google Cloud account, Terraform, and gcloud CLI installed to use this tool. The configuration involves setting environment-specific values and creating a GCS bucket for managing Terraform state. The tool allows users to initialize Terraform, create Artifact Registry repository, build and push container images, plan and apply Terraform changes, and cleanup resources when needed.

README:

Terraform for Dify on Google Cloud

Google Cloud Terraform

Dify GCP Architecture

日本語のREADME

[!WARNING] Current version v0.2.2 has storage issues of plugin daemon container. Please wait while we work on the fixes.

[!NOTE] Dify v1.0.0 (and later) is supported now! Try it and give us feedbacks!!

Overview

This repository allows you to automatically set up Google Cloud resources using Terraform and deploy Dify in a highly available configuration.

Features

  • Serverless hosting
  • Auto-scaling
  • Data persistence

Prerequisites

  • Google Cloud account
  • Terraform installed
  • gcloud CLI installed

Configuration

  • 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.

Getting Started

  1. Clone the repository:

    git clone https://github.com/DeNA/dify-google-cloud-terraform.git
  2. Initialize Terraform:

    cd terraform/environments/dev
    terraform init
  3. Make Artifact Registry repository:

    terraform apply -target=module.registry
  4. 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.

  5. Terraform plan:

    cd terraform/environments/dev
    terraform plan
  6. Terraform apply:

    terraform apply

Cleanup

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.

References

License

This software is licensed under the MIT License. See the LICENSE file for more details.

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for dify-google-cloud-terraform

Similar Open Source Tools

For similar tasks

For similar jobs