diff --git a/README.md b/README.md index a72ee43..8060cd9 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,8 @@ You can use different profiles: - `"elasticsearch"`: databases + nginx + elasticsearch - `"rest-api"`: databases + nginx + elasticsearch + REST API - `"frontend"`: databases + nginx + elasticsearch + REST API + frontend + email-server -- `"minio"`: databases + nginx + elasticsearch + REST APP + MinIO + parquet and croissant conversion -- `"evaluation-engine"`: databases + nginx + elastichsearc + REST API + MinIO + evaluation engine +- `"minio"`: databases + nginx + elasticsearch + REST APP + MinIO + parquet and croissant conversion +- `"evaluation-engine"`: databases + nginx + elasticsearch + REST API + MinIO + evaluation engine - `"all"`: everything Usage examples: @@ -68,6 +68,11 @@ docker compose down ``` While it is up, the API is available under `http://localhost:8082`, e.g., `http://localhost:8082/datasets/1`. +Similarly, you can start the php-api directly without a profile to start it without elasticsearch: +```bash +docker compose up php-api -d +docker compose down +``` ## Known issues See the Github Issue list for the known issues. @@ -128,10 +133,6 @@ To test if dataset processing works, we can then run: ``` where `DATASET_ID` is replaced by the identifier printed in the previous step. -It is also possible to run the php-api without elasticsearch, this is useful to avoid the considerable overhead of starting the elasticsearch container and creating indices. -First, ensure that `INDEX_ES_DURING_STARTUP=false` in `config/php/.env` otherwise it will try to connect to elasticsearch and fail. -Then explicitly specify the compose file so that the `docker-compose.override.yaml` file will be ignored: `docker compose -f docker-compose.yaml php-api -d`. - ### PHP, Parquet and Croissant converter If you want to do local development on containers that are part of the docker-compose, you want those containers to change based on your code. You should have the relevant code somewhere on your system. You will need to tell the docker-compose where to find it. You can do so by setting environment variables. diff --git a/config/php/.env b/config/php/.env index 6b12ef8..13229b9 100644 --- a/config/php/.env +++ b/config/php/.env @@ -11,4 +11,5 @@ DB_USER_EXPDB_READ=root DB_PASS_EXPDB_READ=ok ES_URL=elasticsearch:9200 ES_PASSWORD=default -INDEX_ES_DURING_STARTUP=true +INDEX_ES=false +ES_ENABLED=false diff --git a/docker-compose.override.yaml b/docker-compose.override.yaml deleted file mode 100644 index 28aa7f5..0000000 --- a/docker-compose.override.yaml +++ /dev/null @@ -1,10 +0,0 @@ -services: - php-api: - environment: - ES_ENABLED: true - depends_on: - elasticsearch: - condition: service_healthy - - - diff --git a/docker-compose.yaml b/docker-compose.yaml index 278961f..d8fac54 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,8 @@ services: + x-php-image: &php-image + image: openml/php-rest-api:v1.3.1 + env_file: config/php/.env + database: image: "openml/test-database:v0.1.20260204" container_name: "openml-test-database" @@ -48,6 +52,19 @@ services: cpus: '0.2' memory: 250M + elasticsearch-indexer: + profiles: ["all", "minio", "rest-api", "frontend", "elasticsearch", "evaluation-engine"] + <<: *php-image + container_name: "openml-elasticsearch-indexer" + environment: + ES_ENABLED: true + INDEX_ES: true + depends_on: + elasticsearch: + condition: service_healthy + database-setup: + condition: service_completed_successfully + nginx: profiles: ["all", "minio", "rest-api", "frontend", "elasticsearch", "evaluation-engine"] build: @@ -62,13 +79,10 @@ services: php-api: profiles: ["all", "minio", "rest-api", "frontend", "evaluation-engine"] - image: openml/php-rest-api:v1.2.10 + <<: *php-image container_name: "openml-php-rest-api" ports: - "8080:80" # also known as /api (nginx) - env_file: config/php/.env - environment: - ES_ENABLED: false depends_on: database-setup: condition: service_completed_successfully @@ -149,6 +163,8 @@ services: depends_on: php-api: condition: service_healthy + elasticsearch-indexer: + condition: service_completed_successfully minio: profiles: ["all", "minio", "rest-api", "evaluation-engine"] diff --git a/scripts/wait_for_run.sh b/scripts/wait_for_run.sh index 9cecbd4..b5bc231 100755 --- a/scripts/wait_for_run.sh +++ b/scripts/wait_for_run.sh @@ -11,7 +11,7 @@ ELAPSED=0 while [ "$ELAPSED" -lt "$TIMEOUT" ]; do RESPONSE=$(curl -sS "http://localhost:8000/api/v1/xml/run/${RUN_ID}") - if echo "$RESPONSE" | grep -q "area_under_roc_curve"; then + if grep -q "area_under_roc_curve" <<< "$RESPONSE"; then echo "Run $RUN_ID has evaluations." exit 0 fi