Deployment Plan & Summary

🎯 Deployment Status: READY FOR PRODUCTION

All deployment files have been created and tested locally. The site is ready to be deployed to production server 31.97.61.154.


πŸ“¦ What Was Created

Docker Configuration

  • βœ… Dockerfile - Multi-stage build (Ruby β†’ Jekyll β†’ Nginx)
  • βœ… nginx.conf - Production Nginx configuration with caching and security
  • βœ… docker-compose.prod.yml - Complete Traefik integration with OAuth2

Environment & Secrets

  • βœ… .env.prod.example - Template for environment variables
  • βœ… .gitignore - Updated to exclude .env.prod

Deployment Tools

  • βœ… deploy-prod.sh - Automated deployment script (executable)

Documentation

  • βœ… DEPLOYMENT.md - Complete deployment guide
  • βœ… DEPLOYMENT-SUMMARY.md - This file

Updated Files

  • βœ… assets/js/auth.js - Updated for oauth2-proxy authentication
  • βœ… README.md - Enhanced with full documentation

πŸ—οΈ Architecture

Internet (HTTPS)
       ↓
  Traefik Proxy
  (31.97.61.154)
       ↓
  β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  ↓                       ↓
OAuth2-Proxy          Nginx Container
(GitHub Auth)         (Static Jekyll Site)
       ↓                       ↓
Protected Routes       Public Routes

Routing Configuration

URL Authentication Handled By
https://www.aisforagent.net/ Public Nginx
https://www.aisforagent.net/portal/* GitHub OAuth OAuth2-Proxy β†’ Nginx
https://www.aisforagent.net/workflows/* GitHub OAuth OAuth2-Proxy β†’ Nginx
https://www.aisforagent.net/blueprints/* GitHub OAuth OAuth2-Proxy β†’ Nginx
https://www.aisforagent.net/playbooks/* GitHub OAuth OAuth2-Proxy β†’ Nginx
https://www.aisforagent.net/oauth2/* Public OAuth2-Proxy

πŸš€ Pre-Deployment Checklist

1. GitHub OAuth App Setup

  • Create GitHub OAuth App at: https://github.com/settings/developers
  • Set Application name: A is for Agent
  • Set Homepage URL: https://www.aisforagent.net
  • Set Authorization callback URL: https://www.aisforagent.net/oauth2/callback
  • Note the Client ID and Client Secret

2. Environment Configuration

  • Copy .env.prod.example to .env.prod
  • Add GitHub OAuth Client ID to .env.prod
  • Add GitHub OAuth Client Secret to .env.prod
  • Generate cookie secret: openssl rand -base64 32
  • Add cookie secret to .env.prod
  • (Optional) Configure access restrictions (specific users/orgs)

3. DNS Configuration

  • Verify DNS: dig www.aisforagent.net +short β†’ Should return 31.97.61.154
  • Verify DNS: dig aisforagent.net +short β†’ Should return 31.97.61.154
  • Allow time for DNS propagation if recently changed (5-60 minutes)

4. SSH Access

  • Verify SSH key exists at ~/git/Foundry/S6web/key.file
  • Add SSH key to agent: ssh-add ~/git/Foundry/S6web/key.file
  • Test SSH connection: ssh root@31.97.61.154

5. Server Prerequisites

  • Confirm Traefik is running
  • Confirm traefik-public network exists
  • Confirm middleware file exists at ~/traefik/middlewares.yml
  • Confirm ports 80 and 443 are accessible

🎬 Deployment Steps

Quick Deploy

# 1. Ensure you're in the project directory
cd ~/git/a/Foundry/aWebsite

# 2. Verify .env.prod is configured
cat .env.prod  # Should show your actual credentials, not placeholders

# 3. Run deployment script
./deploy-prod.sh

# The script will:
# - Build the Docker image
# - Test it locally
# - Transfer files to server
# - Build and deploy on server
# - Verify the deployment

Expected Output

═══════════════════════════════════════════════════
  A is for Agent - Production Deployment
