Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docker/docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ services:
- 8080:8080
volumes:
- gp-volume:/usr/local/tomcat/webapps/
- harvester_data:/root
- ${gpt_catalog_war}:/usr/local/tomcat/webapps/geoportal.war
Comment on lines 99 to 102

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.

- ${gpt_harvester_war}:/usr/local/tomcat/webapps/harvester.war
- ./templates:/templates:ro
Expand Down Expand Up @@ -177,6 +178,7 @@ volumes:
redis_data:
gp-volume:
es-volume:
harvester_data:

networks:
madronanetwork:
Expand Down
22 changes: 12 additions & 10 deletions docker/geoportal-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,25 +159,22 @@ else
echo "✗ app-security.xml missing"
fi

# Stop background Tomcat
# Stop background Tomcat gracefully so H2 can flush and release its lock
echo "Stopping background Tomcat (PID: $TOMCAT_PID)..."

# Check if the process is still running
if kill -0 $TOMCAT_PID 2>/dev/null; then
echo "Sending TERM signal to Tomcat..."
kill $TOMCAT_PID

# Wait for graceful shutdown (up to 10 seconds)
for i in {1..10}; do
echo "Requesting graceful Tomcat shutdown via catalina.sh stop..."
catalina.sh stop 30 -force
# Wait for the background process to exit
Comment on lines +166 to +168
for i in {1..35}; do
if ! kill -0 $TOMCAT_PID 2>/dev/null; then
echo "Tomcat stopped gracefully"
break
fi
echo "Waiting for shutdown... ${i}/10"
echo "Waiting for shutdown... ${i}/35"
sleep 1
done

# Force kill if still running
# Final safety net
if kill -0 $TOMCAT_PID 2>/dev/null; then
echo "Force stopping Tomcat..."
kill -9 $TOMCAT_PID
Expand All @@ -189,6 +186,11 @@ fi

echo "Tomcat stopped successfully"

# Remove any stale H2 lock/trace files left by the background Tomcat run.
# These persist in the named volume and prevent the DB from opening on restart.
echo "Cleaning up stale H2 artifacts in /root..."
rm -f /root/harvester.lock.db /root/harvester.trace.db

# Start Tomcat in foreground
echo "Starting Tomcat with updated configuration..."
exec catalina.sh run