Common issues and solutions for deploying AI Present Finder on Coolify.
- Deployment Issues
- Service Issues
- Database Issues
- Network Issues
- SSL/Certificate Issues
- Performance Issues
- Debugging Tools
Symptoms:
- Docker build fails with errors
- Coolify shows build errors in logs
Common Causes & Solutions:
-
Out of disk space
# Check disk usage on server df -h # Clean up unused Docker resources docker system prune -a
-
Out of memory during build
- Increase server RAM
- Or add swap space temporarily:
sudo fallocate -l 4G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile
-
Network timeout during npm install
- Check internet connectivity
- Try redeploying (temporary network issue)
- Use a different npm registry:
RUN pnpm config set registry https://registry.npmjs.org/
Symptoms:
- Services crash immediately after starting
- Status shows "Exited" or "Restarting"
Solutions:
-
Check environment variables
# In Coolify, verify all required variables are set: - OPENAI_API_KEY - BRIGHTDATA_API_KEY - POSTGRES_PASSWORD -
Check service dependencies
- Ensure postgres is healthy before app starts
- Ensure rabbitmq is healthy before app starts
- Check dependency order in docker-compose.prod.yml
-
View service logs
- Click on the service in Coolify
- View the "Logs" tab
- Look for error messages
Symptoms:
- Deployment stuck at a certain step
- No progress for 10+ minutes
Solutions:
-
Cancel and retry
- Click "Cancel Deployment"
- Wait 1 minute
- Click "Redeploy"
-
Check health checks
- Health checks might be failing
- Temporarily disable health checks to debug
- Check if ports are correct
-
Resource exhaustion
- Check server CPU/RAM usage
- May need to upgrade server
Symptoms:
- App service status shows "Restarting"
- Services cycle between running and stopped
Debugging Steps:
-
Check PM2 logs
# In Coolify, open terminal to app container pm2 logs pm2 list -
Common issues:
- Port already in use
# Check what's using the port netstat -tulpn | grep :3000
- Missing environment variables
# Inside container, check env env | grep -E 'OPENAI|BRIGHTDATA|DATABASE'
- Database connection failed
# Test database connection pg_isready -h postgres -U postgres
- Port already in use
-
Start services one by one
# In app container pm2 stop all pm2 start ecosystem.config.js --only restapi-macroservice pm2 logs restapi-macroservice
Symptoms:
- Frontend domain shows "Bad Gateway" or "Gateway Timeout"
- Nginx errors in logs
Solutions:
-
Check if app service is running
curl http://app:3000/health
-
Verify VITE_API_URL is correct
- Should point to your API domain
- Example:
https://api.yourdomain.com
-
Check Nginx configuration
# In frontend container nginx -t -
Restart frontend service
- In Coolify, restart the frontend service
Symptoms:
- Events not being processed
- SSE not receiving updates
- Timeout errors
Debugging:
-
Check RabbitMQ
# View RabbitMQ management UI (if enabled) # Or check queues via CLI docker exec -it <rabbitmq-container> rabbitmqctl list_queues
-
Verify CLOUDAMQP_URL
# Should be: amqp://admin:admin@rabbitmq:5672 echo $CLOUDAMQP_URL
-
Check event publishing
- View app logs for "published" messages
- View app logs for "received" messages
-
Test RabbitMQ connection
# From app container nc -zv rabbitmq 5672
Symptoms:
- "Connection refused" errors in logs
- Services can't connect to postgres
Solutions:
-
Check postgres is running
docker ps | grep postgres -
Verify DATABASE_URL format
postgresql://user:password@postgres:5432/database_name -
Check postgres logs
docker logs <postgres-container-id>
-
Test connection from app
# In app container psql "postgresql://postgres:password@postgres:5432/postgres"
Symptoms:
- "database does not exist" errors
- Missing tables
Solutions:
-
Check init script ran
# View postgres logs for "Multiple databases created" docker logs <postgres-container> | grep "Multiple databases"
-
Manually create databases
# In postgres container psql -U postgres <<EOF CREATE DATABASE reranking_service; CREATE DATABASE fetch_service; CREATE DATABASE stalking_service; CREATE DATABASE chat_service; CREATE DATABASE gift_ideas_service; EOF
-
Run migrations
# In app container, for each service cd backend/stalking-microservice npx prisma migrate deploy
Symptoms:
- Slow queries
- High database CPU usage
- Connection pool exhausted
Solutions:
-
Check active connections
SELECT count(*) FROM pg_stat_activity;
-
Identify slow queries
SELECT pid, now() - pg_stat_activity.query_start AS duration, query FROM pg_stat_activity WHERE state = 'active' ORDER BY duration DESC;
-
Increase connection pool size
- Edit service configuration
- Add to DATABASE_URL:
?connection_limit=20
-
Add database indexes
- Identify frequently queried fields
- Create indexes via migrations
Symptoms:
- Domain shows "Site can't be reached"
- Connection timeout
Solutions:
-
Verify DNS configuration
nslookup yourdomain.com # Should return your server IP -
Check firewall
# Ensure ports 80 and 443 are open sudo ufw status sudo ufw allow 80/tcp sudo ufw allow 443/tcp -
Verify Coolify proxy
- Check if Traefik is running
- View Traefik logs in Coolify
-
Check service domains
- In Coolify, verify domains are assigned correctly
- No typos in domain names
Symptoms:
- Browser console shows CORS errors
- "Access-Control-Allow-Origin" errors
Solutions:
-
Verify API domain in frontend
# VITE_API_URL should match your API domain echo $VITE_API_URL
-
Check CORS configuration in REST API
- Ensure API allows your frontend domain
- Check
main.tsin restapi-macroservice
-
Clear browser cache
- Hard refresh (Ctrl+Shift+R or Cmd+Shift+R)
Symptoms:
- Real-time updates don't work
- "EventSource failed" errors
Solutions:
-
Check SSE endpoint
curl -N https://api.yourdomain.com/sse?clientId=test -
Verify proxy timeout settings
- SSE connections need long timeouts
- Check Coolify/Traefik configuration
-
Check nginx timeout (if using nginx)
proxy_read_timeout 3600s; proxy_send_timeout 3600s;
Symptoms:
- "Connection not secure" warning
- Certificate errors
- Coolify shows certificate provisioning failed
Solutions:
-
Verify DNS is correct
# Domain must resolve to server IP dig yourdomain.com +short -
Check domain is accessible on HTTP
curl http://yourdomain.com
-
Check Let's Encrypt rate limits
- Limited to 5 failures per hour
- Wait and try again later
-
Manual certificate request
- In Coolify, trigger manual certificate renewal
- View logs for errors
Symptoms:
- "Mixed content blocked" in browser
- Some resources load over HTTP
Solutions:
-
Ensure all URLs use HTTPS
- Check frontend code for
http://URLs - Update VITE_API_URL to use
https://
- Check frontend code for
-
Add security headers
- Already configured in nginx.conf
- Verify headers are being sent
Symptoms:
- Server running out of memory
- Services being killed by OOM
Solutions:
-
Check memory usage
docker stats free -h
-
Identify memory hogs
# In app container pm2 monit -
Optimize PM2 configuration
- Reduce number of instances
- Set memory limits in ecosystem.config.js:
max_memory_restart: "500M";
-
Add swap space
sudo fallocate -l 2G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile
Symptoms:
- API requests take >1 second
- Frontend feels sluggish
Solutions:
-
Check server resources
top htop
-
Profile database queries
- Enable query logging
- Identify slow queries
- Add indexes
-
Add caching
- Redis for frequently accessed data
- CDN for static assets
-
Scale horizontally
- Increase PM2 instances
- Deploy multiple app containers
Symptoms:
- CPU constantly at 100%
- Server becomes unresponsive
Solutions:
-
Identify CPU-intensive process
top # Press '1' to see per-core usage -
Check PM2 processes
pm2 monit
-
Profile application
- Use Node.js profiler
- Identify hot paths
- Optimize algorithms
-
Scale server
- Upgrade to more CPU cores
- Distribute load across multiple servers
# In Coolify, click on a service
# Click "Terminal" or "Shell"
# Or via Docker:
docker exec -it <container-name> sh# All services
docker compose -f deployment/docker-compose.prod.yml logs -f
# Specific service
docker compose -f deployment/docker-compose.prod.yml logs -f appdocker ps
# Look at STATUS column for health status# Test connection between containers
docker exec -it app sh
ping postgres
ping rabbitmq
nc -zv postgres 5432
nc -zv rabbitmq 5672# Connect to postgres
docker exec -it <postgres-container> psql -U postgres
# List databases
\l
# Connect to database
\c stalking_service
# List tables
\dt
# Check table schema
\d table_name
# Run query
SELECT * FROM users LIMIT 10;# List queues
docker exec -it <rabbitmq-container> rabbitmqctl list_queues
# List connections
docker exec -it <rabbitmq-container> rabbitmqctl list_connections
# Check status
docker exec -it <rabbitmq-container> rabbitmqctl status# In app container
pm2 list # List all processes
pm2 logs # View all logs
pm2 logs app-name # View specific service logs
pm2 monit # Real-time monitoring
pm2 describe app-name # Detailed process info
pm2 restart app-name # Restart specific service
pm2 reload all # Reload all servicesIf you're still stuck:
-
Check Coolify Logs
- View deployment logs
- Check proxy logs
- Review service logs
-
Review Documentation
-
Community Support
- Coolify Discord: https://discord.gg/coolify
- GitHub Issues: Check the repository
-
Debug Checklist
- All environment variables set
- DNS configured correctly
- Ports 80/443 open
- Services are running
- Health checks passing
- Logs reviewed for errors
- Database initialized
- RabbitMQ accessible
- SSL certificates valid
If everything is broken:
-
Stop all services
docker compose -f deployment/docker-compose.prod.yml down
-
Backup data
docker cp <postgres-container>:/var/lib/postgresql/data ./backup
-
Clean slate
docker compose -f deployment/docker-compose.prod.yml down -v docker system prune -a
-
Redeploy from scratch
- Follow the Coolify Deployment Guide
- Restore database if needed