═══════════════════════════════════════════════════

β„Ή Mode: Full Deployment (Build + Deploy)
β„Ή Step 1/6: Building image locally...
βœ“ Docker image built successfully
β„Ή Step 2/6: Testing image...
βœ“ Image health check passed
β„Ή Step 3/6: Preparing remote server...
βœ“ Remote directory ready
β„Ή Step 4/6: Transferring files...
βœ“ Files transferred successfully
β„Ή Step 5/6: Deploying...
βœ“ Containers deployed
β„Ή Step 6/6: Verifying...
βœ“ Site is accessible at https://www.aisforagent.net

βœ“ ═══════════════════════════════════════════════════
βœ“   Deployment Complete!
βœ“ ═══════════════════════════════════════════════════

Website: https://www.aisforagent.net
Portal:  https://www.aisforagent.net/portal/

βœ… Post-Deployment Verification

1. Check Containers

ssh root@31.97.61.154 "docker ps | grep aifa"

Expected:

aifa-site            Up X minutes (healthy)
aifa-oauth2-proxy    Up X minutes (healthy)

2. Test Public Access

# Homepage
curl -I https://www.aisforagent.net
# Expected: 200 OK

# Health endpoint
curl https://www.aisforagent.net/health
# Expected: healthy

3. Test Authentication

# OAuth userinfo (unauthenticated)
curl -I https://www.aisforagent.net/oauth2/userinfo
# Expected: 401 Unauthorized

# Protected portal (should redirect)
curl -I https://www.aisforagent.net/portal/
# Expected: 302/303 redirect to GitHub

4. Browser Testing

  1. Public Homepage:
    • Visit: https://www.aisforagent.net
    • Should display homepage with β€œDownload A is for Agent” CTA
    • No login required
  2. Authentication Flow:
    • Click link to /portal/
    • Should redirect to GitHub OAuth
    • Log in with GitHub account
    • Should redirect back to portal page
  3. Authenticated Experience:
    • After GitHub login, return to homepage
    • CTA should now show β€œExplore Premium Services”
    • Portal, workflows, blueprints, and playbooks should be accessible without further login
  4. SSL Certificate:
    • Click padlock in browser
    • Should show valid Let’s Encrypt certificate
    • Certificate should be for www.aisforagent.net

5. Check Logs

# Site logs
ssh root@31.97.61.154 "docker logs --tail 50 aifa-site"

# OAuth2-Proxy logs
ssh root@31.97.61.154 "docker logs --tail 50 aifa-oauth2-proxy"

# Traefik logs (for routing issues)
ssh root@31.97.61.154 "docker logs --tail 50 traefik | grep aifa"

πŸ”§ Common Issues & Solutions

Issue: .env.prod still has placeholder values

Solution:

# Edit .env.prod with real credentials
nano .env.prod

# Should look like:
# OAUTH2_PROXY_CLIENT_ID=abc123def456
# OAUTH2_PROXY_CLIENT_SECRET=secret789xyz
# OAUTH2_PROXY_COOKIE_SECRET=ABCDEFGHabcdefgh1234567890ABCDEF==

Issue: SSH connection fails

Solution:

# Add SSH key to agent
ssh-add ~/git/Foundry/S6web/key.file

# Verify it's added
ssh-add -l

# Test connection
ssh root@31.97.61.154 "echo 'Connection successful'"

Issue: DNS not resolving

Solution:

# Check DNS
dig www.aisforagent.net +short

# If wrong or missing, update DNS A record to point to 31.97.61.154
# Wait 5-60 minutes for propagation

Issue: Containers not starting

Solution:

# SSH to server
ssh root@31.97.61.154

# Check container status
docker ps -a | grep aifa

# Check logs for errors
docker logs aifa-site
docker logs aifa-oauth2-proxy

# Restart if needed
cd ~/aifa-website
docker-compose -f docker-compose.prod.yml restart

Issue: Site shows 404 or 503

Solution:

# Verify Traefik sees the service
ssh root@31.97.61.154 "docker logs traefik 2>&1 | grep aifa"

