This guide explains how to deploy the GraphQL documentation to Google Cloud Storage.
The GraphQL documentation is automatically generated using SpectaQL and deployed to a GCS bucket that is publicly accessible. The documentation is generated from the GraphQL schema file (backend/src/graphql/schema.gql).
The documentation bucket is managed by the docs-bucket Terraform module located in terraform/modules/docs-bucket/.
Features:
- Public read access for documentation
- Service account permissions for CI/CD deployment
- CORS configuration for web access
- Versioning enabled
- Lifecycle rules for old versions
The bucket is created with:
- Name:
{project_id}-{environment}-epitrello-docs - Location: EU (configurable)
- Storage Class: STANDARD
- Public Access: Enabled for reading documentation
After applying Terraform, you can get the documentation URL:
cd terraform
terraform output docs_bucket_public_urlThe output will be:
https://storage.googleapis.com/{project_id}-{environment}-epitrello-docs/index.html
The documentation is automatically generated and deployed in the deploy-docs job of the deploy.yml workflow.
Workflow Steps:
- Build the backend application
- Generate GraphQL schema (if needed)
- Generate documentation with SpectaQL
- Upload documentation to GCS bucket
Trigger Conditions:
- Runs on push to
masterordevbranches - Requires successful Terraform apply
- Requires successful backend build
To manually deploy the documentation:
cd backend
# 1. Ensure schema exists
pnpm build
# 2. Generate documentation
pnpm docs:generate
# 3. Upload to GCS
BUCKET_NAME="your-project-id-staging-epitrello-docs"
gsutil -m rsync -r -d docs/graphql/ gs://${BUCKET_NAME}/Once deployed, the documentation is accessible at:
https://storage.googleapis.com/{project_id}-{environment}-epitrello-docs/index.html
From Terraform:
cd terraform
terraform output docs_bucket_public_urlFrom GCP Console:
- Go to Cloud Storage
- Find the bucket:
{project_id}-{environment}-epitrello-docs - Click on
index.html - Copy the public URL
From gcloud CLI:
gcloud storage buckets list --filter="name~docs"To generate and view documentation locally:
cd backend
# Generate documentation
pnpm docs:generate
# Serve locally
cd docs/graphql
python3 -m http.server 8000
# Or with Node.js
npx http-server docs/graphql -p 8000Then open http://localhost:8000 in your browser.
Issue: pnpm docs:generate fails
Solutions:
- Ensure the schema file exists:
backend/src/graphql/schema.gql - If missing, build the application:
pnpm build - Check SpectaQL configuration:
backend/spectaql.config.yml
Issue: gsutil rsync fails with permission error
Solutions:
- Verify service account has
roles/storage.objectAdminon the bucket - Check Workload Identity Federation is configured correctly
- Ensure the bucket exists (run Terraform apply)
Issue: 403 Forbidden when accessing the public URL
Solutions:
- Verify public read access is enabled:
gsutil iam get gs://{bucket-name} - Check bucket IAM policy includes
allUserswithroles/storage.objectViewer - Ensure
uniform_bucket_level_access = truein Terraform
Issue: Bucket doesn't exist
Solutions:
- Run Terraform apply to create the bucket:
cd terraform terraform apply - Verify the module is included in
terraform/main.tf - Check Terraform outputs for bucket name
The documentation is automatically updated when:
- Code is pushed to
masterordevbranches - Backend code changes (schema updates)
spectaql.config.ymlis modified
To force a regeneration:
- Make a commit to trigger the workflow
- Or manually run the deployment steps locally
Edit backend/spectaql.config.yml to customize:
- Title and description
- Introduction text
- Server URLs
- Display options
Edit terraform/modules/docs-bucket/main.tf to modify:
- Bucket location
- Storage class
- Lifecycle rules
- CORS configuration
- Public Access: The documentation bucket has public read access. This is intentional for API documentation.
- Write Access: Only the service account used by CI/CD has write permissions.
- Content: The documentation contains only schema information, no sensitive data.