Files
openmotion/deploy/k8s/worker-render-deployment.yaml
open-design-crew[bot] 3b56272dfe [OPEND-5496][OPEND-5807] feat(tracking): cloud allowlist, per-user identity, and dual-write Tracert telemetry (#1130)
* [OPEND-5496] feat(cloud-tracking): add cloud allowlist, cloud_web channel, and monetization attribution

* test(studio): assert resolution gate attribution payload in AssetComposer

* fix(cloud-tracking): address Looper review (restore tests, rotate entry_id, deploy env, docs)

* fix(studio): pass native job.model.modelId for failure-gate attribution

* feat(tracking): add Tracert v0.6.0 dual reporting, canonical user identity, and env-only PostHog config

Integrate @powerformer/tracert@0.6.0 alongside existing PostHog telemetry for both Studio browser and cloud API server reporting while keeping self-hosted deployments strictly opt-in with zero hardcoded tokens.

- Add shared runtime tracking config validation and CSP-safe HTML injection so Studio hydrates tracking config in 0 RTT when enabled and skips downloading the lazy Tracert chunk when OPENMOTION_TRACERT_SPM_A is unset.
- Dual-write closed-schema Studio events and server-side account_sign_in_result across PostHog and Tracert using identical event_id and occurred_at values, keeping auto-collection plugins disabled and registering graceful TracertNode shutdown.
- Align browser and server user identity on AMR appUserId (falling back to local user.id only when self-hosted), attach workspace_id/workspace_role/plan_tier as user context, preserve anonymous device_id across passive signed-out reloads, and rotate identity on explicit sign-out.
- Remove hardcoded PostHog credentials in shared/tracking-config.json so standalone tracking is strictly env-driven.
- Allowlist only the SHA-256 digest of the SDK's default public Collector endpoint in bundled Studio JS assets in .github/scripts/motion-scan.mjs.

* fix(tracking): preserve equivalent Tracert init loads, clear expired SDK identity, and drain PostHog queues on shutdown

* fix(tracking): propagate render telemetryOptOut, isolate browser queue across identity changes, and wire production identity sync

* fix(tracking): isolate identity sync module and guard non-browser tracking init

---------

Co-authored-by: qiqi <qiqi@qiqideMBP.lan>
Co-authored-by: 罗高 <luogao@users.noreply.github.com>
2026-11-26 19:28:11 +08:00

180 lines
6.1 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: openmotion-worker-render
namespace: openmotion
labels:
app.kubernetes.io/name: openmotion-worker-render
app.kubernetes.io/component: worker-render
app.kubernetes.io/part-of: openmotion
spec:
# Replicas are intentionally omitted so `kubectl apply -k` does not clobber
# KEDA ScaledObject-managed replica counts (see worker-render-keda.yaml).
revisionHistoryLimit: 5
selector:
matchLabels:
app.kubernetes.io/name: openmotion-worker-render
app.kubernetes.io/component: worker-render
template:
metadata:
labels:
app.kubernetes.io/name: openmotion-worker-render
app.kubernetes.io/component: worker-render
app.kubernetes.io/part-of: openmotion
spec:
serviceAccountName: openmotion-worker-render
automountServiceAccountToken: false
# Allow in-flight long-running video exports to finish and upload cleanly during scale-down/rollout.
terminationGracePeriodSeconds: 1800
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
seccompProfile:
type: RuntimeDefault
containers:
- name: worker-render
image: ghcr.io/nexu-io/openmotion-worker-render:latest
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
# CRITICAL SECURITY BOUNDARY:
# NEVER inject OPENDESIGN_*, OIDC_*, SESSION_SECRET, or DEV_PAT into worker-render.
# Only minimal DB/Redis/S3 connectivity is provided to the parent worker process,
# and src/workers/render-env.ts strips ALL of these before spawning Chromium/FFmpeg.
env:
- name: WORKER_ROLE
value: "render"
- name: NODE_ENV
valueFrom:
configMapKeyRef:
name: openmotion-config
key: NODE_ENV
- name: LOG_LEVEL
valueFrom:
configMapKeyRef:
name: openmotion-config
key: LOG_LEVEL
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: openmotion-secrets
key: DATABASE_URL
- name: PG_POOL_MAX
value: "5"
- name: REDIS_URL
valueFrom:
secretKeyRef:
name: openmotion-secrets
key: REDIS_URL
- name: S3_ENDPOINT
valueFrom:
configMapKeyRef:
name: openmotion-config
key: S3_ENDPOINT
optional: true
- name: S3_REGION
valueFrom:
configMapKeyRef:
name: openmotion-config
key: S3_REGION
- name: S3_BUCKET
valueFrom:
configMapKeyRef:
name: openmotion-config
key: S3_BUCKET
- name: S3_FORCE_PATH_STYLE
valueFrom:
configMapKeyRef:
name: openmotion-config
key: S3_FORCE_PATH_STYLE
- name: S3_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: openmotion-secrets
key: S3_ACCESS_KEY_ID
optional: true
- name: S3_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: openmotion-secrets
key: S3_SECRET_ACCESS_KEY
optional: true
- name: RENDER_CONCURRENCY
valueFrom:
configMapKeyRef:
name: openmotion-config
key: RENDER_CONCURRENCY
- name: RENDER_CAPTURE_WORKERS
valueFrom:
configMapKeyRef:
name: openmotion-config
key: RENDER_CAPTURE_WORKERS
optional: true
- name: APP_PUBLIC_ORIGIN
valueFrom:
configMapKeyRef:
name: openmotion-config
key: APP_PUBLIC_ORIGIN
optional: true
- name: OPENMOTION_TRACKING_ENABLED
valueFrom:
configMapKeyRef:
name: openmotion-config
key: OPENMOTION_TRACKING_ENABLED
optional: true
- name: OPENMOTION_POSTHOG_TOKEN
valueFrom:
configMapKeyRef:
name: openmotion-config
key: OPENMOTION_POSTHOG_TOKEN
optional: true
- name: OPENMOTION_POSTHOG_HOST
valueFrom:
configMapKeyRef:
name: openmotion-config
key: OPENMOTION_POSTHOG_HOST
optional: true
- name: OPENMOTION_TRACKING_INSTALLATION_ID
valueFrom:
configMapKeyRef:
name: openmotion-config
key: OPENMOTION_TRACKING_INSTALLATION_ID
optional: true
- name: OPENMOTION_TRACERT_SPM_A
valueFrom:
configMapKeyRef:
name: openmotion-config
key: OPENMOTION_TRACERT_SPM_A
optional: true
- name: OPENMOTION_TRACERT_ENDPOINT
valueFrom:
configMapKeyRef:
name: openmotion-config
key: OPENMOTION_TRACERT_ENDPOINT
optional: true
resources:
requests:
cpu: "2000m"
memory: "4Gi"
limits:
cpu: "4000m"
memory: "8Gi"
volumeMounts:
- name: tmp
mountPath: /tmp
- name: dshm
mountPath: /dev/shm
volumes:
- name: tmp
emptyDir:
sizeLimit: 10Gi
- name: dshm
emptyDir:
medium: Memory
sizeLimit: 2Gi