# Verify network connectivity
ssh root@31.97.61.154 "docker network inspect traefik-public | grep aifa-site"

# Check Traefik labels
ssh root@31.97.61.154 "docker inspect aifa-site | grep -A 30 'traefik'"

# If still issues, restart Traefik to reload config
ssh root@31.97.61.154 "docker restart traefik"

Issue: OAuth redirects to wrong URL

Solution:

  1. Check GitHub OAuth App settings
  2. Verify callback URL is exactly: https://www.aisforagent.net/oauth2/callback
  3. Update .env.prod if needed:
    OAUTH2_PROXY_REDIRECT_URL="https://www.aisforagent.net/oauth2/callback"
    
  4. Restart oauth2-proxy:
    ssh root@31.97.61.154 "docker restart aifa-oauth2-proxy"
    

Issue: CTA not switching after login

Solution:

  1. Open browser console (F12)
  2. Check for JavaScript errors
  3. Verify /oauth2/userinfo endpoint works:
    curl -I https://www.aisforagent.net/oauth2/userinfo
    # Should return 401 (not 404)
    
  4. Clear browser cache and cookies
  5. Try logging in again

πŸ“Š Resource Usage

Current configuration allocates:

Service CPU Limit Memory Limit CPU Reserved Memory Reserved
aifa-site 0.5 core 512MB 0.25 core 256MB
aifa-oauth2-proxy 0.25 core 256MB 0.1 core 128MB

Total: 0.75 CPU cores, 768MB RAM

Monitor with:

ssh root@31.97.61.154 "docker stats aifa-site aifa-oauth2-proxy"

πŸ”„ Updating the Site

After initial deployment, to update content:

# 1. Make your changes locally
git pull origin main  # or edit files

# 2. Test locally if desired
bundle exec jekyll serve

# 3. Deploy
./deploy-prod.sh

# The script will rebuild and redeploy automatically

πŸ›‘οΈ Security Notes

  1. .env.prod contains secrets - Never commit to Git
  2. Rotate OAuth secrets regularly
  3. Restrict GitHub access if needed:
    # In .env.prod, add:
    OAUTH2_PROXY_GITHUB_USERS=username1,username2
    # or
    OAUTH2_PROXY_GITHUB_ORG=your-org-name
    
  4. Monitor access logs:
    ssh root@31.97.61.154 "docker logs -f aifa-oauth2-proxy"
    
  5. SSL certificates auto-renew via Traefik/Let’s Encrypt

πŸ“ž Quick Reference Commands

# View site logs
ssh root@31.97.61.154 "docker logs -f aifa-site"

# View auth logs
ssh root@31.97.61.154 "docker logs -f aifa-oauth2-proxy"

# Restart services
ssh root@31.97.61.154 "cd ~/aifa-website && docker-compose -f docker-compose.prod.yml restart"

# Check container health
ssh root@31.97.61.154 "docker ps | grep aifa"

# Monitor resources
ssh root@31.97.61.154 "docker stats aifa-site aifa-oauth2-proxy"

# Stop site
ssh root@31.97.61.154 "cd ~/aifa-website && docker-compose -f docker-compose.prod.yml down"

# Redeploy
./deploy-prod.sh


✨ Next Steps After Deployment

  1. Test all features:
    • Public pages loading correctly
    • Authentication flow working
    • Protected pages accessible after login
    • CTA switching after login
  2. Monitor for 24 hours:
    • Check logs for errors
    • Monitor resource usage
    • Verify SSL certificate issued correctly
  3. Share access (optional):
    • Add specific GitHub users to .env.prod
    • Or create GitHub org and restrict access
  4. Set up monitoring (optional):
    • Add uptime monitoring (e.g., UptimeRobot)
    • Set up log aggregation if needed
    • Configure alerting for downtime
  5. Update content:
    • Add more blog posts
    • Expand documentation
    • Add workflow examples

Status: βœ… READY TO DEPLOY
Created: 2025-10-11
Last Updated: 2025-10-11