preserve harvester's H2 DB across container events - #56
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the GeoPortal container startup/shutdown flow to persist the Harvester’s embedded H2 database across container recreation and to reduce DB corruption/lock issues during the “background Tomcat deploy then restart” pattern used by geoportal-entrypoint.sh.
Changes:
- Switch the background Tomcat shutdown path to use
catalina.sh stopwith a longer wait loop before falling back to SIGKILL. - Remove stale H2 lock/trace artifacts before starting Tomcat in the foreground.
- Add a named Docker volume to persist
/root(whereharvester.mv.dbresides) for thegeoportalservice.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docker/geoportal-entrypoint.sh | Adjusts Tomcat shutdown behavior and cleans up H2 lock/trace artifacts prior to restart. |
| docker/docker-compose.prod.yml | Adds a persistent named volume for the Harvester DB location to survive container recreation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| echo "Requesting graceful Tomcat shutdown via catalina.sh stop..." | ||
| catalina.sh stop 30 -force | ||
| # Wait for the background process to exit |
| volumes: | ||
| - gp-volume:/usr/local/tomcat/webapps/ | ||
| - harvester_data:/root | ||
| - ${gpt_catalog_war}:/usr/local/tomcat/webapps/geoportal.war |
There was a problem hiding this comment.
I hate this, too! Unfortunately, this would require reconfiguring the GeoPortal Harvester WAR file (I have not reviewed the docs/source to see if this would be a 'reconfigure' or a 'hardcode), which would complicate deployments and may significantly complicate maintaining an up-to-date development environment to update the Harvester app.
There was a problem hiding this comment.
Fortunately /root is not "root" (/), so there isn't much in there.
GeoPortal Harvester brokers and tasks are stored in an H2 database stored at
/root/harvester.mv.dbinside thegeoportalcontainer.This patch:
downeventsgeoportal-entrypoint.shabruptly kills Tomcat and restarts the webapps.