Overview
Plant Together uses Docker Compose to orchestrate multiple services including the React frontend, Express backend, Y-Redis WebSocket server, PostgreSQL database, Redis cache, and PgAdmin. This guide covers both development and production deployments.Prerequisites
Before you begin, ensure you have the following installed:- Docker (version 20.10 or higher)
- Docker Compose (version 2.0 or higher)
- Git
Quick Start
Configure Environment Variables
Create a
.env file in the root directory. At minimum, you must configure Firebase credentials:See the Environment Variables page for a complete list of configuration options.Build and Start Services
- Build Docker images for all services
- Start all containers defined in the compose file
- Create necessary networks and volumes
Access the Application
Once the containers are running, you can access:
- React Application: http://localhost:5173 (dev) or http://localhost:4173 (prod)
- Express API: http://localhost:3000
- Y-Redis WebSocket:
ws://localhost:3003 - PgAdmin: http://localhost:1007
Service Architecture
The Docker Compose configuration includes the following services:| Service | Container Name | Purpose | Default Port |
|---|---|---|---|
plant-together-react | plant-together-react-dev | React frontend application | 5173 (dev), 4173 (prod) |
plant-together-express | plant-together-express-dev | Express REST API server | 3000 |
plant-together-yredis | plant-together-yredis-dev | Y-Redis WebSocket server for real-time collaboration | 3003 |
redis-together | redis-together-dev | Redis cache for WebSocket connections | 6379 |
database-psql | database-psql-dev | PostgreSQL database | 5432 |
pgadmin-together | pgadmin-together-dev | PgAdmin web interface | 1007 |
Development vs Production
Development Configuration
The development setup (docker-compose.yaml) includes:
- Hot reload for React and Express services
- Volume mounts for live code updates
- Debug-friendly logging
- PgAdmin for database management
Production Configuration
The production setup (docker-compose-prod.yaml) includes:
- Optimized production builds
- Restart policies for high availability
- Additional networks for service isolation
- Analytics integration (PostHog, Clarity)
Common Operations
View Service Logs
Stop Services
Restart a Service
Access Container Shell
Networking
Development Network
All services communicate over theplant-together-network Docker network:
Production Networks
Production uses two isolated networks:- plant-together-network: For frontend and database connections
- yredis-network: For Y-Redis and Redis communication
Persistent Storage
Two Docker volumes are created for data persistence:Troubleshooting
Port Already in Use
If you encounter port conflicts, modify the port mappings in your.env file:
Container Fails to Start
Check the logs for the specific service:- Missing environment variables (especially Firebase credentials)
- Database connection failures (check
DB_HOST,DB_USER,DB_PASS) - Port conflicts
Database Connection Issues
Verify PostgreSQL is healthy:Redis Connection Issues
Test Redis connectivity:Next Steps
- Configure Environment Variables for your environment
- Review the System Architecture to understand component interactions
- Set up monitoring and logging for production deployments