Deployment Quick Commands

Copy-paste commands for all deployment operations

⚡ Deployment Quick Commands

Copy-paste commands for common deployment operations


Connection Testing

# Test GitLab connection
yarn test:gitlab

# Test Cloudflare connection
yarn test:cloudflare

# Run full E2E pipeline test
yarn e2e:pipeline

# Verify only (no actual deployment)
yarn e2e:pipeline:verify

Internal Services (Railway)

Deploy Single Service

# Backend API
git checkout deploy/api && git merge main --no-edit && git push origin deploy/api && git checkout main

# Backend AI API
git checkout deploy/ai-api && git merge main --no-edit && git push origin deploy/ai-api && git checkout main

# Backend Docs API
git checkout deploy/docs-api && git merge main --no-edit && git push origin deploy/docs-api && git checkout main

# Frontend
git checkout deploy/frontend && git merge main --no-edit && git push origin deploy/frontend && git checkout main

Deploy via NPM Scripts

yarn railway:deploy:backend     # backend-api
yarn railway:deploy:ai          # backend-ai-api
yarn railway:deploy:docs        # backend-docs-api
yarn railway:deploy:frontend    # gograb-space
yarn railway:deploy:all         # All services

Health Checks

# All services
curl -s https://api.gograb.space/api/health | jq
curl -s https://ai-api.gograb.space/ai-api/health | jq
curl -s https://docs-api.gograb.space/docs-api/health | jq

# Quick one-liner
for svc in api ai-api docs-api; do echo "$svc:"; curl -s "https://$svc.gograb.space/$svc/health" | jq .status; done

User Platforms (GitLab + Cloudflare)

GitLab Operations

# List projects in gograbspace group
curl -H "PRIVATE-TOKEN: $GITLAB_API_TOKEN" \
  "https://gitlab.com/api/v4/groups/122455722/projects" | jq '.[].name'

# Get project details
curl -H "PRIVATE-TOKEN: $GITLAB_API_TOKEN" \
  "https://gitlab.com/api/v4/projects/gograbspace%2F<project-name>"

# Trigger pipeline manually
curl -X POST -H "PRIVATE-TOKEN: $GITLAB_API_TOKEN" \
  "https://gitlab.com/api/v4/projects/gograbspace%2F<project-name>/pipeline" \
  -d "ref=main"

# Get pipeline status
curl -H "PRIVATE-TOKEN: $GITLAB_API_TOKEN" \
  "https://gitlab.com/api/v4/projects/gograbspace%2F<project-name>/pipelines/<pipeline-id>"

Cloudflare Operations

# Verify token
curl -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  "https://api.cloudflare.com/client/v4/user/tokens/verify" | jq

# List Pages projects
curl -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/pages/projects" | jq '.result[].name'

# Create project
curl -X POST -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  -H "Content-Type: application/json" \
  "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/pages/projects" \
  -d '{"name": "my-project", "production_branch": "main"}'

# Delete project
curl -X DELETE -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/pages/projects/my-project"

Direct Wrangler Deploy

# Deploy to Cloudflare Pages (bypasses GitLab CI)
yarn deploy:wrangler <project-name> <dist-path> [branch]

# Example
yarn deploy:wrangler client-platform ./dist/browser main

# Or using the shell script
./tools/scripts/deploy-with-wrangler.sh client-platform ./dist/browser main

Environment Variables

Load from .env.local

# Load all variables
set -a && source .env.local && set +a

# Load specific variables only
export GITLAB_API_TOKEN=$(grep GITLAB_API_TOKEN .env.local | cut -d= -f2)
export CLOUDFLARE_API_TOKEN=$(grep CLOUDFLARE_API_TOKEN .env.local | cut -d= -f2)
export CLOUDFLARE_ACCOUNT_ID=$(grep CLOUDFLARE_ACCOUNT_ID .env.local | cut -d= -f2)

Check Current Values

echo "GitLab: ${GITLAB_API_TOKEN:0:15}..."
echo "Cloudflare Account: ${CLOUDFLARE_ACCOUNT_ID:0:10}..."
echo "Cloudflare Token: ${CLOUDFLARE_API_TOKEN:0:15}..."

Build Commands

Build for Production

# Backend services
yarn nx build backend-api --configuration=production
yarn nx build backend-ai-api --configuration=production
yarn nx build backend-docs-api --configuration=production

# Frontend
yarn nx build gograb-space --configuration=production

# Build all
yarn nx run-many -t build --configuration=production

Build with SSR

# Angular SSR build
yarn nx build client-platform --configuration=production
yarn nx run client-platform:prerender

Debugging

Railway Logs

# View logs (requires railway CLI linked)
railway logs

# Open Railway dashboard
railway open

GitLab Pipeline Logs

# Get job logs
curl -H "PRIVATE-TOKEN: $GITLAB_API_TOKEN" \
  "https://gitlab.com/api/v4/projects/gograbspace%2F<project>/jobs/<job-id>/trace"

Cloudflare Logs

# View Pages deployment logs (via dashboard)
# https://dash.cloudflare.com → Pages → Project → Deployments → View logs

Cleanup Commands

# Delete GitLab test projects (matching e2e-test-*)
curl -H "PRIVATE-TOKEN: $GITLAB_API_TOKEN" \
  "https://gitlab.com/api/v4/groups/122455722/projects?search=e2e-test" | \
  jq -r '.[].path_with_namespace' | \
  xargs -I {} curl -X DELETE -H "PRIVATE-TOKEN: $GITLAB_API_TOKEN" \
    "https://gitlab.com/api/v4/projects/{}"

# Delete Cloudflare test projects
curl -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/pages/projects" | \
  jq -r '.result[] | select(.name | startswith("e2e-test")) | .name' | \
  xargs -I {} curl -X DELETE -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/pages/projects/{}"

NPM Scripts Reference

Script Description
yarn test:gitlab Test GitLab connection
yarn test:cloudflare Test Cloudflare connection
yarn e2e:pipeline Run full E2E tests
yarn e2e:pipeline:verify Verify connections only
yarn e2e:pipeline:keep Run E2E, keep test resources
yarn deploy:wrangler Direct Cloudflare deploy
yarn railway:deploy:all Deploy all Railway services