Skip to content
Draft
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 .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
ESB_HTTP_SERVER_MAX_BODY_SIZE: 10485760
ESB_BEANSTALKD_URL: tcp://127.0.0.1:11300
ES_BASE_URI: http://127.0.0.1:9200
ES_USER: elastic
ES_PASSWORD: mySecretPassword

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"symfony/property-info": "^4.3",
"doctrine/annotations": "^1.8",
"ramsey/uuid": "^3.8",
"webgriffe/amp-elasticsearch": "^2.1",
"webgriffe/amp-elasticsearch": "dev-allow-es-authentication",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be changed to require the correct release version of webgriffe/amp-elasticsearch

"pagerfanta/pagerfanta": "^2.4",
"symfony/deprecation-contracts": "^2.1",
"amphp/http-server-form-parser": "^1.1"
Expand Down
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ services:
- "${MAILHOG_WEB_PORT_HOST}:8025"

elasticsearch:
image: "docker.elastic.co/elasticsearch/elasticsearch-oss:7.8.0"
image: 'elastic/elasticsearch:8.4.2'
env_file:
- .env
environment:
- "discovery.type=${ES_DISCOVERY_TYPE:-single-node}"
- "ES_JAVA_OPTS=${ES_JAVA_OPTS:--Xms512m -Xmx512m}"
- xpack.security.enabled=true
- action.destructive_requires_name= false # because in unit tests setup we delete all indexes, and wildcards and _all are not allowed with security enabled
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed: it needs to work also with this restriction active. We use _all wildcard in tests/KernelTestCase.php:106, but we could remove that, reading all indexes first (I think the _all wildcard is allowed when reading), and deleting them one by one.

- ELASTIC_PASSWORD=mySecretPassword
ports:
- "${ES_PORT_HOST}:9200"
2 changes: 2 additions & 0 deletions esb.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ parameters:
console_password: password # Web console password
console_log_file: /tmp/esb_console.log # Web console server log file
elasticsearch_base_uri: '%env(string:ES_BASE_URI)%' # ElasticSearch base URI (i.e. http://elasticsearch:9200)
elasticsearch_user: '%env(string:ES_USER)%' # ElasticSearch base URI (i.e. http://elasticsearch:9200)
elasticsearch_password: '%env(string:ES_PASSWORD)%' # ElasticSearch base URI (i.e. http://elasticsearch:9200)

services:
_defaults:
Expand Down
5 changes: 5 additions & 0 deletions services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ services:
Webgriffe\AmpElasticsearch\Client:
arguments:
$baseUri: '%elasticsearch_base_uri%'
calls:
- method: 'setCredentials'
arguments:
- '%elasticsearch_user%'
- '%elasticsearch_password%'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if someone is working with Elasticsearch without the security pack, meaning no user/password authentication is required? We need to ensure backward compatibility and support scenarios where a username and password are not provided.


annotation_reader:
class: \Doctrine\Common\Annotations\AnnotationReader
Expand Down
2 changes: 2 additions & 0 deletions services_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ parameters:
console_password: p4ssw0rd
console_log_file: ~
elasticsearch_base_uri: '%env(string:ES_BASE_URI)%'
elasticsearch_user: '%env(string:ES_USER)%'
elasticsearch_password: '%env(string:ES_PASSWORD)%'

imports:
- { resource: services.yml}
Expand Down
4 changes: 4 additions & 0 deletions tests/KernelTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ protected function setUp(): void
parent::setUp();
filesystem(new BlockingDriver());
$this->esClient = new Client(getenv('ES_BASE_URI') ?: 'http://127.0.0.1:9200');
$this->esClient->setCredentials(
getenv('ES_USERNAME') ?: 'elastic',
getenv('ES_PASSWORD') ?: 'mySecretPassword'
);
$this->elasticSearchReset();
}

Expand Down
Loading