|
| 1 | +# Trusted Server Documentation |
| 2 | + |
| 3 | +VitePress documentation site for Trusted Server. |
| 4 | + |
| 5 | +## Local Development |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +- Node.js 24.10.0 (or version specified in `.tool-versions`) |
| 10 | +- npm |
| 11 | + |
| 12 | +### Setup |
| 13 | + |
| 14 | +```bash |
| 15 | +# Install dependencies |
| 16 | +npm install |
| 17 | + |
| 18 | +# Start dev server (available at localhost:5173) |
| 19 | +npm run dev |
| 20 | +``` |
| 21 | + |
| 22 | +### Build |
| 23 | + |
| 24 | +```bash |
| 25 | +# Build for production |
| 26 | +npm run build |
| 27 | + |
| 28 | +# Preview production build |
| 29 | +npm run preview |
| 30 | +``` |
| 31 | + |
| 32 | +## GitHub Pages Deployment |
| 33 | + |
| 34 | +The documentation is automatically deployed to GitHub Pages when changes are pushed to the `main` branch. |
| 35 | + |
| 36 | +### Setup GitHub Pages |
| 37 | + |
| 38 | +1. Go to repository **Settings** → **Pages** |
| 39 | +2. Under **Source**, select **GitHub Actions** |
| 40 | +3. The workflow in `.github/workflows/deploy-docs.yml` will automatically deploy on push to `main` |
| 41 | + |
| 42 | +### Custom Domain Setup |
| 43 | + |
| 44 | +1. **Update CNAME file**: Edit `docs/public/CNAME` with your domain: |
| 45 | + ``` |
| 46 | + docs.yourdomain.com |
| 47 | + ``` |
| 48 | + |
| 49 | +2. **Configure DNS**: Add DNS records at your domain provider: |
| 50 | + |
| 51 | + **Option A - CNAME Record** (recommended for subdomains): |
| 52 | + ``` |
| 53 | + Type: CNAME |
| 54 | + Name: docs |
| 55 | + Value: iabtechlab.github.io |
| 56 | + ``` |
| 57 | + |
| 58 | + **Option B - A Records** (for apex domains): |
| 59 | + ``` |
| 60 | + Type: A |
| 61 | + Name: @ |
| 62 | + Value: 185.199.108.153 |
| 63 | + Value: 185.199.109.153 |
| 64 | + Value: 185.199.110.153 |
| 65 | + Value: 185.199.111.153 |
| 66 | + ``` |
| 67 | + |
| 68 | +3. **Verify in GitHub**: |
| 69 | + - Go to **Settings** → **Pages** |
| 70 | + - Enter your custom domain |
| 71 | + - Wait for DNS check to pass |
| 72 | + - Enable "Enforce HTTPS" |
| 73 | + |
| 74 | +### Workflow Details |
| 75 | + |
| 76 | +**Trigger**: |
| 77 | +- Push to `main` branch (only when `docs/**` changes) |
| 78 | +- Manual trigger via Actions tab |
| 79 | + |
| 80 | +**Build Process**: |
| 81 | +1. Checkout repository with full history (for `lastUpdated` feature) |
| 82 | +2. Setup Node.js (version from `.tool-versions`) |
| 83 | +3. Install dependencies (`npm ci`) |
| 84 | +4. Build VitePress site (`npm run build`) |
| 85 | +5. Upload build artifact |
| 86 | +6. Deploy to GitHub Pages |
| 87 | + |
| 88 | +**Permissions Required**: |
| 89 | +- `contents: read` - Read repository |
| 90 | +- `pages: write` - Deploy to Pages |
| 91 | +- `id-token: write` - OIDC token for deployment |
| 92 | + |
| 93 | +## Troubleshooting |
| 94 | + |
| 95 | +### Build Fails in GitHub Actions |
| 96 | + |
| 97 | +**Check**: |
| 98 | +- Node.js version matches `.tool-versions` |
| 99 | +- All dependencies in `package.json` are correct |
| 100 | +- Build succeeds locally (`npm run build`) |
| 101 | + |
| 102 | +**View Logs**: |
| 103 | +1. Go to **Actions** tab in GitHub |
| 104 | +2. Click on failed workflow run |
| 105 | +3. Review build logs |
| 106 | + |
| 107 | +### Custom Domain Not Working |
| 108 | + |
| 109 | +**Check**: |
| 110 | +- DNS records propagated (use `dig docs.yourdomain.com`) |
| 111 | +- CNAME file exists in `docs/public/CNAME` |
| 112 | +- Custom domain verified in GitHub Pages settings |
| 113 | +- HTTPS enforced (may take up to 24 hours) |
| 114 | + |
| 115 | +**DNS Verification**: |
| 116 | +```bash |
| 117 | +# Check CNAME record |
| 118 | +dig docs.yourdomain.com CNAME |
| 119 | + |
| 120 | +# Check A records (for apex domain) |
| 121 | +dig yourdomain.com A |
| 122 | +``` |
| 123 | + |
| 124 | +### 404 Errors |
| 125 | + |
| 126 | +**Check**: |
| 127 | +- VitePress `base` config (should not be set for custom domains) |
| 128 | +- Links use correct paths (start with `/`) |
| 129 | +- Build output in `docs/.vitepress/dist` is correct |
| 130 | + |
| 131 | +## Project Structure |
| 132 | + |
| 133 | +``` |
| 134 | +docs/ |
| 135 | +├── .vitepress/ |
| 136 | +│ ├── config.mts # VitePress configuration |
| 137 | +│ └── dist/ # Build output (gitignored) |
| 138 | +├── guide/ # Documentation pages |
| 139 | +│ ├── getting-started.md |
| 140 | +│ ├── configuration.md |
| 141 | +│ └── ... |
| 142 | +├── public/ # Static assets |
| 143 | +│ └── CNAME # Custom domain file |
| 144 | +├── index.md # Homepage |
| 145 | +├── package.json # Dependencies |
| 146 | +└── README.md # This file |
| 147 | +``` |
| 148 | + |
| 149 | +## Contributing |
| 150 | + |
| 151 | +When adding new documentation: |
| 152 | + |
| 153 | +1. Create `.md` files in `docs/guide/` |
| 154 | +2. Update sidebar in `docs/.vitepress/config.mts` |
| 155 | +3. Test locally with `npm run dev` |
| 156 | +4. Build and verify with `npm run build && npm run preview` |
| 157 | +5. Commit and push to trigger deployment |
| 158 | + |
| 159 | +## Links |
| 160 | + |
| 161 | +- **Production**: (Configure your custom domain) |
| 162 | +- **GitHub Repo**: https://github.com/IABTechLab/trusted-server |
| 163 | +- **VitePress Docs**: https://vitepress.dev |
0 commit comments