|
1 | 1 | # Deployments |
2 | 2 |
|
3 | | -Documentation and build files for our deployments. |
| 3 | +The deployments subject contains documentation and build scripts for deploying docs.github.com to production and staging environments. This includes Docker build configuration, repository fetching scripts, and deployment procedures. |
| 4 | + |
| 5 | +## Purpose & Scope |
| 6 | + |
| 7 | +This subject is responsible for: |
| 8 | +- Production deployment configuration and automation |
| 9 | +- Staging server deployment processes |
| 10 | +- Docker image build scripts for fetching repos (early-access, translations) |
| 11 | +- Deployment documentation and procedures |
| 12 | +- Integration with Moda (GitHub's internal deployment platform) |
| 13 | + |
| 14 | +## Architecture & Key Assets |
| 15 | + |
| 16 | +### Key capabilities and their locations |
| 17 | + |
| 18 | +- `production/build-scripts/fetch-repos.sh` - Main script that orchestrates fetching docs-early-access and all translation repos during Docker build |
| 19 | +- `production/build-scripts/clone-or-use-cached-repo.sh` - Utility function to clone repos or use cached versions |
| 20 | +- `production/build-scripts/merge-early-access.sh` - Merges early-access content into production content |
| 21 | +- `Dockerfile` (root) - Multi-stage Docker build for production deployments |
| 22 | +- `.github/workflows/moda-ci.yaml` - CI/CD workflow that builds and deploys via Moda |
| 23 | + |
| 24 | +## Setup & Usage |
| 25 | + |
| 26 | +### Production deployments |
| 27 | + |
| 28 | +Production deploys happen automatically: |
| 29 | +- Pushing to `main` branch triggers automatic deployment to production |
| 30 | +- Status updates posted in `#docs-ops` Slack channel |
| 31 | +- Deployment uses Moda (GitHub's internal deployment platform) |
| 32 | + |
| 33 | +### Building production Docker image locally |
| 34 | + |
| 35 | +```bash |
| 36 | +docker build -t docs:latest . --secret id=DOCS_BOT_PAT_BASE,src=<(echo "<your GH PAT value>") |
| 37 | +``` |
| 38 | + |
| 39 | +Requirements for PAT: |
| 40 | +- Must have `contents: read` access to: |
| 41 | + 1. All `docs-internal.<lang>` translation repos |
| 42 | + 2. `docs-early-access` repo |
| 43 | + |
| 44 | +Run the built image locally. |
| 45 | + |
| 46 | +### Staging deployments |
| 47 | + |
| 48 | +To deploy to a staging server: |
| 49 | +1. Push your branch to `docs-internal` |
| 50 | +2. Open a draft PR |
| 51 | +3. Wait for `docs-internal Moda CI` checks to pass |
| 52 | +4. In `#docs-ops` Slack, run: `.deploy docs-internal/<your-branch> to staging-<your-username>` |
| 53 | +5. Access at `https://docs-staging-<your-username>.service.iad.github.net` (requires Developer VPN) |
| 54 | + |
| 55 | +### Running tests |
| 56 | + |
| 57 | +No subject-specific tests exist currently. CI/CD validation happens through Moda workflows. |
| 58 | + |
| 59 | +## Data & External Dependencies |
| 60 | + |
| 61 | +### Data inputs |
| 62 | +- Dockerfile and build scripts |
| 63 | +- GitHub PAT for private repo access (`DOCS_BOT_PAT_BASE`) |
| 64 | +- Early access repo (`docs-early-access`) |
| 65 | + |
| 66 | +### Dependencies |
| 67 | +- Docker and Docker BuildKit |
| 68 | +- Moda platform (GitHub internal) |
| 69 | +- GitHub Vault for secrets management |
| 70 | +- Node.js (installed during Docker build) |
| 71 | +- Git (for cloning repos during build) |
| 72 | + |
| 73 | +### Build process |
| 74 | +1. Clone docs-internal content, assets, data |
| 75 | +2. Fetch and merge docs-early-access |
| 76 | +3. Fetch all translation repos in parallel |
| 77 | +4. Install production dependencies |
| 78 | +5. Build Next.js application |
| 79 | +6. Create production Docker image |
| 80 | + |
| 81 | +### Data outputs |
| 82 | +- Docker image with full site content (public + early-access + translations) |
| 83 | +- Deployed application on Moda infrastructure |
| 84 | +- Deployment notifications in Slack |
| 85 | + |
| 86 | +## Cross-links & Ownership |
| 87 | + |
| 88 | +### Related subjects |
| 89 | +- [`src/early-access`](../early-access/README.md) - Early access content merged during build |
| 90 | +- [`src/languages`](../languages/README.md) - Translation repos fetched during build |
| 91 | +- Root `Dockerfile` - Docker build configuration |
| 92 | +- `.github/workflows/moda-ci.yaml` - CI/CD workflow |
| 93 | + |
| 94 | +### Internal documentation |
| 95 | +For detailed internal documentation, see: |
| 96 | +- `Moda` directory in internal Docs Engineering repo |
| 97 | +- Production deploy procedures (internal docs) |
| 98 | + |
| 99 | +### Ownership |
| 100 | +- Team: Docs Engineering |
| 101 | +- Slack: #build, #deploy-support (for deployment status and commands) |
| 102 | + |
| 103 | +## Current State & Next Steps |
| 104 | + |
| 105 | +### Known limitations |
| 106 | +- Build scripts are shell scripts, not TypeScript (different from rest of codebase) |
| 107 | +- Requires VPN access for staging server access |
| 108 | +- Local Docker builds require manual PAT management |
| 109 | + |
| 110 | +### Deployment monitoring |
| 111 | +- Deployment status posted to `#docs-ops` Slack channel |
| 112 | +- Moda provides deployment dashboards and logs (internal) |
| 113 | +- Rollback procedures documented in internal Docs Engineering repo |
| 114 | + |
| 115 | +### Required secrets |
| 116 | +- `DOCS_BOT_PAT_BASE` - GitHub PAT with access to private repos |
| 117 | +- Managed via GitHub Vault |
| 118 | +- Passed securely to Docker build via `--secret` flag |
| 119 | + |
| 120 | +### Rollback procedures |
| 121 | +Rollback procedures are documented in the internal Docs Engineering repository. Contact @docs-engineering or #deploy-support assistance. |
4 | 122 |
|
5 | | -- For production deploys: [src/deployments/production](./production/) |
6 | | -- For staging deploys: [src/deployments/staging](./staging/) |
|
0 commit comments