forked from longtao.wu/droboticflow
4.7 KiB
4.7 KiB
Deployment Guide
Images
This project deploys three images:
droboticflow-apidroboticflow-workerdroboticflow-operator-runner
Default Baidu registry naming:
ccr-29eug8s3-pub.cnc.bj.baidubce.com/dataflow/droboticflow-api:<tag>ccr-29eug8s3-pub.cnc.bj.baidubce.com/dataflow/droboticflow-worker:<tag>ccr-29eug8s3-pub.cnc.bj.baidubce.com/dataflow/droboticflow-operator-runner:<tag>
1. Log In to the Registry
Use the public endpoint unless you are deploying from the same VPC as the registry:
docker login ccr-29eug8s3-pub.cnc.bj.baidubce.com --username <registry-user>
2. Build and Push Images
IMAGE_TAG=20260408 ./scripts/build-and-push-images.sh
Image contents:
droboticflow-api: Vite frontend assets + Go API binarydroboticflow-worker: Go worker binarydroboticflow-operator-runner: Python runtime +backend/operator-runner/main.py
The script prints the exact image URLs. Reuse those values for deployment:
API_IMAGE=...
WORKER_IMAGE=...
OPERATOR_RUNNER_IMAGE=...
If the target cluster cannot pull mongo:7 directly from Docker Hub, mirror it to the same Baidu registry:
docker buildx build \
--platform linux/amd64 \
-t ccr-29eug8s3-pub.cnc.bj.baidubce.com/dataflow/droboticflow-mongo:7-amd64 \
--push \
- <<'EOF'
FROM mongo:7
EOF
3. Prepare Kubernetes Access
Point kubectl at the target cluster before deploying. The deployment scripts do not store kubeconfig in the repository.
Recommended environment variables:
export K8S_NAMESPACE=droboticflow
export API_IMAGE=ccr-29eug8s3-pub.cnc.bj.baidubce.com/dataflow/droboticflow-api:20260408
export WORKER_IMAGE=ccr-29eug8s3-pub.cnc.bj.baidubce.com/dataflow/droboticflow-worker:20260408
export OPERATOR_RUNNER_IMAGE=ccr-29eug8s3-pub.cnc.bj.baidubce.com/dataflow/droboticflow-operator-runner:20260408
export MONGO_IMAGE=ccr-29eug8s3-pub.cnc.bj.baidubce.com/dataflow/droboticflow-mongo:7-amd64
export REGISTRY_SERVER=ccr-29eug8s3-pub.cnc.bj.baidubce.com
export REGISTRY_USERNAME=<registry-user>
export REGISTRY_PASSWORD=<registry-password>
export K8S_IMAGE_PULL_SECRET_NAME=droboticflow-registry
export AI_API_BASE_URL=https://coding.dashscope.aliyuncs.com/v1
export AI_MODEL=glm-5
export AI_API_KEY=<dashscope-compatible-server-key>
4. Deploy
./scripts/deploy-k8s.sh
The deploy script performs these actions:
- creates the namespace if it does not exist
- creates or updates the image pull secret
- creates or updates MongoDB credentials, reusing the existing Secret values when present
- creates or updates the
droboticflow-ai-secretSecret for server-side AI generation - renders
k8s/droboticflow.template.yaml - applies the manifest to the cluster
- waits for MongoDB, API, and worker rollouts
5. Services Created
mongodb: ClusterIP service for MongoDBdroboticflow-api: NodePort service that exposes the frontend and APIdroboticflow-worker: ClusterIP service for worker health/debugging
Default API NodePort:
30080
If the cluster node IP is reachable, the UI and API are exposed at:
http://<node-ip>:30080
6. Manifest Variables
scripts/render-manifests.sh accepts:
K8S_NAMESPACEMONGO_DBMONGO_CONNECT_RETRIESMONGO_CONNECT_RETRY_DELAY_MSWORKER_POLL_INTERVAL_MSAPI_NODE_PORTAPI_REPLICASWORKER_REPLICASK8S_IMAGE_PULL_SECRET_NAMEAI_API_BASE_URLAI_MODELAPI_IMAGEWORKER_IMAGEOPERATOR_RUNNER_IMAGEMONGO_IMAGE
7. Notes
- The provided manifest uses a single-replica MongoDB Deployment with
emptyDirstorage so it can run on clusters that do not expose a defaultStorageClass. - MongoDB should be mirrored to the Baidu registry as an
amd64image when the cluster cannot pull from Docker Hub. - For production, replace the
emptyDirvolume with a PVC-backed deployment or StatefulSet. - API and worker entrypoints are Go binaries with Mongo startup retry, so they tolerate the database becoming ready after the Deployments start.
- The worker runs with Kubernetes RBAC that allows creating and watching Jobs in the namespace.
- The operator-runner Job template inherits the private registry pull secret name from
K8S_IMAGE_PULL_SECRET_NAME. - The operator-runner is not a standalone Deployment. It is launched on demand as a Python Job container.
- AI generation runs through the API Deployment.
AI_API_KEYis mounted through thedroboticflow-ai-secretSecret and must not be baked into frontend env vars. - If you use DashScope-compatible models, prefer a backend-allowed API key. Do not deploy tool-only Coding Plan keys into the cluster.
- Production hardening still depends on the target cluster policy: TLS ingress, network policies, backup strategy, and secret rotation.