Complete step-by-step guide for deploying AI Present Finder to Coolify.
- Prerequisites
- Deployment Steps
- Environment Variables
- Domain Configuration
- Verification
- Post-Deployment
Before you begin, ensure you have:
- ✅ A Coolify instance set up and running
- ✅ Access to the Coolify dashboard
- ✅ A domain name with DNS configured
- ✅ Required API keys:
- OpenAI API Key (Get one here)
- BrightData API Key (Sign up here)
- Log in to your Coolify dashboard
- Click + New Resource
- Select Docker Compose
- Choose your desired server/destination
- Set the Project Name:
ai-present-finder
- In the Coolify resource configuration page
- Click on the Docker Compose tab
- Upload or paste the content of
deployment/docker-compose.prod.ymlfrom your repository - Coolify will automatically parse and detect all services:
rabbitmq- Message queuepostgres- Database serverapp- All backend microservicesfrontend- React frontend
Click on the Environment Variables tab and add the following:
These must be set before deployment:
# OpenAI API Key (Required)
OPENAI_API_KEY=sk-proj-...your-key-here
# BrightData API Key (Required)
BRIGHTDATA_API_KEY=your-brightdata-key-here
# PostgreSQL Master Password (Required)
POSTGRES_PASSWORD=your-very-secure-password-hereThese have sensible defaults but can be customized:
# RabbitMQ Credentials (defaults: admin/admin)
RABBITMQ_USER=admin
RABBITMQ_PASS=your-secure-rabbitmq-password
# PostgreSQL Main User (default: postgres)
POSTGRES_USER=postgres
# Database-specific users and passwords
RERANKING_DB_USER=reranking_user
RERANKING_DB_PASSWORD=secure-password-1
FETCH_DB_USER=fetch_user
FETCH_DB_PASSWORD=secure-password-2
STALKING_DB_USER=stalking_user
STALKING_DB_PASSWORD=secure-password-3
CHAT_DB_USER=chat_user
CHAT_DB_PASSWORD=secure-password-4
GIFT_IDEAS_DB_USER=gift_ideas_user
GIFT_IDEAS_DB_PASSWORD=secure-password-5Security Best Practice: Change all passwords to strong, unique values in production!
Coolify will detect the app and frontend services. Assign domains to them:
-
Click on the app service
-
In the Domains section, add your API domain:
https://api.yourdomain.com -
Coolify uses the
SERVICE_FQDN_APP_3000environment variable -
The app listens on internal port 3000
-
Coolify's proxy will handle:
- SSL certificate provisioning (Let's Encrypt)
- HTTPS redirection
- Reverse proxy configuration
-
Click on the frontend service
-
In the Domains section, add your frontend domain:
https://yourdomain.comor
https://app.yourdomain.com -
Coolify uses the
SERVICE_FQDN_FRONTEND_80environment variable -
The frontend listens on internal port 80
Important: After assigning the API domain, add this environment variable to the frontend service:
VITE_API_URL=https://api.yourdomain.comThis tells the frontend where to connect to the backend.
- Click the Deploy button in Coolify
- Monitor the deployment logs
- Coolify will:
- Pull/build all Docker images
- Create Docker volumes for data persistence
- Initialize the PostgreSQL databases
- Start all services in the correct order
- Provision SSL certificates
- Configure the reverse proxy
Expected deployment time: 5-15 minutes (first deployment, including builds)
Watch the logs for each service:
✓ Building app image...
✓ Building frontend image...
✓ Starting rabbitmq...
✓ Starting postgres...
✓ Initializing databases...
✓ Starting app (all microservices)...
✓ Starting frontend...
✓ SSL certificates provisioned
✓ Deployment complete!
| Variable | Required | Default | Description |
|---|---|---|---|
OPENAI_API_KEY |
✅ Yes | - | OpenAI API key for chat and gift ideas |
BRIGHTDATA_API_KEY |
✅ Yes | - | BrightData API key for web scraping |
POSTGRES_PASSWORD |
✅ Yes | - | PostgreSQL master password |
RABBITMQ_USER |
No | admin |
RabbitMQ username |
RABBITMQ_PASS |
No | admin |
RabbitMQ password |
POSTGRES_USER |
No | postgres |
PostgreSQL master user |
CLOUDAMQP_URL |
No | Auto | RabbitMQ connection URL |
VITE_API_URL |
No | Auto | Frontend API endpoint URL |
Each microservice has its own database and user:
| Service | Database | User | Password Variable |
|---|---|---|---|
| Reranking | reranking_service |
reranking_user |
RERANKING_DB_PASSWORD |
| Fetch | fetch_service |
fetch_user |
FETCH_DB_PASSWORD |
| Stalking | stalking_service |
stalking_user |
STALKING_DB_PASSWORD |
| Chat | chat_service |
chat_user |
CHAT_DB_PASSWORD |
| Gift Ideas | gift_ideas_service |
gift_ideas_user |
GIFT_IDEAS_DB_PASSWORD |
Before deploying, configure your DNS:
-
API Domain (e.g.,
api.yourdomain.com):Type: A Name: api Value: <your-server-ip> TTL: 300 -
Frontend Domain (e.g.,
yourdomain.com):Type: A Name: @ Value: <your-server-ip> TTL: 300
Coolify automatically provisions SSL certificates via Let's Encrypt:
- ✅ Certificates are auto-renewed
- ✅ HTTPS is enforced automatically
- ✅ HTTP redirects to HTTPS
Requirements:
- Domain must point to your server
- Ports 80 and 443 must be open
- Server must be reachable from the internet
After deployment, verify each service:
curl https://api.yourdomain.com/health
# Expected: {"status": "ok"}curl https://yourdomain.com/health
# Expected: "healthy"Visit: https://api.yourdomain.com/docs
You should see the Swagger UI with all API endpoints.
In Coolify, click on each service to view logs:
- app: Should show all 10 microservices starting
- postgres: Should show database initialization
- rabbitmq: Should show successful startup
- frontend: Should show Nginx startup
- Open
https://yourdomain.comin your browser - You should see the AI Present Finder landing page
- Try starting a conversation
- Verify SSE connection works (real-time updates)
-
Enable Coolify Monitoring:
- Go to your resource settings
- Enable monitoring features
- Set up alerts (optional)
-
Check PM2 Status (inside app container):
# In Coolify, open a terminal to the app container pm2 listYou should see all 10 services running:
- restapi-macroservice
- stalking-microservice
- chat-microservice
- gift-microservice
- gift-ideas-microservice
- reranking-microservice
- fetch-microservice-olx
- fetch-microservice-allegro
- fetch-microservice-ebay
- fetch-microservice-amazon
-
Database Check:
# In Coolify, open a terminal to the postgres container psql -U postgres -c "\l"
You should see all 5 databases created.
Set up automated backups:
-
Database Backups:
- Use Coolify's backup feature
- Or set up a cron job for
pg_dump
-
Volume Backups:
postgres_data: Critical (daily backups)rabbitmq_data: Less critical (weekly backups)
To update the application:
- Push changes to your Git repository
- In Coolify, click Redeploy
- Coolify will rebuild and restart services
For zero-downtime updates:
- Use Coolify's rolling update feature
- Deploy to staging first
- Test thoroughly before production
Solution:
- Check environment variables are set correctly
- View service logs in Coolify
- Verify DNS is configured correctly
- Check server resources (CPU, RAM, disk)
Solution:
- Verify DNS points to your server
- Check ports 80 and 443 are open
- Wait a few minutes and try again
- Check Coolify proxy logs
Solution:
- Verify
VITE_API_URLis set correctly on frontend service - Check API domain is accessible
- Verify CORS settings in API
- Check browser console for errors
Solution:
- Verify
POSTGRES_PASSWORDis set - Check database URLs in app service
- View postgres logs
- Verify database initialization completed
Solution:
- Check
CLOUDAMQP_URLis correct - Verify RabbitMQ is running
- Check RabbitMQ logs
- Ensure credentials are correct
If you need to change default ports, modify these environment variables:
RESTAPI_PORT=3000
STALKING_PORT=3010
CHAT_PORT=3020
GIFT_PORT=3030
GIFT_IDEAS_PORT=3040
RERANKING_PORT=3050
FETCH_OLX_PORT=8011
FETCH_ALLEGRO_PORT=8012
FETCH_EBAY_PORT=8013
FETCH_AMAZON_PORT=8014To use an external PostgreSQL instance:
-
Remove the
postgresservice fromdocker-compose.prod.yml -
Update database URLs in the
appservice:STALKING_DATABASE_URL=postgresql://user:pass@external-db:5432/stalking_service CHAT_DATABASE_URL=postgresql://user:pass@external-db:5432/chat_service # ... etc
To use an external RabbitMQ instance:
-
Remove the
rabbitmqservice fromdocker-compose.prod.yml -
Update
CLOUDAMQP_URL:CLOUDAMQP_URL=amqps://user:pass@external-rabbitmq/vhost
Before going live:
- Changed all default passwords
- Set strong
POSTGRES_PASSWORD - Set strong
RABBITMQ_PASS - Configured firewall rules
- Enabled HTTPS/SSL
- Reviewed API rate limits
- Set up monitoring and alerts
- Configured backup strategy
- Tested disaster recovery
- Reviewed application logs
- Set up log rotation
For high-traffic scenarios:
-
Increase PM2 Instances (edit
ecosystem.config.js):instances: 4, // Instead of 1
-
Adjust Container Resources in Coolify:
- CPU: 4-8 cores
- Memory: 8-16 GB
-
Database Connection Pooling (adjust in each service)
-
Add CDN for frontend static assets
- Documentation: See
docs/deployment/for more guides - Issues: Check
docs/deployment/troubleshooting.md - Architecture: See
docs/deployment/architecture.md - Coolify Docs: https://coolify.io/docs