Skip to content

Do not start ES by default #24

Closed
Closed

Description

@PGijsbers

Current behavior starts ES by default whenever the PHP REST API is needed. This is, I think, a historical artifact of the fact that the PHP API used to need Elastic Search to function for operations which updated documents.

I propose to make the default startup for (most) common (php-)api setups to exclude elastic search.
Starting the elasticsearch service takes quite a bit of time, especially if the container needs to be pulled and/or the indices need to be regenerated. However only the frontend service needs elasticsearch, assuming we update the PHP default to disable its dependency.
This would drastically reduce the default start up time, which is very useful in many test scenarios (local, CI) -- basically any scenario that doesn't require the frontend. Those methods currently need to turn off elastic search explicitly.

I propose to update the openml/php-rest-api image to update the startup script to optionally not start the apache server and simply exit on completion of creating and populating indices. We could then define the services as such in docker-compose.yaml:

elasticsearch_startup:
  image: openml/php-rest-api:v1.2.11+
  environment:
	  ES_ENABLED: true
	  INDEX_ES_DURING_STARTUP: true
	  START_SERVER: false

elasticsearch:
  depends_on:
    elasticsearch_startup: 
      condition: service_completed_successfully 

php-api:
  ...
  environment:
    INDEX_ES_DURING_STARTUP: false  # We should probably just simplify the startup script to make ES_ENABLED: false sufficient.
  
frontend:
  ...
  depends_on:
    elasticsearch:
      condition: service_healthy
    php-api:
      condition: service_healthy
    

This would allow testing the frontend from the default compose file, even if the default php-api service will no longer require indices being created.
If we updated config/php/.env to include ES_ENABLED=false then by default the PHP API and any services that depend on it no longer depend on ES indirectly. This also means that e.g., updates aren't reflected on the website (which uses ES) but it can still be turned back on easily enough for those test cases.
It would be true that with this setup php-api doesn't depend on elasticsearch even if ES_ENABLED is false. For this, I would recommend simply using a profile which includes elasticsearch_startup. While the container will still be live earlier, the docker compose up command won't complete until indexing is complete which in most cases should be enough of a safeguard. Alternatively, we keep a docker-compose.X.yaml around which defines an extension of the php-api services which does depend on elasticsearch_startup.

Activity

  1. PGijsbers commented on Oct 22, 2026

    @PGijsbers
    ContributorAuthor

    Closed by #26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions