Class FhirBootstrapTask

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.fhirfrog.frog.ant.FhirBootstrapTask
All Implemented Interfaces:
Cloneable

public class FhirBootstrapTask extends org.apache.tools.ant.Task
Ant task that performs a one-time HAPI FHIR bootstrap and captures the loaded server state as a committed HAPI Docker image plus a pg_dump SQL file.

The HAPI JPA server stores all IG packages in postgres (not in the HAPI container filesystem). Since postgres:17 declares VOLUME /var/lib/postgresql/data, docker commit can never capture postgres data — Docker explicitly excludes declared volumes from commits. The database is therefore captured via pg_dump and restored via /docker-entrypoint-initdb.d/ on next start.

The bootstrap sequence:

  1. Checks whether imageTag exists locally and pgDumpFile exists on disk — exits early if both are present
  2. Runs docker compose --profile bootstrap up -d to start postgres and HAPI in detached mode
  3. Polls /actuator/health/readiness via HTTP until HAPI is ready, up to maxRetries × retryIntervalMs total wait time
  4. Stops HAPI cleanly (no in-flight writes during dump)
  5. Dumps the postgres database to pgDumpFile via pg_dump
  6. Stops postgres cleanly (WAL flush)
  7. Commits the HAPI container as imageTag
  8. Tears down bootstrap containers in a finally block

Example


 <fhirbootstrap imageTag="hapi-erequesting:0.2.0"
               composeFile=".fhir-frog/docker-compose.yml"
               containerName="fhir-frog-hapi-bootstrap"
               pgContainerName="fhir-frog-postgres-bootstrap"/>
 
  • Field Summary

    Fields inherited from class org.apache.tools.ant.Task

    target, taskName, taskType, wrapper

    Fields inherited from class org.apache.tools.ant.ProjectComponent

    description, location, project
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    setComposeFile(String composeFile)
     
    void
    setContainerName(String containerName)
     
    void
    setImageTag(String imageTag)
     
    void
    setMaxRetries(int maxRetries)
     
    void
     
    void
    setPgDumpFile(String pgDumpFile)
     
    void
     

    Methods inherited from class org.apache.tools.ant.Task

    bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType

    Methods inherited from class org.apache.tools.ant.ProjectComponent

    clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FhirBootstrapTask

      public FhirBootstrapTask()
  • Method Details

    • setImageTag

      public void setImageTag(String imageTag)
    • setPgDumpFile

      public void setPgDumpFile(String pgDumpFile)
    • setComposeFile

      public void setComposeFile(String composeFile)
    • setContainerName

      public void setContainerName(String containerName)
    • setPgContainerName

      public void setPgContainerName(String n)
    • setMaxRetries

      public void setMaxRetries(int maxRetries)
    • setRetryIntervalMs

      public void setRetryIntervalMs(long ms)
    • execute

      public void execute() throws org.apache.tools.ant.BuildException
      Overrides:
      execute in class org.apache.tools.ant.Task
      Throws:
      org.apache.tools.ant.BuildException