droboticflow-new/docs/deployment.md
eust-w 43326d6a5e feat(platform): land workflow, data tooling, and docs updates
Include the accumulated workflow scheduling, run history, subtree rerun, operator UI, deployment, data asset, object storage, database browser, and documentation changes currently in the worktree.
2026-04-24 12:29:46 +08:00

5.2 KiB

Deployment Guide

Images

This project deploys three images:

  • droboticflow-api
  • droboticflow-worker
  • droboticflow-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 binary
  • droboticflow-worker: Go worker binary
  • droboticflow-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=...

You can also load a named deployment preset:

DEPLOY_ENV=wjzh IMAGE_TAG=20260421 ./scripts/build-and-push-images.sh

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_URI=mongodb://<user>:<password>@<external-host>:27017/
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>

For the wjzh environment, the repo now carries non-secret defaults in scripts/deploy-envs/wjzh.env. Sensitive values stay out of git and can be stored in either:

  • $HOME/.config/droboticflow/deploy/wjzh.secrets.env
  • .env.wjzh.local

The loader also looks for $HOME/.config/droboticflow/kubeconfigs/wjzh.config and exports KUBECONFIG automatically when DEPLOY_ENV=wjzh is set.

4. Deploy

./scripts/deploy-k8s.sh

Or, with the reusable preset:

DEPLOY_ENV=wjzh ./scripts/deploy-k8s.sh

The deploy script performs these actions:

  1. creates the namespace if it does not exist
  2. creates or updates the image pull secret
  3. loads MONGO_URI from the current cluster secret when omitted, then validates that it points to an external MongoDB instance
  4. creates or updates the droboticflow-mongo-secret Secret with MONGO_URI
  5. creates or updates the droboticflow-ai-secret Secret for server-side AI generation
  6. renders k8s/droboticflow.template.yaml
  7. applies the manifest to the cluster
  8. waits for API and worker rollouts

The main deployment path no longer creates a platform MongoDB Pod or Service. You must provision the backing MongoDB outside this manifest and provide its URI explicitly.

5. Services Created

  • droboticflow-api: NodePort service that exposes the frontend and API
  • droboticflow-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_NAMESPACE
  • MONGO_DB
  • MONGO_CONNECT_RETRIES
  • MONGO_CONNECT_RETRY_DELAY_MS
  • WORKER_POLL_INTERVAL_MS
  • API_NODE_PORT
  • API_REPLICAS
  • WORKER_REPLICAS
  • K8S_IMAGE_PULL_SECRET_NAME
  • AI_API_BASE_URL
  • AI_MODEL
  • API_IMAGE
  • WORKER_IMAGE
  • OPERATOR_RUNNER_IMAGE

7. Notes

  • The main manifest only deploys the application components. It does not create MongoDB resources in-cluster.
  • MONGO_URI must reference an external MongoDB instance; localhost, mongodb:27017, and in-cluster .svc addresses are rejected by scripts/deploy-k8s.sh.
  • 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_KEY is mounted through the droboticflow-ai-secret Secret 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.