Deployment
Media Gateway (Express)
The Express server runs on the production machine behind a Cloudflare Tunnel.
# On the server
cd media-gateway
git pull
npm install
cd jimeng-sign-service && npm install && cd ..
npm run build
npm startnpm start launches three processes concurrently:
- express — API server on port 3000
- jimeng-sign — Sidecar on port 3457
- social-worker — Python worker
CF Workers
Deploy individual workers:
export CLOUDFLARE_ACCOUNT_ID=cc323c2ae7f85d59c43320bfc6493e41
cd workers/<name>
npx wrangler deployJimeng Login
After a fresh deploy, the sidecar needs a login session:
# Via API
curl -X POST https://frai.paradream.info/api/v1/creative/auth/jimeng/qr \
-H "CF-Access-Client-Id: <id>" \
-H "CF-Access-Client-Secret: <secret>"
# Returns QR base64 → scan with Douyin
# Then poll: GET /auth/jimeng/qr/pollSession cookies are saved to jimeng-sign-service/cookies.json and valid for 365 days.