This directory contains Docker configuration for running TreeBASE in containers.
To run TreeBASE with live JSP editing capabilities:
# Start the development environment
docker compose --profile development up
# The application will be available at:
# http://localhost:8080/treebase-web/Edit JSP files locally in treebase-web/src/main/webapp/ and simply refresh your browser to see changes!
The development setup uses Docker volumes to mount your local JSP files directly into the running Tomcat container:
- JSP files from
./treebase-web/src/main/webapp/are mounted to/usr/local/tomcat/webapps/treebase-web/ - Tomcat automatically detects changes to JSP files and recompiles them on the next request
- No rebuild or restart required - just edit and refresh!
- ✅ JSP files - All
.jspfiles intreebase-web/src/main/webapp/ - ✅ Static resources - CSS, JavaScript, images
- ✅ HTML templates - Any HTML content
- ❌ Java classes - Require rebuild (use
docker compose restart web-dev) - ❌ Configuration - Require restart
For a production-like deployment:
# Build and start the production environment
docker compose --profile production up --buildThis creates a fully self-contained image with the WAR file built inside.
- Uses
Dockerfile.dev - Mounts local source code into container
- Builds WAR on first run using Maven
- Volume-mounts JSP files for live editing
- Includes development tools (Maven, PostgreSQL client)
- Uses
Dockerfile(multi-stage build) - Builds WAR during image creation
- Self-contained image with no external dependencies
- Optimized for deployment
- PostgreSQL 15 database
- Pre-initialized with TreeBASE schema
- Accessible on
localhost:5432 - Credentials:
treebase/treebase - Note: Database initialization creates a
postgresrole to support legacy schema files that reference this role as the owner
Pre-initialization script that:
- Creates the
postgresrole if it doesn't exist (for schema compatibility) - Grants the role to the
treebaseuser - Runs before schema creation to prevent ownership errors
- Tomcat 9 with JDK 17
- Live JSP editing enabled
- Includes build tools
- Port:
8080
- Tomcat 9 with JDK 17
- Optimized runtime-only image
- Port:
8080
Located in docker/context.xml, this file configures:
- Database connection (JNDI)
- Mesquite folder location
- Site URL
- SMTP settings
Development container entrypoint that:
- Waits for PostgreSQL
- Builds the WAR if needed
- Extracts compiled classes
- Mounts JSP files
- Starts Tomcat
# Stop containers
docker compose --profile development down
# Remove volumes to force rebuild
docker compose --profile development down -v
# Start fresh
docker compose --profile development up# All services
docker compose --profile development logs -f
# Just the web application
docker compose --profile development logs -f web-dev# Using docker exec
docker exec -it treebase-postgres psql -U treebase -d treebase
# Or from your host (if psql is installed)
psql -h localhost -U treebase -d treebase# Access web container shell
docker exec -it treebase-web-dev bash
# Rebuild Maven project inside container
docker exec -it treebase-web-dev bash -c "cd /app && mvn clean package -Dmaven.test.skip=true"Edit docker compose.yml and docker/context.xml to update:
POSTGRES_USER,POSTGRES_PASSWORDin compose fileusername,passwordin context.xml
Add to docker compose.yml:
mailcatcher:
image: schickling/mailcatcher
ports:
- "1080:1080"
- "1025:1025"Update docker/context.xml SMTP host to mailcatcher.
Edit the ports section in docker compose.yml:
ports:
- "9090:8080" # Access on http://localhost:9090# Check logs
docker compose --profile development logs
# Verify PostgreSQL is healthy
docker compose ps- For JSP files: Ensure you're editing files in
treebase-web/src/main/webapp/ - For Java files: Restart the container:
docker compose --profile development restart web-dev - Clear browser cache
Edit docker compose.yml and increase the -Xmx value in CATALINA_OPTS.
- Ensure PostgreSQL is running:
docker compose ps postgres - Check credentials in
docker/context.xmlmatchdocker compose.yml
.
├── Dockerfile # Production multi-stage build
├── Dockerfile.dev # Development build with tools
├── docker compose.yml # Orchestration configuration
├── .dockerignore # Files excluded from build context
└── docker/
├── README.md # This file
├── context.xml # Tomcat JNDI configuration
└── entrypoint-dev.sh # Development startup script
The development environment builds the entire project on first start, which can take several minutes depending on:
- Download speed (Maven dependencies)
- CPU speed (compilation)
- Disk speed (I/O operations)
Subsequent starts are much faster as Maven dependencies are cached.
JSP files are compiled on first access after changes. The first page load after editing may be slightly slower, but subsequent requests are fast.
The default configuration uses simple credentials (treebase/treebase) suitable for development only. Do not use these credentials in production!
For production:
- Use strong passwords
- Use environment variables or secrets management
- Enable SSL/TLS
- Restrict database access
- Review and harden Tomcat configuration