- Remove outdated documentation files (MVP plan, API docs, frontend plan) - Add deployment configuration (DEPLOY.md, apache-config) - Update AGENTS.md with build commands - Fix geography and tests API endpoints - Update Tests page with improved functionality - Update package.json and svelte.config.js
2.9 KiB
2.9 KiB
Apache Deployment Guide for CLQMS
Quick Start
The app is now configured for static hosting. Follow these steps to deploy:
1. Build the Application
pnpm run build
This creates static files in the build/ folder.
2. Deploy to Apache
Option A: Copy to DocumentRoot
# Create directory
sudo mkdir -p /var/www/html/clqms
# Copy build files
sudo cp -r build/* /var/www/html/clqms/
# Set permissions
sudo chown -R www-data:www-data /var/www/html/clqms
sudo chmod -R 755 /var/www/html/clqms
Option B: Using VirtualHost (Recommended)
- Copy the build files:
sudo mkdir -p /var/www/html/clqms
sudo cp -r build/* /var/www/html/clqms/
sudo chown -R www-data:www-data /var/www/html/clqms
- Copy the Apache config:
sudo cp apache-config/clqms.conf /etc/apache2/sites-available/
sudo a2ensite clqms
- Enable required modules:
sudo a2enmod rewrite
sudo a2enmod deflate
sudo a2enmod expires
sudo a2enmod headers
sudo systemctl restart apache2
3. API Configuration
Important: The dev proxy (/api → localhost:8000) doesn't work in production.
Option 1: Configure API URL
Create a .env.production file:
VITE_API_URL=https://your-api-server.com/api
Then rebuild:
pnpm run build
Option 2: Apache Reverse Proxy
Add to your VirtualHost:
ProxyPass /api http://localhost:8000/api
ProxyPassReverse /api http://localhost:8000/api
Enable proxy module:
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo systemctl restart apache2
4. SSL/HTTPS (Recommended)
Use Let's Encrypt:
sudo apt install certbot python3-certbot-apache
sudo certbot --apache -d clqms.example.com
5. Subdirectory Deployment
If deploying to a subdirectory (e.g., /clqms/):
- Update
svelte.config.js:
adapter: adapter({
pages: 'build',
assets: 'build',
fallback: 'index.html'
}),
paths: {
base: '/clqms'
}
-
Rebuild and deploy to
/var/www/html/clqms/ -
Update
.htaccessRewriteBase:
RewriteBase /clqms/
Troubleshooting
404 on refresh
- Ensure
mod_rewriteis enabled - Check
.htaccessis in the build folder - Verify
AllowOverride Allin Apache config
API not working
- Check browser console for CORS errors
- Verify
VITE_API_URLis set correctly - Test API endpoint directly
Blank page
- Check browser console for errors
- Verify all assets loaded (check Network tab)
- Ensure
fallback: 'index.html'is set
File Structure After Deployment
/var/www/html/clqms/
├── index.html
├── .htaccess
├── _app/
│ ├── immutable/
│ └── ...
├── favicon.png
└── ...
Production Checklist
- Set production API URL
- Enable HTTPS/SSL
- Configure firewall (allow 80/443)
- Set up log rotation
- Configure backup strategy
- Test all routes work after refresh