Prerequisites
Ensure you have the following installed:- Docker Engine 20.10+
- Docker Compose v2.0+
- Make (optional, for using Makefile commands)
Architecture
The Docker Compose setup includes:- PostgreSQL with PostGIS: Main database with geographic data support
- pgAdmin: Database administration interface
- Backend: Spring Boot application (port 8080)
- Frontend: Next.js application (commented out, runs separately)
Quick Start
Configure environment variables
Create a
.env file in the project root with the required variables:.env
Start all services
Use Docker Compose or Make to start the services:The
-d flag runs containers in detached mode (background).Verify services are running
Check the status of all containers:All services should show a healthy status.
Access the services
Once running, access the services at:
- Backend API: http://localhost:8080
- API Documentation: http://localhost:8080/swagger-ui.html
- pgAdmin: http://localhost:5050 (login: [email protected] / admin)
Service Details
PostgreSQL Database
The database uses the official PostGIS image with geographic extensions:- PostgreSQL 16 with PostGIS 3.4
- Health checks for dependency management
- Persistent volume storage
- Automatic restart unless stopped
The database includes a health check that ensures it’s ready before dependent services start.
Backend Service
The Spring Boot backend is built using a multi-stage Dockerfile:- Maven dependency caching for faster rebuilds
- Multi-stage build reduces final image size
- Only JRE in runtime image (smaller footprint)
pgAdmin
Web-based PostgreSQL administration tool:- URL: http://localhost:5050
- Default credentials: [email protected] / admin
- Purpose: Database management and query execution
Common Commands
Using Make
The project includes a Makefile with convenient shortcuts:Using Docker Compose
Direct Docker Compose commands:Development Workflow
Backend Development
For active backend development, you can run Spring Boot outside Docker:Running the backend locally provides faster reload times during development.
Rebuilding After Changes
When you modify the backend code:Troubleshooting
Database Connection Issues
If the backend fails to connect to PostgreSQL:-
Check database health:
-
View database logs:
-
Verify environment variables are set correctly in
.env
Port Conflicts
If ports are already in use:-
Check what’s using the port:
-
Either stop the conflicting service or change the port in
.env:
Container Build Failures
If the backend container fails to build:-
Clean Maven cache:
-
Rebuild without cache:
Database Reset
To completely reset the database:Volume Management
Persistent data is stored in Docker volumes:postgres-data: Database filespgadmin-data: pgAdmin configuration
Backup Database Volume
Restore Database Volume
Next Steps
- Configure Production Deployment
- Set up Environment Variables
- Review Database Migrations