# RESTHeart Docker Compose Configuration # Runs RESTHeart with MongoDB in replica set mode name: restheart services: # RESTHeart API server restheart: image: softinstigate/restheart:latest environment: # RHO (RESTHeart Overrides) - Override default configuration # Uses semicolon-separated XPath expressions to modify config # Note: Arrays use XPath 1.0 indexing (1-based, not 0-based) # Uncomment the commented line below to override the default mount and expose all databases at root RHO: > /mclient/connection-string->"mongodb://mongodb"; /http-listener/host->"0.0.0.0"; # /mongo/mongo-mounts[1]->{"what":"*","where":"/"}; # Wait for MongoDB to be healthy before starting depends_on: mongodb: condition: service_healthy ports: - "8080:8080" # Expose RESTHeart API on http://localhost:8080 # MongoDB database server mongodb: image: mongo:8.0 # Run as replica set (required for change streams and transactions) command: ["--bind_ip_all", "--replSet", "rs0"] # Health check to initialize replica set healthcheck: test: [ "CMD", "mongosh", "--quiet", "--eval", "'if (!rs.isMaster().ismaster) { rs.initiate(); }'", ] interval: 5s # Check every 5 seconds timeout: 10s # Wait up to 10 seconds for response retries: 5 # Retry 5 times before marking unhealthy start_period: 5s # Grace period before health checks start