Deploying Documentation to Cloudflare Pages
This guide explains how to deploy the Infowebplus documentation to Cloudflare Pages from a GitLab repository.
Prerequisites
- GitLab repository with the documentation code
- Cloudflare account
- Access to Cloudflare Pages
Step 1: Prepare Your Repository
Ensure your documentation is in the docs directory and has a package.json with build scripts.
Step 2: Connect GitLab to Cloudflare Pages
- Log in to Cloudflare Dashboard
- Navigate to Pages → Create a project
- Click Connect to Git
- Select GitLab and authorize Cloudflare
- Select your repository
Step 3: Configure Build Settings
Configure the following build settings:
- Project name:
infowebplus-docs(or your preferred name) - Production branch:
main(or your default branch) - Build command:
cd docs && npm install && npm run build - Build output directory:
docs/build - Root directory:
/(leave empty or set to root)
Environment Variables (if needed)
If your documentation needs environment variables:
- Go to Settings → Environment variables
- Add any required variables (e.g.,
GTAG_IDfor analytics)
Step 4: Custom Domain Setup
Add Custom Domain
- Go to your project → Custom domains
- Click Set up a custom domain
- Enter
docs.infowebplus.com - Follow DNS configuration instructions
DNS Configuration
Add a CNAME record in your DNS provider:
Type: CNAME
Name: docs
Content: [your-project].pages.dev
TTL: Auto
Proxy: Enabled (orange cloud)
Step 5: Deploy
Cloudflare Pages will automatically:
- Build your documentation on every push to the main branch
- Deploy previews for pull requests
- Update the production site automatically
Manual Deployment
You can also deploy manually using Wrangler CLI:
npm install -g wrangler
cd docs
npm run build
wrangler pages deploy build --project-name=infowebplus-docs
Build Configuration
GitLab CI/CD (Alternative)
You can also use GitLab CI/CD to build and deploy. Create .gitlab-ci.yml:
image: node:20
pages:
stage: deploy
script:
- cd docs
- npm install
- npm run build
artifacts:
paths:
- docs/build
only:
- main
Troubleshooting
Build Fails
- Check Node.js version (requires Node 20+)
- Verify all dependencies are in
package.json - Check build logs in Cloudflare dashboard
Custom Domain Not Working
- Verify DNS records are correct
- Wait for DNS propagation (can take up to 24 hours)
- Check SSL certificate status
Preview Deployments Not Working
- Ensure GitLab integration is properly configured
- Check branch protection settings
- Verify webhook permissions
Next Steps
- Vercel Deployment - Deploy the main application
- Overview - General deployment information