|
| 1 | +# Custom Domain Setup: ocpp.sankalpnarula.com |
| 2 | + |
| 3 | +## π― **Goal** |
| 4 | +Configure `ocpp.sankalpnarula.com` as the custom domain for your OCPP Chaos Simulator frontend deployed on Cloudflare Workers. |
| 5 | + |
| 6 | +## β
**Configuration Complete** |
| 7 | +Your `wrangler.toml` is already configured with: |
| 8 | +```toml |
| 9 | +[[env.production.routes]] |
| 10 | +pattern = "ocpp.sankalpnarula.com/*" |
| 11 | +zone_name = "sankalpnarula.com" |
| 12 | +``` |
| 13 | + |
| 14 | +## π§ **Setup Methods** |
| 15 | + |
| 16 | +### **Method 1: Automatic (Recommended)** |
| 17 | + |
| 18 | +When you deploy via GitHub Actions, Wrangler will automatically: |
| 19 | +1. Create the subdomain route |
| 20 | +2. Configure SSL certificates |
| 21 | +3. Set up the custom domain |
| 22 | + |
| 23 | +**No manual steps required!** π |
| 24 | + |
| 25 | +### **Method 2: Manual Dashboard Setup** |
| 26 | + |
| 27 | +If you prefer manual control: |
| 28 | + |
| 29 | +#### **Step 1: Cloudflare DNS** |
| 30 | +1. Go to **Cloudflare Dashboard** β `sankalpnarula.com` |
| 31 | +2. Navigate to **DNS** β **Records** |
| 32 | +3. **Add record**: |
| 33 | + ``` |
| 34 | + Type: CNAME |
| 35 | + Name: ocpp |
| 36 | + Target: ocpp-chaos-simulator.YOUR_SUBDOMAIN.workers.dev |
| 37 | + Proxy: Enabled (π§‘) |
| 38 | + TTL: Auto |
| 39 | + ``` |
| 40 | + |
| 41 | +#### **Step 2: Workers Custom Domain** |
| 42 | +1. **Workers & Pages** β **ocpp-chaos-simulator** |
| 43 | +2. **Settings** β **Triggers** β **Custom Domains** |
| 44 | +3. **Add Custom Domain**: `ocpp.sankalpnarula.com` |
| 45 | +4. **Activate** |
| 46 | + |
| 47 | +## π **Deployment Process** |
| 48 | + |
| 49 | +### **GitHub Actions (Automatic)** |
| 50 | +```bash |
| 51 | +# Your current workflow will: |
| 52 | +1. Build frontend β npm run build:cloudflare |
| 53 | +2. Deploy to Workers β wrangler deploy |
| 54 | +3. Configure domain β ocpp.sankalpnarula.com |
| 55 | +4. Report success β GitHub Actions summary |
| 56 | +``` |
| 57 | + |
| 58 | +### **Manual Deployment** |
| 59 | +```bash |
| 60 | +# Local deployment (if needed) |
| 61 | +cd frontend |
| 62 | +npm run build:cloudflare |
| 63 | +npm run deploy |
| 64 | + |
| 65 | +# Or step by step |
| 66 | +wrangler login |
| 67 | +wrangler deploy |
| 68 | +``` |
| 69 | + |
| 70 | +## π **Domain Architecture** |
| 71 | + |
| 72 | +``` |
| 73 | +sankalpnarula.com (Main domain) |
| 74 | +βββ www.sankalpnarula.com (Your main site) |
| 75 | +βββ api.sankalpnarula.com (Potential backend) |
| 76 | +βββ ocpp.sankalpnarula.com (OCPP Simulator) β NEW |
| 77 | +``` |
| 78 | + |
| 79 | +## π **Expected Results** |
| 80 | + |
| 81 | +### **β
Success Indicators** |
| 82 | +- Frontend accessible at: `https://ocpp.sankalpnarula.com` |
| 83 | +- SSL certificate automatically provisioned |
| 84 | +- Cloudflare global CDN enabled |
| 85 | +- Worker deployment in all Cloudflare edge locations |
| 86 | + |
| 87 | +### **π Performance Benefits** |
| 88 | +- **Global Edge**: Deployed to 200+ locations worldwide |
| 89 | +- **SSL/TLS**: Automatic HTTPS with Cloudflare certificates |
| 90 | +- **Caching**: Static assets cached at edge |
| 91 | +- **Speed**: Sub-100ms response times globally |
| 92 | + |
| 93 | +## π οΈ **Configuration Details** |
| 94 | + |
| 95 | +### **Current wrangler.toml** |
| 96 | +```toml |
| 97 | +name = "ocpp-chaos-simulator" |
| 98 | +main = "_worker.js" |
| 99 | +compatibility_date = "2024-01-15" |
| 100 | + |
| 101 | +[build] |
| 102 | +command = "npx @cloudflare/next-on-pages" |
| 103 | + |
| 104 | +[env.production] |
| 105 | +compatibility_flags = ["nodejs_compat"] |
| 106 | + |
| 107 | +[[env.production.routes]] |
| 108 | +pattern = "ocpp.sankalpnarula.com/*" |
| 109 | +zone_name = "sankalpnarula.com" |
| 110 | +``` |
| 111 | + |
| 112 | +### **GitHub Actions Integration** |
| 113 | +Your deployment summary will show: |
| 114 | +``` |
| 115 | +β
Frontend (Cloudflare Workers) |
| 116 | +- Status: Deployed successfully |
| 117 | +- Platform: Cloudflare Workers |
| 118 | +- Domain: https://ocpp.sankalpnarula.com |
| 119 | +``` |
| 120 | + |
| 121 | +## π **Verification Steps** |
| 122 | + |
| 123 | +### **1. DNS Propagation** |
| 124 | +```bash |
| 125 | +# Check DNS resolution |
| 126 | +dig ocpp.sankalpnarula.com |
| 127 | + |
| 128 | +# Expected: CNAME record pointing to Cloudflare Workers |
| 129 | +``` |
| 130 | + |
| 131 | +### **2. SSL Certificate** |
| 132 | +```bash |
| 133 | +# Check SSL certificate |
| 134 | +curl -I https://ocpp.sankalpnarula.com |
| 135 | + |
| 136 | +# Expected: HTTP/2 200 with Cloudflare SSL |
| 137 | +``` |
| 138 | + |
| 139 | +### **3. Worker Response** |
| 140 | +```bash |
| 141 | +# Test the application |
| 142 | +curl https://ocpp.sankalpnarula.com |
| 143 | + |
| 144 | +# Expected: Your Next.js application HTML |
| 145 | +``` |
| 146 | + |
| 147 | +## π― **Next Steps After Deployment** |
| 148 | + |
| 149 | +1. **β
Push to main** β Triggers automatic deployment |
| 150 | +2. **π Verify domain** β Check `https://ocpp.sankalpnarula.com` |
| 151 | +3. **π Monitor performance** β Cloudflare Analytics |
| 152 | +4. **π§ Configure features** β Add environment variables if needed |
| 153 | + |
| 154 | +## π¨ **Troubleshooting** |
| 155 | + |
| 156 | +### **Domain Not Working?** |
| 157 | +1. Check DNS propagation: `dig ocpp.sankalpnarula.com` |
| 158 | +2. Verify Cloudflare proxy is enabled (π§‘) |
| 159 | +3. Check Workers deployment status in dashboard |
| 160 | + |
| 161 | +### **SSL Issues?** |
| 162 | +1. Ensure domain is proxied through Cloudflare |
| 163 | +2. Check SSL/TLS encryption mode is "Full (strict)" |
| 164 | +3. Wait 10-15 minutes for certificate provisioning |
| 165 | + |
| 166 | +### **Deployment Failures?** |
| 167 | +1. Verify `CLOUDFLARE_API_TOKEN` has Workers:Edit permissions |
| 168 | +2. Check `CLOUDFLARE_ACCOUNT_ID` is correct |
| 169 | +3. Ensure domain is added to your Cloudflare account |
| 170 | + |
| 171 | +Your subdomain will be live at **`https://ocpp.sankalpnarula.com`** after the next deployment! π |
0 commit comments