|
| 1 | +# Railway Subdomain Deployment Guide |
| 2 | + |
| 3 | +Quick guide to deploy your two subdomains on Railway tonight: |
| 4 | +- **wizards.smartaimemory.com** - Software & AI wizard examples |
| 5 | +- **healthcare.smartaimemory.com** - AI Nurse Florence dashboard |
| 6 | + |
| 7 | +## Step 1: Install Railway CLI |
| 8 | + |
| 9 | +```bash |
| 10 | +npm install -g @railway/cli |
| 11 | +``` |
| 12 | + |
| 13 | +## Step 2: Login to Railway |
| 14 | + |
| 15 | +```bash |
| 16 | +railway login |
| 17 | +``` |
| 18 | + |
| 19 | +This will open a browser window for authentication. |
| 20 | + |
| 21 | +## Step 3: Deploy Wizards Subdomain |
| 22 | + |
| 23 | +### 3.1 Navigate to your wizards app directory |
| 24 | + |
| 25 | +```bash |
| 26 | +cd /path/to/wizards-showcase |
| 27 | +# Or if using the main website directory: |
| 28 | +cd /Users/patrickroebuck/empathy_11_6_2025/Empathy-framework/website |
| 29 | +``` |
| 30 | + |
| 31 | +### 3.2 Initialize Railway project |
| 32 | + |
| 33 | +```bash |
| 34 | +railway init |
| 35 | +``` |
| 36 | + |
| 37 | +When prompted: |
| 38 | +- **Project name**: `smartaimemory-wizards` |
| 39 | +- **Environment**: `production` |
| 40 | + |
| 41 | +### 3.3 Set environment variables |
| 42 | + |
| 43 | +```bash |
| 44 | +railway variables set NEXT_PUBLIC_SITE_URL=https://wizards.smartaimemory.com |
| 45 | +railway variables set NEXT_PUBLIC_PLAUSIBLE_DOMAIN=wizards.smartaimemory.com |
| 46 | +railway variables set SENDGRID_API_KEY=your_sendgrid_api_key_here |
| 47 | +railway variables set [email protected] |
| 48 | +railway variables set [email protected] |
| 49 | +railway variables set NODE_ENV=production |
| 50 | +``` |
| 51 | + |
| 52 | +### 3.4 Deploy to Railway |
| 53 | + |
| 54 | +```bash |
| 55 | +railway up |
| 56 | +``` |
| 57 | + |
| 58 | +### 3.5 Add custom domain in Railway dashboard |
| 59 | + |
| 60 | +1. Go to https://railway.app/dashboard |
| 61 | +2. Select your `smartaimemory-wizards` project |
| 62 | +3. Click on "Settings" tab |
| 63 | +4. Scroll to "Domains" section |
| 64 | +5. Click "Add Custom Domain" |
| 65 | +6. Enter: `wizards.smartaimemory.com` |
| 66 | +7. Railway will show you a CNAME record to add to your DNS |
| 67 | + |
| 68 | +**Railway will provide something like:** |
| 69 | +``` |
| 70 | +CNAME: wizards → your-project.up.railway.app |
| 71 | +``` |
| 72 | + |
| 73 | +## Step 4: Deploy Healthcare Subdomain |
| 74 | + |
| 75 | +### 4.1 Navigate to healthcare dashboard directory |
| 76 | + |
| 77 | +```bash |
| 78 | +cd /path/to/healthcare-dashboard |
| 79 | +``` |
| 80 | + |
| 81 | +### 4.2 Initialize Railway project |
| 82 | + |
| 83 | +```bash |
| 84 | +railway init |
| 85 | +``` |
| 86 | + |
| 87 | +When prompted: |
| 88 | +- **Project name**: `smartaimemory-healthcare` |
| 89 | +- **Environment**: `production` |
| 90 | + |
| 91 | +### 4.3 Set environment variables |
| 92 | + |
| 93 | +```bash |
| 94 | +railway variables set NEXT_PUBLIC_SITE_URL=https://healthcare.smartaimemory.com |
| 95 | +railway variables set NEXT_PUBLIC_PLAUSIBLE_DOMAIN=healthcare.smartaimemory.com |
| 96 | +railway variables set SENDGRID_API_KEY=your_sendgrid_api_key_here |
| 97 | +railway variables set [email protected] |
| 98 | +railway variables set [email protected] |
| 99 | +railway variables set NODE_ENV=production |
| 100 | +# Add any healthcare-specific environment variables |
| 101 | +``` |
| 102 | + |
| 103 | +### 4.4 Deploy to Railway |
| 104 | + |
| 105 | +```bash |
| 106 | +railway up |
| 107 | +``` |
| 108 | + |
| 109 | +### 4.5 Add custom domain in Railway dashboard |
| 110 | + |
| 111 | +1. Go to https://railway.app/dashboard |
| 112 | +2. Select your `smartaimemory-healthcare` project |
| 113 | +3. Click on "Settings" tab |
| 114 | +4. Scroll to "Domains" section |
| 115 | +5. Click "Add Custom Domain" |
| 116 | +6. Enter: `healthcare.smartaimemory.com` |
| 117 | +7. Railway will show you the CNAME record |
| 118 | + |
| 119 | +## Step 5: Configure DNS (CNAME Records) |
| 120 | + |
| 121 | +Log in to your DNS provider (where smartaimemory.com is registered) and add these CNAME records: |
| 122 | + |
| 123 | +### For Wizards Subdomain |
| 124 | + |
| 125 | +``` |
| 126 | +Type: CNAME |
| 127 | +Host: wizards |
| 128 | +Value: [your-wizards-project].up.railway.app |
| 129 | +TTL: 3600 (or Auto) |
| 130 | +``` |
| 131 | + |
| 132 | +### For Healthcare Subdomain |
| 133 | + |
| 134 | +``` |
| 135 | +Type: CNAME |
| 136 | +Host: healthcare |
| 137 | +Value: [your-healthcare-project].up.railway.app |
| 138 | +TTL: 3600 (or Auto) |
| 139 | +``` |
| 140 | + |
| 141 | +**Example DNS Configuration:** |
| 142 | + |
| 143 | +| Type | Host | Value | TTL | |
| 144 | +|-------|------------|------------------------------------------|------| |
| 145 | +| CNAME | wizards | smartaimemory-wizards-prod.up.railway.app | 3600 | |
| 146 | +| CNAME | healthcare | smartaimemory-healthcare-prod.up.railway.app | 3600 | |
| 147 | + |
| 148 | +## Step 6: Wait for DNS Propagation & SSL |
| 149 | + |
| 150 | +1. **DNS Propagation**: Usually takes 5-30 minutes |
| 151 | +2. **SSL Certificate**: Railway automatically provisions SSL after DNS verification (1-5 minutes) |
| 152 | + |
| 153 | +**Check DNS propagation:** |
| 154 | +```bash |
| 155 | +dig wizards.smartaimemory.com CNAME +short |
| 156 | +dig healthcare.smartaimemory.com CNAME +short |
| 157 | +``` |
| 158 | + |
| 159 | +**Online checker:** |
| 160 | +- https://dnschecker.org |
| 161 | + |
| 162 | +## Common DNS Provider Instructions |
| 163 | + |
| 164 | +### Namecheap |
| 165 | + |
| 166 | +1. Log in to Namecheap |
| 167 | +2. Domain List → Manage → Advanced DNS |
| 168 | +3. Add New Record: |
| 169 | + - Type: CNAME Record |
| 170 | + - Host: `wizards` |
| 171 | + - Value: `your-project.up.railway.app` |
| 172 | + - TTL: Automatic |
| 173 | +4. Repeat for `healthcare` |
| 174 | + |
| 175 | +### GoDaddy |
| 176 | + |
| 177 | +1. Log in to GoDaddy |
| 178 | +2. My Products → DNS → Manage Zones |
| 179 | +3. Add → CNAME |
| 180 | + - Name: `wizards` |
| 181 | + - Value: `your-project.up.railway.app` |
| 182 | + - TTL: 1 hour |
| 183 | +4. Repeat for `healthcare` |
| 184 | + |
| 185 | +### Cloudflare |
| 186 | + |
| 187 | +1. Log in to Cloudflare |
| 188 | +2. Select smartaimemory.com |
| 189 | +3. DNS → Add record |
| 190 | + - Type: CNAME |
| 191 | + - Name: `wizards` |
| 192 | + - Target: `your-project.up.railway.app` |
| 193 | + - Proxy status: DNS only (gray cloud) |
| 194 | + - TTL: Auto |
| 195 | +4. Repeat for `healthcare` |
| 196 | + |
| 197 | +## Railway Configuration Files |
| 198 | + |
| 199 | +### Create `railway.toml` in each project |
| 200 | + |
| 201 | +**For wizards app:** |
| 202 | +```toml |
| 203 | +[build] |
| 204 | +builder = "NIXPACKS" |
| 205 | +buildCommand = "npm install && npm run build" |
| 206 | + |
| 207 | +[deploy] |
| 208 | +startCommand = "npm start" |
| 209 | +healthcheckPath = "/" |
| 210 | +healthcheckTimeout = 100 |
| 211 | +restartPolicyType = "ON_FAILURE" |
| 212 | +restartPolicyMaxRetries = 10 |
| 213 | + |
| 214 | +[[deploy.envVariables]] |
| 215 | +name = "NODE_ENV" |
| 216 | +value = "production" |
| 217 | +``` |
| 218 | + |
| 219 | +**For healthcare app:** |
| 220 | +```toml |
| 221 | +[build] |
| 222 | +builder = "NIXPACKS" |
| 223 | +buildCommand = "npm install && npm run build" |
| 224 | + |
| 225 | +[deploy] |
| 226 | +startCommand = "npm start" |
| 227 | +healthcheckPath = "/" |
| 228 | +healthcheckTimeout = 100 |
| 229 | +restartPolicyType = "ON_FAILURE" |
| 230 | +restartPolicyMaxRetries = 10 |
| 231 | + |
| 232 | +[[deploy.envVariables]] |
| 233 | +name = "NODE_ENV" |
| 234 | +value = "production" |
| 235 | +``` |
| 236 | + |
| 237 | +## Verify Deployment |
| 238 | + |
| 239 | +### Check Railway Dashboard |
| 240 | + |
| 241 | +1. Go to https://railway.app/dashboard |
| 242 | +2. Verify both projects show "Active" status |
| 243 | +3. Check deployment logs for any errors |
| 244 | + |
| 245 | +### Test Domains |
| 246 | + |
| 247 | +Once DNS propagates: |
| 248 | + |
| 249 | +```bash |
| 250 | +curl -I https://wizards.smartaimemory.com |
| 251 | +curl -I https://healthcare.smartaimemory.com |
| 252 | +``` |
| 253 | + |
| 254 | +Both should return `200 OK` with SSL. |
| 255 | + |
| 256 | +## Update Main Website Links |
| 257 | + |
| 258 | +After deployment, update the main website to link to the new subdomains: |
| 259 | + |
| 260 | +**In `website/app/page.tsx`:** |
| 261 | + |
| 262 | +```tsx |
| 263 | +{/* Software Development Dashboard */} |
| 264 | +<a |
| 265 | + href="https://wizards.smartaimemory.com" |
| 266 | + className="btn btn-primary" |
| 267 | + target="_blank" |
| 268 | + rel="noopener noreferrer" |
| 269 | +> |
| 270 | + View Wizards Examples → |
| 271 | +</a> |
| 272 | + |
| 273 | +{/* Healthcare Dashboard (if you add it back as a link) */} |
| 274 | +<a |
| 275 | + href="https://healthcare.smartaimemory.com" |
| 276 | + className="btn btn-primary" |
| 277 | + target="_blank" |
| 278 | + rel="noopener noreferrer" |
| 279 | +> |
| 280 | + View Healthcare Dashboard → |
| 281 | +</a> |
| 282 | +``` |
| 283 | + |
| 284 | +## Continuous Deployment (Optional) |
| 285 | + |
| 286 | +Connect Railway to your GitHub repository for automatic deployments: |
| 287 | + |
| 288 | +1. In Railway dashboard → Settings |
| 289 | +2. Connect to GitHub repository |
| 290 | +3. Select branch (e.g., `main`) |
| 291 | +4. Enable "Auto Deploy" |
| 292 | + |
| 293 | +Now every push to main will automatically deploy! |
| 294 | + |
| 295 | +## Monitoring |
| 296 | + |
| 297 | +### View Logs |
| 298 | + |
| 299 | +```bash |
| 300 | +# For wizards project |
| 301 | +railway logs |
| 302 | + |
| 303 | +# Or in dashboard |
| 304 | +``` |
| 305 | + |
| 306 | +### View Metrics |
| 307 | + |
| 308 | +Railway dashboard shows: |
| 309 | +- CPU usage |
| 310 | +- Memory usage |
| 311 | +- Network traffic |
| 312 | +- Deployment history |
| 313 | + |
| 314 | +## Troubleshooting |
| 315 | + |
| 316 | +### Deployment Failed |
| 317 | + |
| 318 | +```bash |
| 319 | +# Check logs |
| 320 | +railway logs |
| 321 | + |
| 322 | +# Redeploy |
| 323 | +railway up --detach |
| 324 | +``` |
| 325 | + |
| 326 | +### Domain Not Working |
| 327 | + |
| 328 | +1. **Verify DNS**: `dig wizards.smartaimemory.com CNAME +short` |
| 329 | +2. **Check Railway domain status**: Dashboard → Settings → Domains |
| 330 | +3. **Wait**: DNS can take up to 24 hours (usually 5-30 minutes) |
| 331 | + |
| 332 | +### SSL Certificate Not Provisioning |
| 333 | + |
| 334 | +1. Verify CNAME record is correct |
| 335 | +2. Wait 5-10 minutes after DNS propagates |
| 336 | +3. Check Railway dashboard for SSL status |
| 337 | +4. Contact Railway support if issue persists |
| 338 | + |
| 339 | +## Cost Estimate |
| 340 | + |
| 341 | +Railway pricing: |
| 342 | +- **Hobby Plan**: $5/month per project (includes $5 credit) |
| 343 | +- **Usage-based**: After credit, pay for resources used |
| 344 | +- **Estimate**: ~$5-20/month for both projects depending on traffic |
| 345 | + |
| 346 | +## Quick Command Reference |
| 347 | + |
| 348 | +```bash |
| 349 | +# Login |
| 350 | +railway login |
| 351 | + |
| 352 | +# Initialize project |
| 353 | +railway init |
| 354 | + |
| 355 | +# Set environment variable |
| 356 | +railway variables set KEY=value |
| 357 | + |
| 358 | +# Deploy |
| 359 | +railway up |
| 360 | + |
| 361 | +# View logs |
| 362 | +railway logs |
| 363 | + |
| 364 | +# Open in browser |
| 365 | +railway open |
| 366 | + |
| 367 | +# Link to existing project |
| 368 | +railway link |
| 369 | + |
| 370 | +# Check status |
| 371 | +railway status |
| 372 | +``` |
| 373 | + |
| 374 | +## Timeline for Tonight |
| 375 | + |
| 376 | +1. **Install CLI & Login**: 2 minutes |
| 377 | +2. **Deploy wizards app**: 5-10 minutes |
| 378 | +3. **Deploy healthcare app**: 5-10 minutes |
| 379 | +4. **Add custom domains in Railway**: 2 minutes |
| 380 | +5. **Configure DNS CNAME records**: 5 minutes |
| 381 | +6. **Wait for DNS propagation**: 5-30 minutes |
| 382 | +7. **SSL provisioning**: 1-5 minutes (automatic) |
| 383 | + |
| 384 | +**Total: 25-60 minutes** 🚀 |
| 385 | + |
| 386 | +## Support |
| 387 | + |
| 388 | +- **Railway Docs**: https://docs.railway.app |
| 389 | +- **Railway Discord**: https://discord.gg/railway |
| 390 | + |
| 391 | + |
| 392 | +--- |
| 393 | + |
| 394 | +**Ready to deploy! Start with Step 1 and work through each step sequentially.** |
0 commit comments