CMS Deployment
Source:
omni-cms-composable-cms/infrastructure/lib/pipeline/pipeline-stack.ts,scripts/deploy.sh
Deployment Model
Section titled “Deployment Model”The CMS has a dual deployment:
- Sanity Studio — Deployed to Sanity’s hosting (
<host>.sanity.studio) - Runtime Infrastructure — CDK stack with DAM sync Lambda, SQS queues, Kafka pipe (AWS)
Both are managed by a single CodePipeline per environment.
Pipeline Flow
Section titled “Pipeline Flow”Stages
Section titled “Stages”| Stage | Trigger | Branch | Dataset |
|---|---|---|---|
prod | Push to main | main | production |
preprod | Push to main | main | preprod |
staging | Git tag | main | staging |
sandbox | Push to feature/* | feature/*, fix/*, chore/* | <branch>_sandbox |
Sandbox Naming
Section titled “Sandbox Naming”For branch feature/cofi-123:
- Dataset:
cofi_123_sandbox - Studio host:
cofi-123-sandbox-hema-cms - Studio URL:
https://cofi-123-sandbox-hema-cms.sanity.studio
Pipeline Steps
Section titled “Pipeline Steps”Synth (All Environments)
Section titled “Synth (All Environments)”npm cinpm run typechecknpm run lintnpm run validate-schemanpm run cdk:synthnpm run build # Builds StudioMainline Deploy (prod, preprod, staging)
Section titled “Mainline Deploy (prod, preprod, staging)”sanity documents validate -yfor file in ./migrations/*.ts; do sanity migration run "$file" --dataset $DATASETdonesanity deploy --yesFeature Deploy (sandbox)
Section titled “Feature Deploy (sandbox)”# Creates sandbox datasetnpx ts-node infrastructure/lib/scripts/create-sandbox.ts# Deploys Studio + CORSsanity deploy --yessanity cors add $CORS_ORIGIN --credentialsSandbox Cleanup
Section titled “Sandbox Cleanup”After manual approval:
- Undeploys Studio (
sanity undeploy) - Deletes CORS origin
- Deletes CloudFormation stacks
Branch deletion webhook also triggers cleanup automatically.
Local Deployment
Section titled “Local Deployment”Prerequisites
Section titled “Prerequisites”aws sso login --profile <profile>npm run environment:set:sandbox # Creates .env.sandboxDeploy to Sandbox
Section titled “Deploy to Sandbox”npm run deploy:sandbox# Or: ./scripts/deploy.sh -s sandbox -p <profile>The deploy script validates branch name format and blocks non-main branches from deploying to prod/preprod/staging.
Deploy Wizard
Section titled “Deploy Wizard”npm run deploy:wizardInteractive wizard for stage selection and deployment.
Common Operations
Section titled “Common Operations”| Task | Command |
|---|---|
| Validate schema | npm run validate-schema |
| Run migrations | npx sanity migration run migrations/<name>.ts --dataset <dataset> |
| Build Studio | npm run build |
| Deploy Studio only | SANITY_AUTH_TOKEN=<token> npx sanity deploy --yes |
Build Environment
Section titled “Build Environment”- Compute: Lambda 8GB (CodeBuild)
- Image: Amazon Linux 2023, Node 22
- Packages:
@hemafrom CodeArtifact (hema-proddomain)