This guide explains how to run TreeBASE using Docker with support for rapid JSP development.
- Docker 20.10 or later (includes Docker Compose v2)
- At least 4GB of free RAM
- At least 10GB of free disk space
Note: This guide uses
docker compose(with a space), which is the modern Docker Compose v2 syntax. If you have an older standalonedocker-compose(with a hyphen), the commands will also work.
This is the recommended approach for UI development as it allows you to edit JSP files locally and see changes immediately:
# Option 1: Use the quick-start script (easiest)
./docker/quick-start.sh
# Option 2: Manual start
docker compose --profile development up
# Wait for the build to complete (first time takes 5-10 minutes)
# Once you see "Tomcat started", access the application at:
# http://localhost:8080/treebase-web/- Edit any JSP file in
treebase-web/src/main/webapp/using your favorite editor - Save the file
- Refresh your browser - that's it!
For example, to modify the homepage:
# Edit the index page
vim treebase-web/src/main/webapp/index.jsp
# Or use your preferred editor
code treebase-web/src/main/webapp/index.jspThe changes will be reflected immediately without rebuilding or restarting Docker containers.
✅ JSP files - Instant refresh on save
✅ CSS files - Instant refresh
✅ JavaScript files - Instant refresh
✅ Images and static resources - Instant refresh
❌ Java source files - Requires container restart
To rebuild after Java changes:
docker compose --profile development restart web-devFor a production-like deployment with a fully self-contained image:
# Build and start production environment
docker compose --profile production up --buildThis creates an optimized Docker image with the WAR file built inside.
- Mounts local
treebase-web/src/main/webapp/directory as a Docker volume - Tomcat automatically recompiles JSP files when they change
- Includes Maven and build tools inside container
- PostgreSQL database runs in a separate container
- Multi-stage Docker build
- WAR file compiled during image creation
- No external file dependencies
- Optimized runtime-only image
# Development mode (with JSP hot-reload)
docker compose --profile development up
# Production mode
docker compose --profile production up
# Run in background (detached mode)
docker compose --profile development up -ddocker compose down
# Also remove volumes (database data will be lost!)
docker compose down -v# All services
docker compose --profile development logs -f
# Just web application
docker compose --profile development logs -f web-dev
# Just database
docker compose logs -f postgres# Clean rebuild (development mode)
docker compose --profile development down -v
docker compose --profile development up --build
# Rebuild production image
docker compose --profile production build --no-cache# Connect to PostgreSQL
docker exec -it treebase-postgres psql -U treebase -d treebase
# From host (if you have psql installed)
psql -h localhost -U treebase -d treebase
# Password: treebase# Access web container
docker exec -it treebase-web-dev bash
# Access database container
docker exec -it treebase-postgres bash.
├── Dockerfile # Production build (multi-stage)
├── Dockerfile.dev # Development build with tools
├── docker compose.yml # Service orchestration
├── .dockerignore # Files excluded from build
├── DOCKER.md # This file
└── docker/
├── README.md # Detailed documentation
├── context.xml # Tomcat JNDI configuration
└── entrypoint-dev.sh # Development startup script
You can customize settings using a .env file:
# Copy the example
cp .env.example .env
# Edit with your preferences
vim .envThe .env file is automatically loaded by Docker Compose. Variables include:
- Database credentials
- Application port
- Java options
- Site URLs
Default credentials (development only):
- Host:
localhost:5432 - Database:
treebase - Username:
treebase - Password:
treebase
To change credentials, edit:
docker compose.yml- environment variables for PostgreSQLdocker/context.xml- JDBC connection settings
Configuration is in docker/context.xml:
- Database connection (JNDI DataSource)
- Mesquite folder location
- Site URL
- SMTP settings for email
By default, the application runs on port 8080. To use a different port:
# In docker compose.yml, change:
ports:
- "9090:8080" # Use port 9090 insteadSolution:
# Check logs for errors
docker compose --profile development logs
# Verify Docker is running
docker ps
# Check available resources
docker system dfSolutions:
- Hard refresh browser (Ctrl+F5 or Cmd+Shift+R)
- Clear browser cache
- Verify you're editing the correct file in
treebase-web/src/main/webapp/ - Check file permissions (should be readable)
Solutions:
# Verify PostgreSQL is running
docker compose ps postgres
# Check PostgreSQL logs
docker compose logs postgres
# Verify credentials match in docker compose.yml and docker/context.xmlSolutions:
- Increase Docker memory allocation (Docker Desktop → Settings → Resources)
- Increase JVM heap size in
docker compose.yml:environment: CATALINA_OPTS: "-Xmx1024m ..." # Increase from 512m
Solution:
# Clear Maven cache and retry
docker compose --profile development down -v
docker compose --profile development up --buildSolution:
# Find what's using port 8080
lsof -i :8080 # macOS/Linux
netstat -ano | findstr :8080 # Windows
# Either:
# 1. Stop the other service, or
# 2. Change port in docker compose.ymlThe development environment builds the entire project on first start. This can take 5-10 minutes depending on:
- Internet speed (Maven downloads ~200MB of dependencies)
- CPU speed (compilation)
- Disk I/O
Subsequent starts are much faster (30 seconds) as dependencies are cached.
The maven-repo volume persists Maven dependencies between container restarts, significantly speeding up rebuilds.
JSP files are compiled on-demand. First access after editing may take 1-2 seconds, but subsequent requests are instantaneous.
For production deployments:
- Change all default passwords
- Use environment variables for sensitive data
- Enable SSL/TLS
- Restrict database network access
- Review and harden Tomcat security settings
- Update all dependencies to latest secure versions
- Don't expose database port to public network
Place SQL scripts in the database init directory:
# Add to docker compose.yml volumes:
- ./my-init-script.sql:/docker-entrypoint-initdb.d/03-custom.sql# In docker compose.yml:
postgres:
image: postgres:14 # or postgres:13, etc.Run database separately for multiple projects:
# Start only database
docker compose up postgres
# Use from multiple TreeBASE checkouts- Validation: Run
./docker/validate-setup.shto check your setup - Testing: See
docker/TESTING.mdfor comprehensive test procedures - Quick Start: Run
./docker/quick-start.shfor guided setup - Detailed Docs: See
docker/README.mdfor detailed documentation - GitHub Issues: https://github.com/TreeBASE/treebase/issues
- Build Guide:
doc/development/BUILDING.md - Deployment Guide:
doc/development/DEPLOYING.md
- Building TreeBASE - Manual build instructions
- Deploying TreeBASE - Traditional Tomcat deployment
- Docker README - Detailed Docker documentation