GCP
Learn how to deploy Flowise on GCP
Prerrequisitos
Instala Google Cloud CLI
Instala kubectl
Configuración de GCP
Crea un nuevo proyecto en GCP
Habilita las siguientes APIs:
Kubernetes Engine API
Container Registry API
Crea un cluster de Kubernetes en GKE
Configura kubectl para usar el cluster de GKE:
gcloud container clusters get-credentials [ClusterName] --zone [DataCenter] --project [ProjectId]Verifica que kubectl esté usando el contexto correcto:
kubectl config use-context gke_[ProjectId]_[DataCenter]_[ClusterName]Build y Push de la Imagen Docker
Ejecuta los siguientes comandos para hacer build y push de la imagen Docker al Container Registry de GCP.
Clona Flowise
git clone https://github.com/FlowiseAI/Flowise.gitHaz build de Flowise
cd Flowise
pnpm install
pnpm buildActualiza el archivo
Dockerfileun poco.
Especifica la plataforma de nodejs
FROM --platform=linux/amd64 node:18-alpineAgrega python3, make y g++ a la instalación
RUN apk add --no-cache python3 make g++
Haz build como imagen Docker, asegúrate de que la app de Docker desktop esté corriendo
docker build -t gcr.io/[ProjectId]/flowise:dev .Haz push de la imagen Docker al container registry de GCP.
docker push gcr.io/[ProjectId]/flowise:devDeployment en GCP
Crea una carpeta raíz
yamlsen el proyecto.Agrega el archivo
deployment.yamlen esa carpeta.
# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: flowise
labels:
app: flowise
spec:
selector:
matchLabels:
app: flowise
replicas: 1
template:
metadata:
labels:
app: flowise
spec:
containers:
- name: flowise
image: gcr.io/[ProjectID]/flowise:dev
imagePullPolicy: Always
resources:
requests:
cpu: "1"
memory: "1Gi"Agrega el archivo
service.yamlen esa carpeta.
# service.yaml
apiVersion: "v1"
kind: "Service"
metadata:
name: "flowise-service"
namespace: "default"
labels:
app: "flowise"
spec:
ports:
- protocol: "TCP"
port: 80
targetPort: 3000
selector:
app: "flowise"
type: "LoadBalancer"Se verá como abajo.

Haz deploy de los archivos yaml ejecutando los siguientes comandos.
kubectl apply -f yamls/deployment.yaml
kubectl apply -f yamls/service.yamlVe a
Workloadsen GCP, podrás ver que tu pod está corriendo.

Ve a
Services & Ingress, podrás hacer clic enEndpointdonde se hospeda Flowise.

Congratulations!
You have successfully hosted the Flowise apps on GCP 🥳
Timeout
By default, there is a 30 seconds timeout assigned to the proxy by GCP. This caused issue when the response is taking longer than 30 seconds threshold to return. In order to fix this issue, make the following changes to YAML files:
Note: To set the timeout to be 10 minutes (for example) -- we specify 600 seconds below.
Create a
backendconfig.yamlfile with the following content:
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: flowise-backendconfig
namespace: your-namespace
spec:
timeoutSec: 600Issue:
kubectl apply -f backendconfig.yamlUpdate your
service.yamlfile with the following reference to theBackendConfig:
apiVersion: v1
kind: Service
metadata:
annotations:
cloud.google.com/backend-config: '{"default": "flowise-backendconfig"}'
name: flowise-service
namespace: your-namespace
...Issue:
kubectl apply -f service.yaml
Last updated