3.8 KiB
3.8 KiB
Deploy your Odoo PWA to Vercel with proper environment variable configuration.
What this command does:
- Prepares the project for Vercel deployment
- Guides through Vercel CLI setup or web deployment
- Configures environment variables securely
- Sets up continuous deployment from Git
- Provides post-deployment verification steps
Prerequisites:
Before deploying, verify:
- ✅ Project builds successfully locally (
npm run build) - ✅ All tests pass
- ✅
.envfile is configured and working - ✅ Git repository is initialized and pushed to GitHub/GitLab/Bitbucket
- ✅ Vercel account exists (or guide user to create one)
Deployment Options:
Option 1: Vercel CLI (Recommended for first deployment)
npm install -g vercel
vercel login
vercel
Option 2: Vercel Dashboard (Recommended for Git integration)
- Go to https://vercel.com/new
- Import your Git repository
- Configure project settings
- Add environment variables
- Deploy
Environment Variables to Set in Vercel:
Required for production:
VITE_ODOO_URL=https://yourcompany.odoo.com
VITE_ODOO_DB=yourcompany-main
ODOO_API_KEY=your_production_api_key
ODOO_USERNAME=your.email@company.com
VITE_MODEL_NAME=x_expense
VITE_MODEL_DISPLAY_NAME=Expense
Steps:
- Verify project builds successfully
- Check if Vercel is already configured (look for
vercel.json) - Ask user which deployment option they prefer
- Guide through the chosen deployment method
- Help set up environment variables in Vercel dashboard
- Initiate deployment
- Wait for build to complete
- Test the deployed application
- Set up custom domain (if requested)
Framework-Specific Configuration:
SvelteKit
Verify vercel.json contains:
{
"buildCommand": "npm run build",
"outputDirectory": "build",
"framework": "sveltekit"
}
React
Verify build settings:
{
"buildCommand": "npm run build",
"outputDirectory": "dist",
"framework": "vite"
}
Vue
Verify build settings:
{
"buildCommand": "npm run build",
"outputDirectory": "dist",
"framework": "vite"
}
Post-Deployment Checks:
After deployment, verify:
- ✅ Application loads correctly
- ✅ Odoo connection works (check browser console)
- ✅ Data syncs from Odoo
- ✅ CRUD operations work
- ✅ Offline functionality works
- ✅ PWA can be installed
- ✅ Service worker is active
Example prompts to use this command:
/deploy-vercel- Interactive deployment wizard- User: "Deploy my PWA to Vercel"
- User: "Help me set up Vercel deployment"
Continuous Deployment:
Once Git integration is set up:
- Every push to
mainbranch triggers automatic deployment - Preview deployments for pull requests
- Automatic rollback on build failures
- Environment variables persist across deployments
Custom Domain Setup:
If user wants a custom domain:
- Go to Vercel Dashboard → Project → Settings → Domains
- Add custom domain
- Configure DNS records as shown
- Wait for SSL certificate provisioning (automatic)
- Test HTTPS access
Troubleshooting:
Build Fails
- Check build logs in Vercel dashboard
- Verify all dependencies are in package.json
- Ensure Node version is compatible
- Check for environment-specific code
Environment Variables Not Working
- Verify variables are set in Vercel dashboard
- Check variable names match exactly (case-sensitive)
- Ensure variables starting with
VITE_for client-side access - Redeploy after adding new variables
API Routes Not Working
- Verify serverless functions are in correct directory
- Check function size limits (< 50MB)
- Review function logs in Vercel dashboard
- Ensure API routes use correct paths
After Deployment:
Provide the user with:
- Deployed URL
- Vercel dashboard link
- Instructions for adding custom domain
- Tips for monitoring performance
- Reminder to update API keys for production