- Added Docker support (Dockerfiles, docker-compose.yml) - Fixed authentication and authorization (token storage, CORS, permissions) - Fixed API response transformations for all modules - Added production deployment scripts and guides - Fixed frontend permission checks and module access - Added database seeding script for production - Complete documentation for deployment and configuration Co-authored-by: Cursor <cursoragent@cursor.com>
6.5 KiB
🎉 Z.CRM Deployment Successful!
✅ Deployment Status: COMPLETE
Your Z.CRM application has been successfully deployed to your server!
🌐 Server Information
| Item | Details |
|---|---|
| Server IP | 37.60.249.71 |
| Domain | zerp.atmata-group.com |
| SSH User | root |
| Application Directory | /opt/zerp |
🚀 Services Running
| Service | Status | Port | URL |
|---|---|---|---|
| Frontend | ✅ Running | 3000 | http://37.60.249.71:3000 |
| Backend API | ✅ Running | 5001 | http://37.60.249.71:5001 |
| PostgreSQL Database | ✅ Running | 5432 | localhost:5432 |
📋 CRITICAL: Configure Nginx Proxy Manager
You MUST configure Nginx Proxy Manager to make your application accessible via the domain.
Configuration Steps:
-
Access your Nginx Proxy Manager (usually at http://your-npm-ip:81)
-
Add a new Proxy Host with these settings:
Details Tab:
Domain Names: zerp.atmata-group.com
Scheme: http
Forward Hostname/IP: localhost (or 37.60.249.71)
Forward Port: 3000
✓ Cache Assets
✓ Block Common Exploits
✓ Websockets Support
SSL Tab:
✓ Request a new SSL Certificate (Let's Encrypt)
✓ Force SSL
✓ HTTP/2 Support
✓ HSTS Enabled
Email: your-email@example.com
✓ I Agree to the Let's Encrypt Terms of Service
Advanced Tab (Optional - for API routing):
# If you want to access API directly via subdomain or path
location /api {
proxy_pass http://localhost:5001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
-
Save and wait for SSL certificate to be issued
-
Access your application at: https://zerp.atmata-group.com
🔐 Security: Update Environment Variables
IMPORTANT: The deployment created default environment variables. You MUST update them with secure values!
SSH to your server:
ssh root@37.60.249.71
Edit the environment file:
nano /opt/zerp/.env
Update these values:
# Change this to a strong password
POSTGRES_PASSWORD=YourVerySecurePassword123!
# This was randomly generated but you can change it
JWT_SECRET=your-super-secure-jwt-secret-here
# Domain is already set
DOMAIN=zerp.atmata-group.com
After updating, restart services:
cd /opt/zerp
docker-compose restart
📊 Monitoring & Management
View Service Status:
cd /opt/zerp
docker-compose ps
View Logs:
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f frontend
docker-compose logs -f backend
docker-compose logs -f postgres
Restart Services:
cd /opt/zerp
docker-compose restart
Stop Services:
docker-compose down
Update Application (after making changes):
# From your local machine
cd /Users/talalsharabi/z_crm
./quick-deploy.sh
# Or manually
rsync -avz --exclude 'node_modules' --exclude '.git' \
./ root@37.60.249.71:/opt/zerp/
# Then on server
ssh root@37.60.249.71
cd /opt/zerp
docker-compose down
docker-compose up -d --build
🗄️ Database Management
Access Database:
docker-compose exec postgres psql -U postgres mind14_crm
Backup Database:
docker-compose exec postgres pg_dump -U postgres mind14_crm > backup_$(date +%Y%m%d).sql
Restore Database:
docker-compose exec -T postgres psql -U postgres mind14_crm < backup_20240101.sql
Run Migrations:
docker-compose exec backend npx prisma migrate deploy
🔥 Firewall Configuration (Recommended)
Secure your server by only allowing necessary ports:
# SSH to server
ssh root@37.60.249.71
# Configure firewall
ufw allow 22/tcp # SSH
ufw allow 80/tcp # HTTP
ufw allow 443/tcp # HTTPS
ufw enable
# Verify
ufw status
⚠️ Troubleshooting
Frontend Can't Connect to Backend
- Check backend logs:
docker-compose logs backend - Verify backend is running:
docker-compose ps - Check CORS settings in backend
Database Connection Issues
- Check postgres logs:
docker-compose logs postgres - Verify DATABASE_URL in backend container
- Ensure postgres is healthy
Port Already in Use
# Find process using port
netstat -tulpn | grep :3000
# Kill process
kill -9 <PID>
Reset Everything
cd /opt/zerp
docker-compose down -v # WARNING: This deletes all data!
docker-compose up -d --build
📞 Default Login Credentials
After deployment, you need to seed the database with initial user:
# SSH to server
ssh root@37.60.249.71
# Run seed command
cd /opt/zerp
docker-compose exec backend npx prisma db seed
Default admin credentials will be shown in the seed output.
✨ Next Steps
- ✅ Configure Nginx Proxy Manager (see above)
- ✅ Update
.envfile with secure passwords - ✅ Configure firewall
- ✅ Seed database with initial data
- ✅ Test application at https://zerp.atmata-group.com
- ✅ Set up regular database backups
- ✅ Configure monitoring/alerts (optional)
🎯 Port Summary for Nginx Proxy Manager
Main Configuration:
- Point domain
zerp.atmata-group.comto port3000
That's it! The frontend on port 3000 will automatically proxy API requests to the backend on port 5001.
📁 Project Structure on Server
/opt/zerp/
├── backend/ # Backend API
├── frontend/ # Frontend Next.js app
├── docker-compose.yml # Docker services configuration
├── .env # Environment variables (UPDATE THIS!)
└── ... other files
🆘 Need Help?
- Check logs:
docker-compose logs -f - Check service status:
docker-compose ps - Restart services:
docker-compose restart - Review this documentation
- Check the main DEPLOYMENT_GUIDE.md for detailed instructions
🎉 Congratulations!
Your Z.CRM system is now deployed and ready to use!
Remember to:
- ✅ Configure Nginx Proxy Manager
- ✅ Update environment variables
- ✅ Secure your server with firewall rules
- ✅ Test the application thoroughly
- ✅ Set up regular backups
Deployment Date: February 9, 2026
Server: 37.60.249.71
Domain: zerp.atmata-group.com