Overview
Docker deployment provides a production-ready PhotoFlow setup with:- Containerized services - Application and database isolated in containers
- Automated setup - Database migrations run automatically on startup
- Persistent data - Volumes ensure data survives container restarts
- Easy updates - Rebuild and restart to update
- Consistent environment - Same setup across dev, staging, and production
Prerequisites
Before deploying:- Docker Engine 20.10+ installed (installation guide)
- Docker Compose 2.0+ installed
- Basic understanding of Docker concepts
- Access to the server where you’ll deploy
Quick Start
Get PhotoFlow running with Docker in minutes:Understanding the Setup
PhotoFlow’s Docker deployment uses two services:PostgreSQL Container
Handles all data storage:- Uses Alpine Linux for smaller image size
- Health check ensures database is ready before app starts
- Named volume persists data across container restarts
- Port 5432 exposed for backup/management tools
Application Container
Runs the PhotoFlow application:- Waits for PostgreSQL health check before starting
- Restarts automatically if it crashes
- Uses service name “postgres” to connect to database
- Port 3000 mapped to host
Production Configuration
For production use, customize the configuration:Change Default Passwords
Create a.env file:
.env
docker-compose.yml to use these variables:
Configure Network Access
For multi-PC access:- Find server IP:
- Update VITE_SOCKET_URL:
.env
- Rebuild containers:
Set Resource Limits
Prevent containers from consuming all system resources:Managing the Deployment
View Logs
Monitor application output:Restart Services
Stop Services
Update PhotoFlow
To deploy a new version:- Pulls updated code
- Rebuilds the application image
- Restarts the container
- Runs database migrations automatically
- Starts the application
Database Management
Backup Database
Create backups regularly:Restore Database
Access Database Shell
For direct database access:View Database Logs
Monitoring
Check Container Status
Health Checks
Disk Usage
Network Configuration
Expose to Local Network
Allow other PCs to connect:- Configure firewall:
- Update Socket.io URL in
.env:
- Rebuild:
Change Ports
If port 3000 is in use:http://localhost:8080
Reverse Proxy Setup
For HTTPS or custom domain, use nginx:Troubleshooting
Container won't start
Container won't start
Check logs for errors:Common issues:
- Port already in use
- Insufficient disk space
- Permission issues
- Invalid environment variables
Database connection errors
Database connection errors
Verify:
- PostgreSQL container is healthy:
- Database credentials match:
- App can reach database:
Can't access from other PCs
Can't access from other PCs
- Check firewall allows port 3000
- Verify VITE_SOCKET_URL uses server IP, not localhost
- Ensure containers are bound to 0.0.0.0, not 127.0.0.1
- Test with:
curl http://[server-ip]:3000
Data lost after restart
Data lost after restart
If you used If missing, restore from backup.
docker compose down -v, volumes were deleted.Verify volumes exist:Out of disk space
Out of disk space
Clean up Docker resources:
Performance Tuning
PostgreSQL Configuration
Optimize database performance:Application Tuning
Adjust Node.js settings:Security Best Practices
Strong Passwords
Use complex, unique passwords for:
- PostgreSQL user
- Production environments
- Never use defaults
Network Isolation
Don’t expose to internet:
- Use internal networks only
- Add authentication if needed
- Use VPN for remote access
Regular Updates
Keep software updated:
- Update base images
- Apply security patches
- Monitor CVE databases
Backup Strategy
Protect your data:
- Automated daily backups
- Store backups off-server
- Test restore procedures
Automated Startup
Ensure PhotoFlow starts on boot:Systemd Service (Linux)
Create/etc/systemd/system/photoflow.service:
Docker Desktop (Windows/macOS)
- Open Docker Desktop settings
- Enable “Start Docker Desktop when you log in”
- Containers set to
restart: unless-stoppedwill start automatically
Next Steps
Coolify Deployment
Easier deployment with Coolify platform
Production Checklist
Ensure your deployment is production-ready
Network Setup
Configure multi-PC network access
Database Setup
Learn about database management