Skip to content

Latest commit

 

History

History
304 lines (240 loc) · 8.08 KB

File metadata and controls

304 lines (240 loc) · 8.08 KB

🎯 Admin Panel Deployment Summary

✅ Current Configuration

Backend API (Railway)

  • URL: https://enategawebsitechatbot-production.up.railway.app/
  • Admin API Endpoint: /admin/api
  • Status: Already configured in admin/app.js

Admin Credentials (from .env)

  • Username: admin
  • Password: SecurePassword123!

Frontend Files Ready for Deployment

  • admin/index.html - Main HTML
  • admin/app.js - JavaScript (API URL already set)
  • admin/style.css - Styling
  • admin/netlify.toml - Netlify config

🚀 Deploy Now (3 Steps)

Step 1: Verify Backend is Running

Test your backend API:

curl https://enategawebsitechatbot-production.up.railway.app/healthz

Should return: {"ok":true,"collection":"enatega_home","points":119}

Step 2: Deploy to Netlify

Option A: Netlify UI (Easiest)

  1. Go to https://app.netlify.com/
  2. Click "Add new site" → "Import an existing project"
  3. Connect GitHub → Select Enatega_website_chatbot repo
  4. Build Settings:
    Base directory: admin
    Build command: (leave empty)
    Publish directory: .
    
  5. Click "Deploy site"
  6. Wait 1-2 minutes for deployment

Option B: Netlify CLI

# Install CLI (if not installed)
npm install -g netlify-cli

# Login
netlify login

# Deploy
cd admin
netlify deploy --prod

Step 3: Test Deployment

  1. Open your Netlify URL (e.g., https://random-name-123.netlify.app)
  2. Login with:
    • Username: admin
    • Password: SecurePassword123!
  3. Test features:
    • View files list
    • Create a test file
    • Edit a file
    • Delete the test file
    • Check status (should show 119 chunks)

🔒 Security Recommendations

1. Change Admin Password (IMPORTANT!)

Edit backend .env:

ADMIN_USERNAME=your_secure_username
ADMIN_PASSWORD=YourVeryStrongPassword123!@#

Then restart Railway service:

# Via Railway CLI
railway restart

# Or via Railway Dashboard
# Go to your service → Click "Restart"

2. Restrict CORS (Optional - Production)

Edit api/main.py line 35-42:

app.add_middleware(
    CORSMiddleware,
    allow_origins=[
        "https://your-admin.netlify.app",  # Add your Netlify URL
        "http://localhost:8080"  # Keep for local testing
    ],
    allow_credentials=False,
    allow_methods=["*"],
    allow_headers=["*"],
)

3. Custom Domain (Optional)

In Netlify Dashboard:

  1. Go to "Domain settings"
  2. Add custom domain: admin.enatega.com
  3. Update DNS as instructed
  4. SSL certificate auto-generated

📊 What Happens During Deployment

Your Computer                 Netlify CDN                Railway Backend
     │                             │                           │
     │  1. Push to GitHub          │                           │
     ├────────────────────────────>│                           │
     │                             │                           │
     │  2. Netlify auto-deploys    │                           │
     │     admin folder            │                           │
     │                             │                           │
     │                             │  3. User visits admin     │
     │                             │<──────────────────────────│
     │                             │                           │
     │                             │  4. Login request         │
     │                             ├──────────────────────────>│
     │                             │     /admin/api/files      │
     │                             │                           │
     │                             │  5. Auth check            │
     │                             │<──────────────────────────│
     │                             │     (Basic Auth)          │
     │                             │                           │
     │                             │  6. Return data           │
     │                             │<──────────────────────────│
     │                             │                           │

🧪 Testing Checklist

After deployment, test these features:

  • Login

    • Open Netlify URL
    • Enter username: admin
    • Enter password: SecurePassword123!
    • Should see files list
  • View Files

    • Should see list of .txt files
    • Should show file sizes and modified dates
    • Status bar should show: "X files • 119 chunks in enatega_home"
  • Create File

    • Click "+ New File"
    • Enter filename: test-deployment.txt
    • Enter content: "Testing admin panel deployment"
    • Click "Save"
    • Should see success notification
  • Edit File

    • Click "Edit" on test-deployment.txt
    • Modify content
    • Click "Save"
    • Should see success notification
  • Delete File

    • Click "Delete" on test-deployment.txt
    • Confirm deletion
    • Should see success notification
  • Re-ingest (Optional - takes 2-3 minutes)

    • Click "⚡ Re-ingest to Qdrant"
    • Confirm action
    • Watch progress in modal
    • Should complete successfully

🐛 Common Issues & Fixes

Issue: "Connection error" on login

Symptoms: Can't login, error message appears Cause: Backend not reachable Fix:

  1. Check Railway dashboard - is service running?
  2. Test backend: curl https://enategawebsitechatbot-production.up.railway.app/healthz
  3. Check Railway logs for errors

Issue: "Invalid credentials"

Symptoms: Login fails with wrong credentials message Cause: Wrong username/password Fix:

  1. Check backend .env file for correct credentials
  2. Default is: admin / SecurePassword123!
  3. If changed, restart Railway service

Issue: CORS errors in browser console

Symptoms: API calls blocked, CORS error in F12 console Cause: Backend CORS not allowing Netlify domain Fix:

  1. Your backend already allows all origins (allow_origins=["*"])
  2. If you restricted it, add Netlify domain to allow_origins

Issue: Files not showing

Symptoms: Empty files list Cause: No files in data/clean/ directory Fix:

  1. Check Railway: ls data/clean/
  2. Should have 50+ .txt files
  3. If missing, run pipeline: ./run_pipeline.sh

📱 Mobile Access

The admin panel is responsive and works on mobile:

  • ✅ iPhone/iPad (Safari, Chrome)
  • ✅ Android (Chrome, Firefox)
  • ✅ Tablets

🔄 Auto-Deploy Setup

Netlify auto-deploys when you push to GitHub:

# Make changes to admin panel
cd admin
# Edit files...

# Commit and push
git add .
git commit -m "Update admin panel UI"
git push origin main

# Netlify automatically deploys in 1-2 minutes

📈 Monitoring

Netlify Analytics

  • Dashboard → Your Site → Analytics
  • Track: Visits, Page views, Bandwidth

Railway Logs

# Via CLI
railway logs --tail

# Via Dashboard
# Go to your service → Logs tab

Qdrant Dashboard


🎉 Success Criteria

Your deployment is successful when:

  • ✅ Netlify URL loads admin panel
  • ✅ Login works with correct credentials
  • ✅ Files list displays correctly
  • ✅ Can create, edit, delete files
  • ✅ Status shows correct chunk count
  • ✅ No errors in browser console (F12)
  • ✅ Backend logs show successful API calls

📞 Next Steps

  1. Deploy now using steps above
  2. Test thoroughly using checklist
  3. Change admin password for security
  4. Share with team:
    • URL: (your Netlify URL)
    • Username: (from .env)
    • Password: (from .env)
  5. Set up custom domain (optional)
  6. Monitor usage via Netlify/Railway dashboards

📚 Documentation Files

  • ADMIN_DEPLOYMENT_GUIDE.md - Full deployment guide
  • QUICK_DEPLOY.md - Quick reference
  • DEPLOYMENT_SUMMARY.md - This file

Ready to deploy? Follow Step 1 above! 🚀