Skip to content

preserve harvester's H2 DB across container events - #56

Merged
rhodges merged 1 commit into
dockerfrom
harvester_db
Jun 8, 2026
Merged

preserve harvester's H2 DB across container events#56
rhodges merged 1 commit into
dockerfrom
harvester_db

Conversation

@rhodges

@rhodges rhodges commented Jun 8, 2026

Copy link
Copy Markdown
Member

GeoPortal Harvester brokers and tasks are stored in an H2 database stored at /root/harvester.mv.db inside the geoportal container.

This patch:

  • Ensures that directory is stored as a volume and persists across docker container down events
  • Ensures the database is in a clean state after geoportal-entrypoint.sh abruptly kills Tomcat and restarts the webapps.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 stop with 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 (where harvester.mv.db resides) for the geoportal service.

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.

Comment on lines +166 to +168
echo "Requesting graceful Tomcat shutdown via catalina.sh stop..."
catalina.sh stop 30 -force
# Wait for the background process to exit
Comment on lines 99 to 102
volumes:
- gp-volume:/usr/local/tomcat/webapps/
- harvester_data:/root
- ${gpt_catalog_war}:/usr/local/tomcat/webapps/geoportal.war

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fortunately /root is not "root" (/), so there isn't much in there.

@pollardld pollardld left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 💯

@rhodges
rhodges merged commit 55c5571 into docker Jun 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants