Website Setup & Deployment
This document explains how the CRED Wiki website works, its deployment architecture, and how developers can understand and modify the setup.
Overview
The CRED Wiki is a documentation website built with MkDocs and deployed using GitHub Actions to Netlify. It features GitHub OAuth and Google SSO authentication and is accessible at https://docs.internal.credplatform.com.
The deployment process has been modernized to use GitHub Actions as the CI/CD system, with Netlify serving as a pure hosting platform. This approach provides better control, transparency, and cost efficiency.
Architecture
Components
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β GitHub Repo β β GitHub Actions β β Netlify β β DNS Provider β
β β β β β β β β
β β’ MkDocs source βββββΆβ β’ CI/CD builds βββββΆβ β’ Static hostingβββββΆβ β’ CNAME record β
β β’ OAuth config β β β’ Dependency mgmtβ β β’ CDN delivery β β β’ SSL cert β
β β’ Google SSO β β β’ Deploy to prod β β β’ Serverless β β β’ Domain proxy β
β β’ Netlify funcs β β β’ Preview deploysβ β β’ Functions β β β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
Technology Stack
- Static Site Generator: MkDocs with Material theme
- CI/CD Platform: GitHub Actions
- Deployment Platform: Netlify (hosting only)
- Authentication: GitHub OAuth 2.0 and Google SSO
- Backend Functions: Netlify Functions (Node.js)
- Domain:
docs.internal.credplatform.com
Deployment Flow
1. Source Code
- Repository: GitHub repository containing MkDocs source
- Build Command:
pip install -r requirements.txt && python -m mkdocs build - Output Directory:
site/(generated by MkDocs)
2. GitHub Actions CI/CD
- Workflow File:
.github/workflows/deploy.yml - Triggers:
- Push to
mainbranch (production deployment) - Pull requests to
mainbranch (preview deployments)
- Push to
- Build Process:
- Checkout repository code
- Setup Python 3.11 environment with pip caching
- Install dependencies from
requirements.txt - Build MkDocs site to
./sitedirectory - Setup Node.js for Netlify CLI
- Deploy to Netlify using CLI
- Environment Variables: Stored in GitHub repository secrets
- Concurrency Control: Prevents multiple deployments from running simultaneously
3. Netlify Integration
- Account Access: Netlify account registered for
dev@credinvestments.comwith Google SSO - Hosting Role: Pure static hosting and CDN delivery
- Deployment Method: GitHub Actions pushes built site via Netlify CLI
- Environment Variables:
- GitHub secrets:
NETLIFY_AUTH_TOKEN,NETLIFY_SITE_ID(for deployment) - Netlify dashboard: Authentication variables, function environment variables
- GitHub secrets:
- Functions: Serverless functions in
netlify/functions/(still hosted by Netlify)
4. DNS Configuration
- Domain:
docs.internal.credplatform.com - CNAME Record: Points to Netlify's CDN
- SSL Certificate: Automatically provisioned by Netlify
Benefits of GitHub Actions Deployment
The migration from Netlify's built-in CI/CD to GitHub Actions provides several key advantages:
Cost Efficiency
- Single Netlify Pro Account: Only one Netlify Pro account needed (no extra seats or build minutes)
- Reduced Netlify Usage: Netlify is used purely for hosting, not for build processes
- GitHub Actions: Leverages GitHub's generous free tier for CI/CD
Enhanced Control & Transparency
- Full Build Visibility: All build logic and logs live in GitHub Actions
- Centralized Configuration: Build settings managed in version-controlled workflow files
- Detailed Logging: Complete transparency into every step of the build and deployment process
- Easy Debugging: Build failures and issues are clearly visible in GitHub's interface
Advanced CI/CD Features
- Caching: GitHub Actions provides intelligent caching for dependencies and build artifacts
- Concurrency Control: Prevents multiple deployments from running simultaneously
- Custom Workflows: Full control over build steps, testing, and deployment logic
- Environment Management: Secrets and environment variables managed through GitHub's secure system
Improved Developer Experience
- Familiar Interface: Developers already use GitHub for code management
- Integrated Workflow: CI/CD runs in the same platform as code reviews and issue tracking
- Preview Deployments: Pull request previews automatically generated for testing
- Rollback Capability: Easy to revert deployments through GitHub's interface
Separation of Concerns
- GitHub: Handles source control, CI/CD, and automation
- Netlify: Focuses purely on static hosting, CDN delivery, and serverless functions
- Clear Boundaries: Each platform handles what it does best
File Structure
CREDWiki/
βββ docs/ # MkDocs source files
β βββ assets/ # Static assets
β β βββ auth.html # Login page
β β βββ auth-callback.html # OAuth callback
β β βββ google-auth-callback.html # Google OAuth callback
β β βββ auth-check.js # Authentication script
β βββ authentication/ # Auth documentation
β βββ [other content] # Wiki content
βββ netlify/ # Netlify configuration
β βββ functions/ # Serverless functions
β βββ github-oauth.js # GitHub OAuth handler
β βββ google-oauth.js # Google OAuth handler
βββ site/ # Built site (generated)
βββ mkdocs.yml # MkDocs configuration
βββ netlify.toml # Netlify configuration
βββ requirements.txt # Python dependencies
Configuration Files
mkdocs.yml
- Purpose: MkDocs site configuration
- Contains: Navigation, theme settings, plugins
- Key Sections:
nav: Site navigation structuretheme: Material theme configurationplugins: Search and other plugins
netlify.toml
- Purpose: Netlify deployment configuration
- Contains: Build settings and environment variables
- Key Settings:
- Build command and directory
- Environment variables (OAuth credentials)
- Function settings
requirements.txt
- Purpose: Python dependencies for MkDocs
- Contains: MkDocs, Material theme, plugins
DNS & Domain Setup
Current Configuration
- Domain:
docs.internal.credplatform.com - Type: CNAME record
- Target: Netlify CDN endpoint
- SSL: Automatic via Netlify
How It Works
- DNS Lookup: User visits
docs.internal.credplatform.com - CNAME Resolution: DNS returns Netlify CDN IP
- CDN Routing: Netlify routes to appropriate site
- SSL Termination: HTTPS handled by Netlify
- Content Delivery: Static files served from CDN
Development Workflow
Local Development
# Install dependencies
pip install -r requirements.txt
# Serve locally (bypasses authentication)
mkdocs serve
# Access at http://localhost:8000
Deployment Process
- Code Changes: Push to GitHub repository or create pull request
- GitHub Actions Trigger: Workflow automatically starts based on branch/event
- Build Process: GitHub Actions runs
mkdocs buildin isolated environment - Deploy: GitHub Actions pushes built site to Netlify via CLI
- CDN Update: Netlify propagates content globally
- Preview URLs: Pull requests get preview deployments for testing
Modifying the Setup
Adding New Content
- Create Markdown: Add files to
docs/directory - Update Navigation: Modify
mkdocs.ymlnav section - Commit & Push: Changes trigger GitHub Actions deployment
Changing Authentication
- Update OAuth Apps: Modify GitHub OAuth app settings and Google OAuth app settings
- Update Environment:
- Change GitHub repository secrets for deployment (
NETLIFY_AUTH_TOKEN,NETLIFY_SITE_ID) - Update Netlify dashboard environment variables for authentication
- Change GitHub repository secrets for deployment (
- Update Code: Modify authentication files if needed
Changing Domain
- Update DNS: Change CNAME record to new target
- Update OAuth: Modify GitHub OAuth app callback URL and Google OAuth app callback URL
- Update Environment: Change
GITHUB_REDIRECT_URIandGOOGLE_REDIRECT_URIin GitHub repository secrets - Update Code: Modify hardcoded URLs in auth files
Adding New Functions
- Create Function: Add to
netlify/functions/ - Update Environment: Add required environment variables to GitHub repository secrets
- Test Locally: Use
netlify devto test - Deploy: Push changes to trigger GitHub Actions deployment