Skip to main content

Demo User Seeding

After the platform is running, seed the four standard demo users into the CTMS platform using a one-shot Python script that calls the Zynexa signup API. This mirrors the same approach as ctms-init and ctms-supabase-seed — a single Docker command that runs, seeds, and exits.


Prerequisites​

  • The CTMS platform stack is running (docker compose up -d)
  • The zynexa service is healthy (http://localhost:3000/api/health returns 200)
  • You are in the ctms.devops deployment directory

The ctms-user-seed service is defined in docker-compose.yml under the init profile. It builds from scripts/ctms-seed/Dockerfile and connects to the zynexa service over ctms-network.

# One-off run (builds locally if image not present)
docker compose --env-file .env.production run --rm ctms-user-seed

Or together with the other init containers:

docker compose --env-file .env.production --profile init up ctms-user-seed
tip

ctms-user-seed has depends_on: zynexa (service_healthy) so it waits for the app to be ready before posting.

Expected Output​

Target: http://zynexa:3000/api/v1/user/signup
Seeding 4 user(s)...

✅ kiran.v@zynomi.com → Platform Administrator
✅ michael.x@zynomi.com → Study Coordinator
✅ roshini.s@zynomi.com → Study Designer
✅ peter.p@zynomi.com → Principal Investigator

Done. 4 succeeded, 0 failed.

Demo Users Created​

NameEmailRolePassword
Kiran Vikranthkiran.v@zynomi.comPlatform AdministratorWelcome@1234
Michael Xaviermichael.x@zynomi.comStudy CoordinatorWelcome@1234
Roshini Sharmaroshini.s@zynomi.comStudy DesignerWelcome@1234
Peter Parkerpeter.p@zynomi.comPrincipal InvestigatorWelcome@1234
Demo Only

These are synthetic demo credentials for local development and demo environments. Do not use in production. Change or remove them after initial setup.


Run Locally (Without Docker)​

If you are running the stack locally with bun run dev (non-Docker), the zynexa hostname won't resolve. Use the compose service with the host network instead:

docker compose --env-file .env run --rm \
--network host \
ctms-user-seed

Or call the script directly with Python (no extra deps — stdlib only):

cd scripts/ctms-seed
API_HOST=http://localhost:3000 python3 seed_users.py

What the Script Does​

The script POSTs each user to POST /api/v1/user/signup on the zynexa service:

{
"email": "kiran.v@zynomi.com",
"password": "Welcome@1234",
"first_name": "Kiran",
"last_name": "Vikranth",
"gender": "Male",
"mobile_no": "+91 999-999-991",
"user_type": "System User",
"roles": [{ "role": "Platform Administrator" }],
"send_welcome_email": 0
}
  • Uses Python stdlib only — no pip install needed inside the container
  • Exits 0 on full success, 1 if any user fails
  • Logs each result with ✅/❌ to stdout

Relationship to Other Init Steps​

This seed runs after the core provisioning steps:

StepCommandWhat it provisions
Frappe provisioningdocker compose --profile init up ctms-initDocTypes, RBAC, master data
Supabase tablesdocker compose --profile init run --rm ctms-supabase-seedAuth tables, RLS, functions
Demo usersdocker run ... python /scripts/seed_users.py4 demo user accounts