DOCS-DEPLOYING.md
This guide covers deploying the docs-v2 site to staging and production environments, as well as LLM markdown generation.
Staging deployments are manual and run locally with your AWS credentials.
AWS Credentials - Configure AWS CLI with appropriate permissions:
aws configure
s3deploy - Install the s3deploy binary:
./deploy/ci-install-s3deploy.sh
Environment Variables - Set required variables:
export STAGING_BUCKET="test2.docs.influxdata.com"
export AWS_REGION="us-east-1"
export STAGING_CF_DISTRIBUTION_ID="E1XXXXXXXXXX" # Optional
Use the staging deployment script:
yarn deploy:staging
Or run the script directly:
./scripts/deploy-staging.sh
config/staging/hugo.yml)yarn build:md)STAGING_CF_DISTRIBUTION_ID is set)Skip specific steps for faster iteration:
# Skip Hugo build (use existing public/)
export SKIP_BUILD=true
# Skip markdown generation
export SKIP_MARKDOWN=true
# Build only (no S3 upload)
export SKIP_DEPLOY=true
SKIP_DEPLOY=true ./scripts/deploy-staging.sh
Production deployments are automatic via CircleCI when merging to master.
Build Job (.circleci/config.yml):
yarn build:md)Deploy Job:
Production deployment requires the following environment variables set in CircleCI:
BUCKET - Production S3 bucket nameREGION - AWS regionCF_DISTRIBUTION_ID - CloudFront distribution IDSLACK_WEBHOOK_URL - Slack notification webhookgit push origin master
CircleCI will automatically build and deploy.
Both staging and production deployments generate LLM-friendly Markdown files at build time.
The build generates two types of markdown files in public/:
Single-page markdown (index.md)
Section bundles (index.section.md)
# Generate all markdown
yarn build:md
# Generate for specific path
node scripts/build-llm-markdown.js --path influxdb3/core/get-started
# Limit number of files (for testing)
node scripts/build-llm-markdown.js --limit 100
Edit scripts/build-llm-markdown.js to adjust:
// Skip files smaller than this (Hugo alias redirects)
const MIN_HTML_SIZE_BYTES = 1024;
// Token estimation ratio
const CHARS_PER_TOKEN = 4;
// Concurrency (workers)
const CONCURRENCY = process.env.CI ? 10 : 20;
If making changes that affect yarn build commands or .circleci/config.yml:
--destination workspace/public on the Hugo build"This script will run in CI. Let me read the CI configuration to understand the build environment and directory structure before finalizing the implementation."
| Strategy | Implementation | Effort |
|---|---|---|
| Read CI config before implementing | Process/habit change | Low |
| Test on feature branch first | Push and watch CI before merging | Low |
| Add CI validation step | Add file count check in config.yml | Low |
Test markdown generation locally before deploying:
# Prerequisites
yarn install
yarn build:ts
npx hugo --quiet
# Generate markdown for testing
yarn build:md
# Generate markdown for specific path
node scripts/build-llm-markdown.js --path influxdb3/core/get-started --limit 10
# Run validation tests
node cypress/support/run-e2e-specs.js \
--spec "cypress/e2e/content/markdown-content-validation.cy.js"
The Cypress tests validate:
{{< >}} or {{% %}})See DOCS-TESTING.md for comprehensive testing documentation.
Generates previews for docs-v2 pull requests for manual validation in GitHub using the PR Preview Action.
| File | Purpose |
|---|---|
.github/scripts/parse-pr-urls.js | Extract docs URLs from PR description |
.github/scripts/detect-preview-pages.js | Determine which pages to preview |
.github/scripts/prepare-preview-files.js | Stage files for selective deployment |
.github/scripts/preview-comment.js | Manage sticky PR comments |
.github/workflows/pr-preview.yml | Main preview workflow |
.github/workflows/cleanup-stale-previews.yml | Weekly orphan cleanup |
.github/PREVIEW_SETUP.md | Setup documentation |
content-utils.js for change detectiongh-pages branch under pr-preview/pr-{number}/Install the s3deploy binary:
./deploy/ci-install-s3deploy.sh
Verify installation:
s3deploy -version
Check required variables are set:
echo $STAGING_BUCKET
echo $AWS_REGION
Set them if missing:
export STAGING_BUCKET="test2.docs.influxdata.com"
export AWS_REGION="us-east-1"
Ensure your AWS credentials have the required permissions:
s3:PutObject - Upload files to S3s3:DeleteObject - Delete old files from S3cloudfront:CreateInvalidation - Invalidate cacheCheck your AWS profile:
aws sts get-caller-identity
Check for:
yarn install)yarn build:ts)Build Hugo separately to isolate the issue:
yarn hugo --environment staging
Check for:
yarn build:ts)Test markdown generation separately:
yarn build:md --limit 10
If you see stale content after deployment:
STAGING_CF_DISTRIBUTION_ID is set correctlycloudfront:CreateInvalidation permissionaws cloudfront create-invalidation \
--distribution-id E1XXXXXXXXXX \
--paths "/*"
For large deployments:
Skip markdown generation if unchanged:
SKIP_MARKDOWN=true ./scripts/deploy-staging.sh
Use s3deploy's incremental upload:
Check network speed:
yarn lint)yarn hugo --environment staging)yarn build:md)yarn test:links)yarn test:codeblocks:all)