|
| 1 | +# DNS Subdomain Setup Guide |
| 2 | + |
| 3 | +This guide will help you set up two subdomains for Smart AI Memory: |
| 4 | +1. **wizards.smartaimemory.com** - Software and AI wizard examples |
| 5 | +2. **healthcare.smartaimemory.com** - AI Nurse Florence dashboard |
| 6 | + |
| 7 | +## Prerequisites |
| 8 | + |
| 9 | +- Access to your domain registrar or DNS provider (where smartaimemory.com is registered) |
| 10 | +- Server IP addresses where you'll host each subdomain |
| 11 | +- SSH access to your deployment servers |
| 12 | + |
| 13 | +## Recommended Subdomain Structure |
| 14 | + |
| 15 | +``` |
| 16 | +wizards.smartaimemory.com → Software & AI wizard examples |
| 17 | +healthcare.smartaimemory.com → AI Nurse Florence dashboard |
| 18 | +``` |
| 19 | + |
| 20 | +## Step 1: Determine Your Hosting IPs |
| 21 | + |
| 22 | +First, decide where you'll deploy each subdomain. Options: |
| 23 | + |
| 24 | +### Option A: Vercel (Recommended) |
| 25 | +- Vercel provides automatic DNS for subdomains |
| 26 | +- No need for A records, use CNAME instead |
| 27 | +- Free SSL certificates |
| 28 | +- Global CDN |
| 29 | + |
| 30 | +### Option B: Railway |
| 31 | +- Railway provides a deployment URL |
| 32 | +- Use CNAME record pointing to Railway's domain |
| 33 | +- Automatic SSL |
| 34 | + |
| 35 | +### Option C: Self-Hosted VPS |
| 36 | +- You'll need the server IP address |
| 37 | +- Use A records pointing to your server IP |
| 38 | +- Example: `123.456.789.012` |
| 39 | + |
| 40 | +## Step 2: Configure DNS A Records |
| 41 | + |
| 42 | +### For Domain Registrars (Namecheap, GoDaddy, etc.) |
| 43 | + |
| 44 | +1. **Log in to your domain registrar** |
| 45 | + - Go to your domain management panel |
| 46 | + - Find "DNS Management" or "Advanced DNS" |
| 47 | + |
| 48 | +2. **Add A Records for each subdomain** |
| 49 | + |
| 50 | + **For wizards subdomain:** |
| 51 | + ``` |
| 52 | + Type: A Record |
| 53 | + Host: wizards |
| 54 | + Value: [Your server IP or use CNAME for Vercel/Railway] |
| 55 | + TTL: 3600 (1 hour) or Auto |
| 56 | + ``` |
| 57 | + |
| 58 | + **For healthcare subdomain:** |
| 59 | + ``` |
| 60 | + Type: A Record |
| 61 | + Host: healthcare |
| 62 | + Value: [Your server IP or use CNAME for Vercel/Railway] |
| 63 | + TTL: 3600 (1 hour) or Auto |
| 64 | + ``` |
| 65 | + |
| 66 | +3. **Alternative: CNAME Records (for Vercel/Railway)** |
| 67 | + |
| 68 | + **For wizards subdomain:** |
| 69 | + ``` |
| 70 | + Type: CNAME Record |
| 71 | + Host: wizards |
| 72 | + Value: cname.vercel-dns.com (or your Railway domain) |
| 73 | + TTL: 3600 (1 hour) or Auto |
| 74 | + ``` |
| 75 | + |
| 76 | + **For healthcare subdomain:** |
| 77 | + ``` |
| 78 | + Type: CNAME Record |
| 79 | + Host: healthcare |
| 80 | + Value: cname.vercel-dns.com (or your Railway domain) |
| 81 | + TTL: 3600 (1 hour) or Auto |
| 82 | + ``` |
| 83 | + |
| 84 | +### Example DNS Configuration (A Records) |
| 85 | + |
| 86 | +If your server IP is `192.0.2.100`: |
| 87 | + |
| 88 | +| Type | Host | Value | TTL | |
| 89 | +|------|------------|----------------|------| |
| 90 | +| A | wizards | 192.0.2.100 | 3600 | |
| 91 | +| A | healthcare | 192.0.2.100 | 3600 | |
| 92 | + |
| 93 | +### Example DNS Configuration (CNAME Records for Vercel) |
| 94 | + |
| 95 | +| Type | Host | Value | TTL | |
| 96 | +|-------|------------|------------------------------------|------| |
| 97 | +| CNAME | wizards | cname.vercel-dns.com | 3600 | |
| 98 | +| CNAME | healthcare | cname.vercel-dns.com | 3600 | |
| 99 | + |
| 100 | +## Step 3: Deploy Each Subdomain |
| 101 | + |
| 102 | +### Option 1: Vercel Deployment (Recommended) |
| 103 | + |
| 104 | +1. **Deploy wizards subdomain:** |
| 105 | + ```bash |
| 106 | + cd website # or wherever your wizards app is |
| 107 | + vercel --prod |
| 108 | + ``` |
| 109 | + |
| 110 | +2. **Add custom domain in Vercel dashboard:** |
| 111 | + - Go to your project settings |
| 112 | + - Navigate to "Domains" |
| 113 | + - Add `wizards.smartaimemory.com` |
| 114 | + - Vercel will provide DNS instructions |
| 115 | + |
| 116 | +3. **Repeat for healthcare subdomain:** |
| 117 | + ```bash |
| 118 | + cd healthcare-dashboard # your healthcare app |
| 119 | + vercel --prod |
| 120 | + ``` |
| 121 | + - Add `healthcare.smartaimemory.com` in Vercel dashboard |
| 122 | + |
| 123 | +### Option 2: Railway Deployment |
| 124 | + |
| 125 | +1. **Deploy wizards subdomain:** |
| 126 | + ```bash |
| 127 | + cd wizards-app |
| 128 | + railway init |
| 129 | + railway up |
| 130 | + ``` |
| 131 | + |
| 132 | +2. **Add custom domain in Railway dashboard:** |
| 133 | + - Go to your project settings |
| 134 | + - Add custom domain: `wizards.smartaimemory.com` |
| 135 | + - Railway will provide CNAME value |
| 136 | + |
| 137 | +3. **Repeat for healthcare subdomain** |
| 138 | + |
| 139 | +### Option 3: Self-Hosted VPS |
| 140 | + |
| 141 | +1. **Set up Nginx virtual hosts:** |
| 142 | + |
| 143 | + Create `/etc/nginx/sites-available/wizards.smartaimemory.com`: |
| 144 | + ```nginx |
| 145 | + server { |
| 146 | + listen 80; |
| 147 | + server_name wizards.smartaimemory.com; |
| 148 | +
|
| 149 | + location / { |
| 150 | + proxy_pass http://localhost:3001; # Wizards app port |
| 151 | + proxy_http_version 1.1; |
| 152 | + proxy_set_header Upgrade $http_upgrade; |
| 153 | + proxy_set_header Connection 'upgrade'; |
| 154 | + proxy_set_header Host $host; |
| 155 | + proxy_cache_bypass $http_upgrade; |
| 156 | + } |
| 157 | + } |
| 158 | + ``` |
| 159 | + |
| 160 | + Create `/etc/nginx/sites-available/healthcare.smartaimemory.com`: |
| 161 | + ```nginx |
| 162 | + server { |
| 163 | + listen 80; |
| 164 | + server_name healthcare.smartaimemory.com; |
| 165 | +
|
| 166 | + location / { |
| 167 | + proxy_pass http://localhost:3002; # Healthcare app port |
| 168 | + proxy_http_version 1.1; |
| 169 | + proxy_set_header Upgrade $http_upgrade; |
| 170 | + proxy_set_header Connection 'upgrade'; |
| 171 | + proxy_set_header Host $host; |
| 172 | + proxy_cache_bypass $http_upgrade; |
| 173 | + } |
| 174 | + } |
| 175 | + ``` |
| 176 | + |
| 177 | +2. **Enable the sites:** |
| 178 | + ```bash |
| 179 | + sudo ln -s /etc/nginx/sites-available/wizards.smartaimemory.com /etc/nginx/sites-enabled/ |
| 180 | + sudo ln -s /etc/nginx/sites-available/healthcare.smartaimemory.com /etc/nginx/sites-enabled/ |
| 181 | + sudo nginx -t |
| 182 | + sudo systemctl reload nginx |
| 183 | + ``` |
| 184 | + |
| 185 | +3. **Set up SSL with Let's Encrypt:** |
| 186 | + ```bash |
| 187 | + sudo certbot --nginx -d wizards.smartaimemory.com -d healthcare.smartaimemory.com |
| 188 | + ``` |
| 189 | + |
| 190 | +## Step 4: Verify DNS Propagation |
| 191 | + |
| 192 | +DNS changes can take 1-48 hours to propagate, but often work within minutes. |
| 193 | + |
| 194 | +**Check DNS propagation:** |
| 195 | +```bash |
| 196 | +# Check A records |
| 197 | +dig wizards.smartaimemory.com +short |
| 198 | +dig healthcare.smartaimemory.com +short |
| 199 | + |
| 200 | +# Check CNAME records |
| 201 | +dig wizards.smartaimemory.com CNAME +short |
| 202 | +dig healthcare.smartaimemory.com CNAME +short |
| 203 | +``` |
| 204 | + |
| 205 | +**Online tools:** |
| 206 | +- https://dnschecker.org |
| 207 | +- https://www.whatsmydns.net |
| 208 | + |
| 209 | +## Step 5: Deploy Your Applications |
| 210 | + |
| 211 | +### Wizards Subdomain (Software & AI Examples) |
| 212 | + |
| 213 | +Create a separate Next.js app or static site for wizard examples: |
| 214 | + |
| 215 | +```bash |
| 216 | +npx create-next-app@latest wizards-showcase |
| 217 | +cd wizards-showcase |
| 218 | +# Build your wizards example site |
| 219 | +npm run build |
| 220 | +``` |
| 221 | + |
| 222 | +Deploy to your chosen platform (Vercel/Railway/VPS) |
| 223 | + |
| 224 | +### Healthcare Subdomain (AI Nurse Florence) |
| 225 | + |
| 226 | +Deploy your existing healthcare dashboard: |
| 227 | + |
| 228 | +```bash |
| 229 | +cd healthcare-dashboard |
| 230 | +# Update environment variables for production |
| 231 | +# Build and deploy |
| 232 | +npm run build |
| 233 | +``` |
| 234 | + |
| 235 | +## Quick Start: Using Vercel (Fastest for Tonight) |
| 236 | + |
| 237 | +1. **Install Vercel CLI:** |
| 238 | + ```bash |
| 239 | + npm install -g vercel |
| 240 | + vercel login |
| 241 | + ``` |
| 242 | + |
| 243 | +2. **Deploy wizards app:** |
| 244 | + ```bash |
| 245 | + cd wizards-app |
| 246 | + vercel --prod |
| 247 | + # Follow prompts, then add custom domain in Vercel dashboard |
| 248 | + ``` |
| 249 | + |
| 250 | +3. **Deploy healthcare app:** |
| 251 | + ```bash |
| 252 | + cd healthcare-dashboard |
| 253 | + vercel --prod |
| 254 | + # Add custom domain in Vercel dashboard |
| 255 | + ``` |
| 256 | + |
| 257 | +4. **Add domains in Vercel dashboard:** |
| 258 | + - Go to each project → Settings → Domains |
| 259 | + - Add `wizards.smartaimemory.com` and `healthcare.smartaimemory.com` |
| 260 | + - Vercel will show you CNAME records to add to your DNS |
| 261 | + |
| 262 | +5. **Add CNAME records in your DNS provider:** |
| 263 | + - Copy the CNAME values from Vercel |
| 264 | + - Add them to your DNS settings (as shown in Step 2) |
| 265 | + |
| 266 | +6. **Wait for verification:** |
| 267 | + - Vercel will automatically verify and provision SSL |
| 268 | + - Usually takes 1-5 minutes |
| 269 | + |
| 270 | +## Troubleshooting |
| 271 | + |
| 272 | +### DNS Not Resolving |
| 273 | + |
| 274 | +- **Check TTL**: Low TTL (300-3600) propagates faster |
| 275 | +- **Clear DNS cache**: `sudo dscacheutil -flushcache` (macOS) or `ipconfig /flushdns` (Windows) |
| 276 | +- **Wait**: Sometimes takes 1-24 hours |
| 277 | + |
| 278 | +### SSL Certificate Issues |
| 279 | + |
| 280 | +- **Vercel/Railway**: Automatic, no action needed |
| 281 | +- **Let's Encrypt**: Run `sudo certbot renew` if expired |
| 282 | +- **Verify ports**: Port 80 and 443 must be open |
| 283 | + |
| 284 | +### App Not Loading |
| 285 | + |
| 286 | +- **Check deployment**: Verify app is running on correct port |
| 287 | +- **Check Nginx config**: `sudo nginx -t` |
| 288 | +- **Check logs**: `sudo journalctl -u nginx -f` |
| 289 | + |
| 290 | +## Environment Variables for Subdomains |
| 291 | + |
| 292 | +### wizards.smartaimemory.com |
| 293 | + |
| 294 | +```bash |
| 295 | +NEXT_PUBLIC_SITE_URL=https://wizards.smartaimemory.com |
| 296 | +NEXT_PUBLIC_PLAUSIBLE_DOMAIN=wizards.smartaimemory.com |
| 297 | +``` |
| 298 | + |
| 299 | +### healthcare.smartaimemory.com |
| 300 | + |
| 301 | +```bash |
| 302 | +NEXT_PUBLIC_SITE_URL=https://healthcare.smartaimemory.com |
| 303 | +NEXT_PUBLIC_PLAUSIBLE_DOMAIN=healthcare.smartaimemory.com |
| 304 | +``` |
| 305 | + |
| 306 | +## Security Checklist |
| 307 | + |
| 308 | +- [ ] SSL certificates installed (automatic with Vercel/Railway) |
| 309 | +- [ ] HTTPS redirect enabled |
| 310 | +- [ ] CORS configured if APIs are used |
| 311 | +- [ ] Environment variables secured |
| 312 | +- [ ] No hardcoded secrets in code |
| 313 | + |
| 314 | +## Next Steps After Deployment |
| 315 | + |
| 316 | +1. Update main website to link to subdomains |
| 317 | +2. Add subdomain links to navigation |
| 318 | +3. Update sitemap to include subdomain pages |
| 319 | +4. Test all functionality on each subdomain |
| 320 | +5. Monitor analytics for each subdomain separately |
| 321 | + |
| 322 | +## Need Help? |
| 323 | + |
| 324 | +If you encounter issues: |
| 325 | +- Check Vercel/Railway documentation |
| 326 | +- Verify DNS with `dig` or online tools |
| 327 | +- Contact your DNS provider support |
| 328 | +- Email: patrick.roebuck@pm.me |
| 329 | + |
| 330 | +--- |
| 331 | + |
| 332 | +**Estimated Time to Deploy Tonight:** |
| 333 | +- Vercel (CNAME): 10-30 minutes |
| 334 | +- Railway (CNAME): 10-30 minutes |
| 335 | +- Self-hosted (A records): 30-60 minutes + DNS propagation time |
| 336 | + |
| 337 | +**Recommended: Use Vercel for fastest deployment tonight.** |
0 commit comments