Overview
Docker provides a containerized deployment of PhotoFlow that includes:- PostgreSQL database - Isolated database container
- PhotoFlow application - Production-optimized build
- Persistent storage - Data persists across container restarts
- Automated setup - Database migrations run automatically
Prerequisites
Before deploying with Docker:Docker Engine
Version 20.10 or higher
Docker Compose
Version 2.0 or higher
Install Docker
- Linux
- macOS
- Windows
Verify Installation
Understanding the Dockerfile
PhotoFlow uses a multi-stage build for optimization:Dockerfile
- Smaller final image (only runtime dependencies)
- Faster deployments
- Better security (no build tools in production)
- Cached layers speed up rebuilds
Docker Compose Configuration
Thedocker-compose.yml defines the complete stack:
docker-compose.yml
- Health checks ensure database is ready before app starts
- Named volumes persist data across restarts
- Service dependencies manage startup order
- Restart policy keeps services running
Deployment Steps
Build and Start Containers
Launch PhotoFlow with Docker Compose:This command:
- Pulls the PostgreSQL image
- Builds the PhotoFlow image
- Creates containers
- Starts services in detached mode
The Entrypoint Script
Thedocker-entrypoint.sh script handles startup tasks:
docker-entrypoint.sh
- Generates Prisma client - Creates the database client
- Runs migrations - Updates database schema (production-safe)
- Starts the app - Launches the Node.js server
prisma migrate deploy only applies already-created migration files. It won’t generate new migrations, making it safe for production.Managing the Deployment
View Logs
Monitor application logs:Restart Services
Stop Services
Update PhotoFlow
To update to the latest version:Database Management
Access Database Shell
Connect to PostgreSQL:Backup Database
Create a backup:Restore Database
Restore from backup:View Database Files
Inspect the volume:Network Configuration
Expose to Local Network
By default, PhotoFlow is accessible athttp://localhost:3000. To allow other PCs on your network to connect:
- Find your server’s IP address:
- Update
VITE_SOCKET_URLin docker-compose.yml:
- Restart containers:
- Configure firewall to allow port 3000:
Use Different Ports
To change the exposed port, editdocker-compose.yml:
http://localhost:8080
Production Considerations
Security
- Change default passwords
- Use strong database credentials
- Enable HTTPS with a reverse proxy
- Restrict network access
Performance
- Monitor resource usage
- Set container resource limits
- Use SSD storage for database
- Regular database maintenance
Backups
- Schedule automated backups
- Test restore procedures
- Store backups off-server
- Keep multiple backup versions
Monitoring
- Monitor container health
- Track application logs
- Set up alerts for failures
- Monitor disk space
Resource Limits
Set resource limits to prevent containers from consuming excessive resources:docker-compose.yml
Troubleshooting
Container won't start
Container won't start
Check logs for errors:Common issues:
- Port already in use: Change port in
docker-compose.yml - Build errors: Check Dockerfile syntax
- Missing files: Ensure all files are in build context
Database connection errors
Database connection errors
Verify database is healthy:Check database logs:Ensure
DATABASE_URL matches PostgreSQL credentials.Can't access from other PCs
Can't access from other PCs
- Verify firewall allows port 3000
- Check
VITE_SOCKET_URLuses server’s IP, not localhost - Ensure both PCs are on same network
- Test connectivity:
curl http://[server-ip]:3000
Data lost after restart
Data lost after restart
Ensure you’re not using If volumes were deleted, restore from backup.
docker compose down -v which deletes volumes.Check volumes exist:Out of disk space
Out of disk space
Clean up unused Docker resources:
Migrations fail on startup
Migrations fail on startup
Check migration history:Reset if needed (WARNING: deletes data):
Next Steps
Coolify Deployment
Deploy with Coolify for easier management
Production Checklist
Ensure your deployment is production-ready
Network Setup
Configure multi-PC network access
Environment Variables
Learn about all configuration options