2.8 KiB
2.8 KiB
Coolify Deployment Guide
This project is ready for deployment on Coolify.
Prerequisites
- Coolify instance running
- GitHub repository with this code
- PostgreSQL database
Deployment Steps
Option 1: Single Docker Compose App
- Create a new Docker Compose application in Coolify
- Connect your GitHub repository
- Select the
docker-compose.ymlfile in the root - Configure environment variables:
DATABASE_URL=postgres://postgres:your_password@postgres:5432/fiscal
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_password
POSTGRES_DB=fiscal
PORT=3001
BETTER_AUTH_SECRET=your-random-long-secret
BETTER_AUTH_BASE_URL=https://api.your-fiscal-domain.com
JWT_SECRET=your-jwt-secret-key-min-32-characters
GITHUB_ID=your-github-oauth-client-id
GITHUB_SECRET=your-github-oauth-client-secret
GOOGLE_ID=your-google-oauth-client-id
GOOGLE_SECRET=your-google-oauth-client-secret
NEXT_PUBLIC_API_URL=https://your-fiscal-domain.com
- Deploy
Option 2: Separate Applications
Backend
- Create a new application in Coolify
- Source: GitHub
- Branch:
main - Build Context:
/backend - Build Pack:
Dockerfile - Environment Variables:
DATABASE_URL=postgres://... PORT=3001 - Deploy
Frontend
- Create a new application in Coolify
- Source: GitHub
- Branch:
main - Build Context:
/frontend - Build Pack:
Dockerfile - Environment Variables:
NEXT_PUBLIC_API_URL=https://your-backend-domain.com - Deploy
Environment Variables
Backend
DATABASE_URL- PostgreSQL connection stringPORT- Server port (default: 3001)NODE_ENV- Environment (development/production)BETTER_AUTH_SECRET- Required in production; use a long random secretBETTER_AUTH_BASE_URL- Public backend URL used for auth callbacks
Frontend
NEXT_PUBLIC_API_URL- Backend API URL
NEXT_PUBLIC_API_URL is used at image build time in the frontend Docker build.
Set it in Coolify before deploying so the generated client bundle points to the correct backend URL.
Database Setup
The application will automatically create the database schema on startup. To manually run migrations:
docker exec -it <backend_container> bun run db:migrate
Monitoring
Once deployed, add the application to OpenClaw's monitoring:
- Add to
/data/workspace/memory/coolify-integration.md - Set up Discord alerts for critical issues
- Configure cron jobs for health checks
Troubleshooting
Database Connection Failed
- Check DATABASE_URL is correct
- Ensure PostgreSQL container is running
- Verify network connectivity
Frontend Can't Connect to Backend
- Verify NEXT_PUBLIC_API_URL points to backend
- Check CORS settings in backend
- Ensure both containers are on same network
Cron Jobs Not Running
- Check Elysia cron configuration
- Verify timezone settings
- Check logs for errors