Skip to content

Commit 2c3908e

Browse files
authored
Merge pull request #1960 from biozshock/ruflin-8
Transition bundle to Ruflin:^8 to allow Elasticsearch v8
2 parents f073151 + 59797d1 commit 2c3908e

File tree

83 files changed

+1121
-877
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+1121
-877
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
version: '3.8'
2+
3+
services:
4+
elasticsearch:
5+
container_name: elasticsearch
6+
image: docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION:-8.11.1}
7+
command: >
8+
/bin/sh -c "(./bin/elasticsearch-plugin list | grep -q ingest-attachment || ./bin/elasticsearch-plugin install --batch ingest-attachment) && /usr/local/bin/docker-entrypoint.sh"
9+
environment:
10+
node.name: elasticsearch
11+
cluster.name: es-docker-cluster
12+
cluster.initial_master_nodes: elasticsearch
13+
discovery.seed_hosts: elasticsearch
14+
bootstrap.memory_lock: 'true'
15+
xpack.security.enabled: 'false'
16+
action.destructive_requires_name: 'false'
17+
indices.id_field_data.enabled: 'true'
18+
ES_JAVA_OPTS: -Xms512m -Xmx512m
19+
path.repo: /usr/share/elasticsearch/repository
20+
ulimits:
21+
memlock:
22+
soft: -1
23+
hard: -1
24+
volumes:
25+
- data01:/usr/share/elasticsearch/data
26+
- esrepo:/usr/share/elasticsearch/repository
27+
ports:
28+
- 9200:9200
29+
networks:
30+
- elastic
31+
volumes:
32+
data01:
33+
data02:
34+
esrepo:
35+
driver_opts:
36+
type: tmpfs
37+
device: tmpfs
38+
o: "uid=1000,gid=0"
39+
40+
networks:
41+
elastic:
42+
driver: bridge
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: '3.4'
2+
3+
services:
4+
proxy:
5+
container_name: proxy
6+
image: nginx:1.17-alpine
7+
volumes:
8+
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
9+
ports:
10+
- 8000:8000
11+
- 8001:8001
12+
networks:
13+
- elastic
14+
15+
networks:
16+
elastic:
17+
driver: bridge

.github/docker/nginx/nginx.conf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
worker_processes 1;
2+
3+
events {
4+
worker_connections 1024;
5+
}
6+
7+
http {
8+
# Default proxy
9+
server {
10+
listen 8000;
11+
location / {
12+
proxy_pass http://es01:9200;
13+
}
14+
}
15+
16+
# Additional proxy always returning 403
17+
server {
18+
listen 8001;
19+
location / {
20+
return 403;
21+
}
22+
}
23+
}

.github/workflows/continuous-integration.yaml

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ jobs:
66
name: 'Coding style'
77
steps:
88
- name: 'Checkout'
9-
uses: 'actions/checkout@v2'
9+
uses: 'actions/checkout@v4'
1010

1111
- name: 'Setup PHP'
1212
uses: 'shivammathur/setup-php@v2'
1313
with:
1414
php-version: '8.1'
1515
coverage: 'none'
1616
extensions: 'json, mbstring, tokenizer'
17-
tools: 'composer-normalize, php-cs-fixer:3.8.0'
17+
tools: 'composer-normalize, php-cs-fixer:3.60.0'
1818

1919
- name: 'Display tools versions'
2020
run: |
@@ -29,38 +29,32 @@ jobs:
2929
if: 'always()'
3030

3131
phpunit:
32-
runs-on: 'ubuntu-20.04'
32+
runs-on: 'ubuntu-24.04'
3333
name: 'PHPUnit (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }} + ${{ matrix.dependencies }} deps, ES ${{ matrix.elasticsearch }})'
3434
timeout-minutes: 10
3535
env:
3636
SYMFONY_REQUIRE: "${{ matrix.symfony }}"
3737
strategy:
3838
matrix:
3939
php:
40-
- '7.4'
4140
- '8.1'
4241
- '8.2'
4342
- '8.3'
4443
- '8.4'
4544
symfony:
46-
- '5.4.*'
4745
- '6.4.*'
4846
- '7.1.*'
4947
elasticsearch:
50-
- '7.11.0'
48+
- '8.12.0'
5149
dependencies:
5250
- 'highest'
5351
exclude:
54-
- php: '7.4'
55-
symfony: '7.1.*'
56-
- php: '7.4'
57-
symfony: '6.4.*'
5852
- php: '8.1'
5953
symfony: '7.1.*'
6054
fail-fast: false
6155
steps:
6256
- name: 'Checkout'
63-
uses: 'actions/checkout@v2'
57+
uses: 'actions/checkout@v4'
6458

6559
- name: 'Setup PHP'
6660
uses: 'shivammathur/setup-php@v2'
@@ -71,20 +65,22 @@ jobs:
7165
extensions: 'curl, json, mbstring, mongodb, openssl'
7266

7367
- name: "Install Composer dependencies (${{ matrix.dependencies }})"
74-
uses: "ramsey/composer-install@v1"
68+
uses: "ramsey/composer-install@v3"
7569
with:
7670
dependency-versions: "${{ matrix.dependencies }}"
7771
composer-options: "--prefer-dist --prefer-stable"
7872

7973
- name: 'Setup Elasticsearch'
74+
env:
75+
ES_VERSION: "${{ matrix.elasticsearch }}"
8076
run: |
8177
sudo swapoff -a
8278
sudo sysctl -w vm.swappiness=1
8379
sudo sysctl -w fs.file-max=262144
8480
sudo sysctl -w vm.max_map_count=262144
85-
docker network create elastic
86-
docker run -d --name=elasticsearch --network=elastic -p 9200:9200 -e discovery.type=single-node -e node.name=es docker.elastic.co/elasticsearch/elasticsearch:${{ matrix.elasticsearch }} sh -c "./bin/elasticsearch-plugin install --batch ingest-attachment && /usr/local/bin/docker-entrypoint.sh"
87-
docker run --rm --network=elastic curlimages/curl --max-time 120 --retry-max-time 120 --retry 120 --retry-delay 5 --retry-all-errors --show-error --silent http://elasticsearch:9200
81+
docker compose --file=.github/docker/docker-compose.proxy.yml --file=.github/docker/docker-compose.es.yml up --detach
82+
83+
docker run --rm --network=docker_elastic curlimages/curl --max-time 120 --retry-max-time 120 --retry 120 --retry-delay 5 --retry-all-errors --show-error --silent http://elasticsearch:9200
8884
8985
- name: 'Run unit tests'
9086
run: |
@@ -99,35 +95,27 @@ jobs:
9995
strategy:
10096
matrix:
10197
php:
102-
- '7.4'
10398
- '8.1'
10499
- '8.2'
105100
- '8.3'
106101
- '8.4'
107102
symfony:
108-
- '5.4.*'
109103
- '6.4.*'
110104
- '7.1.*'
111105
dependencies:
112106
- 'highest'
113107
include:
114-
- php: '7.4'
108+
- php: '8.1'
115109
dependencies: 'lowest'
116-
symfony: '5.4.*'
117-
exclude:
118-
- php: '7.4'
119-
symfony: '7.1.*'
120-
- php: '7.4'
121110
symfony: '6.4.*'
111+
exclude:
122112
- php: '8.1'
123113
symfony: '7.1.*'
124-
- php: '8.1'
125-
symfony: '4.4.*'
126114

127115
fail-fast: false
128116
steps:
129117
- name: 'Checkout'
130-
uses: 'actions/checkout@v2'
118+
uses: 'actions/checkout@v4'
131119

132120
- name: 'Setup PHP'
133121
uses: 'shivammathur/setup-php@v2'
@@ -138,7 +126,7 @@ jobs:
138126
extensions: 'curl, json, mbstring, mongodb, openssl'
139127

140128
- name: "Install Composer dependencies (${{ matrix.dependencies }})"
141-
uses: "ramsey/composer-install@v1"
129+
uses: "ramsey/composer-install@v3"
142130
with:
143131
dependency-versions: "${{ matrix.dependencies }}"
144132
composer-options: "--prefer-dist --prefer-stable"

CHANGELOG-7.0.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
CHANGELOG for 7.x
2+
===================
3+
4+
This changelog references the relevant changes (bug and security fixes) done
5+
in 7.x versions.
6+
7+
### 7.0.0-BETA1 (2025-0X-XX)
8+
9+
* Dropped support for PHP 7.4 and PHP 8.0.
10+
* Dropped support for Symfony 5.4.
11+
* **[BC break]** Method `FOS\ElasticaBundle\Elastica\Client::request` does not exist anymore. Please use `FOS\ElasticaBundle\Elastica\Client::sendRequest`.
12+
* **[BC break]** Method `FOS\ElasticaBundle\Elastica\Client::getIndex` now returns `FOS\ElasticaBundle\Elastica\Index`.
13+
* **[BC break]** Arguments for the service `FOS\ElasticaBundle\Elastica\Client` have changed. See definition of `FOS\ElasticaBundle\Elastica\Client::__construct`.
14+
* **[BC break]** Client configuration now reflects configuration of `Elastica\Client`.
15+
* **[BC break]** Index template configuration `index_template` option `template` is renamed to `index_patterns` and accepts array of strings.
16+
* **[BC break]** Arguments for the service `FOS\ElasticaBundle\Elastica\Client` (`fos_elastica.client..`) are now named, instead of indexed.
17+
* **[BC break]** Configuration options: `host`, `port`, `url` are no longer available and replaced with single `hosts`.
18+
* **[BC break]** Configuration options: `proxy`, `auth_type`, `aws_*`, `ssl`, `curl`, `persistent`, `compression`, `connectTimeout` are no longer available.
19+
* **[BC break]** Configuration `connectionStrategy` is renamed to `connection_strategy`.
20+
* **[BC break]** Event `PostElasticaRequestEvent` now operates with `Psr\Http\Message\RequestInterface` instead of `Elastica\Request`.
21+
* **[BC break]** Event `ElasticaRequestExceptionEvent` now operates with `Psr\Http\Message\RequestInterface` instead of `Elastica\Request`, and `Elastic\Elasticsearch\Exception\ElasticsearchException` instead of `Elastica\Exception\ExceptionInterface`.
22+
23+
Main change is the configuration of the bundle:
24+
* There are no `connections` level anymore.
25+
* Options `host`, `port` and `url` are replaced with option `hosts`, which accepts array.
26+
* SSL configuration is provided within `client_config` option.
27+
* Other client options are configurable in `client_options`.
28+
* Refer to new examples! [Elastica HTTP client configuration](doc/cookbook/elastica-http-client-configuration.md)

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ Installation instructions can be found in the [documentation](doc/setup.md)
2828
Versions & Dependencies
2929
-----------------------
3030

31-
Version 6 of the FOSElasticaBundle is compatible with Elasticsearch 7. It requires Symfony 5.4 or greater. When using
31+
Version 7 of the FOSElasticaBundle is compatible with Elasticsearch 8. It requires Symfony 6.4 or greater. When using
3232
Symfony Flex there is also a [recipe to ease the setup](https://github.com/symfony/recipes-contrib/tree/master/friendsofsymfony/elastica-bundle/5.0).
3333
Earlier versions of the FOSElasticaBundle are not maintained anymore and only work with older versions of the dependencies.
3434
The following table shows the compatibilities of different versions of the bundle.
3535

36-
| FOSElasticaBundle | Elastica | Elasticsearch | Symfony | PHP |
37-
| --------------------------------------------------------------------------------------- | ---------| ------------- | ---------- | ----- |
38-
| [6.6] (master) | ^7.1 | 7.\* | ^5.4\|^6.4\|^7.1 | ^7.4\|^8.1 |
36+
| FOSElasticaBundle | Elastica | Elasticsearch | Symfony | PHP |
37+
|-------------------|----------|---------------| ---------- | ----- |
38+
| [6.6] (6.x) | ^7.1 | 7.\* | ^5.4\|^6.4\|^7.1 | ^7.4\|^8.1 |
39+
| [7.0] (master) | ^8.0 | 8.\* | ^6.4\|^7.1 | ^8.1 |
3940

4041
License
4142
-------

composer.json

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,42 @@
3030
],
3131
"homepage": "https://github.com/FriendsOfSymfony/FOSElasticaBundle",
3232
"require": {
33-
"php": "^7.4 || ^8.1",
34-
"pagerfanta/pagerfanta": "^2.4 || ^3.0 || ^4.0",
35-
"psr/log": "^1.0 || ^2.0 || ^3.0",
36-
"ruflin/elastica": "^7.1",
37-
"symfony/console": "^5.4 || ^6.4 || ^7.1",
38-
"symfony/dependency-injection": "^5.4 || ^6.4 || ^7.1",
39-
"symfony/event-dispatcher": "^5.4 || ^6.4 || ^7.1",
40-
"symfony/framework-bundle": "^5.4 || ^6.4 || ^7.1",
41-
"symfony/property-access": "^5.4 || ^6.4 || ^7.1",
42-
"symfony/stopwatch": "^5.4 || ^6.4 || ^7.1"
33+
"php": "^8.1",
34+
"pagerfanta/pagerfanta": "^3.0 || ^4.0",
35+
"psr/log": "^3.0",
36+
"ruflin/elastica": "^8.0",
37+
"symfony/console": "^6.4 || ^7.1",
38+
"symfony/dependency-injection": "^6.4 || ^7.1",
39+
"symfony/event-dispatcher": "^6.4 || ^7.1",
40+
"symfony/framework-bundle": "^6.4 || ^7.1",
41+
"symfony/property-access": "^6.4 || ^7.1",
42+
"symfony/stopwatch": "^6.4 || ^7.1"
4343
},
4444
"require-dev": {
4545
"doctrine/doctrine-bundle": "^2.1.1",
4646
"doctrine/mongodb-odm": "^2.2",
4747
"doctrine/orm": "^2.8 || ^3.2",
4848
"doctrine/phpcr-odm": "^1.5.3 || ^2.0",
4949
"ergebnis/composer-normalize": "^2.28",
50-
"jackalope/jackalope-doctrine-dbal": "^1.2 || ^2.0",
51-
"jms/serializer": "^3.8",
52-
"jms/serializer-bundle": "^4.0 || ^5.0",
53-
"knplabs/knp-components": "^2.4 || ^3.0 || ^4.0",
54-
"php-cs-fixer/shim": "3.8.0",
50+
"jackalope/jackalope-doctrine-dbal": "^2.0",
51+
"jms/serializer": "^3.32",
52+
"jms/serializer-bundle": "^5.0",
53+
"knplabs/knp-components": "^4.0 || ^5.0",
54+
"php-cs-fixer/shim": "3.60.0",
5555
"phpstan/extension-installer": "^1.1",
56-
"phpstan/phpstan": "^1.4",
57-
"phpstan/phpstan-phpunit": "^1.1",
58-
"phpstan/phpstan-symfony": "^1.2",
56+
"phpstan/phpstan": "^1.12",
57+
"phpstan/phpstan-phpunit": "^1.4",
58+
"phpstan/phpstan-symfony": "^1.4",
5959
"phpunit/phpunit": "^9.5",
60-
"symfony/expression-language": "^5.4 || ^6.4 || ^7.1",
61-
"symfony/messenger": "^5.4 || ^6.4 || ^7.1",
62-
"symfony/serializer": "^5.4 || ^6.4 || ^7.1",
63-
"symfony/twig-bundle": "^5.4 || ^6.4 || ^7.1",
64-
"symfony/web-profiler-bundle": "^5.4 || ^6.4 || ^7.1",
65-
"symfony/yaml": "^5.4 || ^6.4 || ^7.1"
60+
"symfony/expression-language": "^6.4 || ^7.1",
61+
"symfony/messenger": "^6.4 || ^7.1",
62+
"symfony/serializer": "^6.4 || ^7.1",
63+
"symfony/twig-bundle": "^6.4 || ^7.1",
64+
"symfony/web-profiler-bundle": "^6.4 || ^7.1",
65+
"symfony/yaml": "^6.4 || ^7.1"
66+
},
67+
"conflict": {
68+
"phpstan/phpstan": "<1.12.0"
6669
},
6770
"suggest": {
6871
"enqueue/elastica-bundle": "For populating Elasticsearch indexes asynchronously and using significanly less resources. Uses Enqueue.",

doc/cookbook/compression.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

doc/cookbook/custom-repositories.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ To use the custom repository specify it in the mapping for the entity:
2626
```yaml
2727
fos_elastica:
2828
clients:
29-
default: { host: localhost, port: 9200 }
29+
default: { hosts: ['http://localhost:9200'] }
3030
indexes:
3131
user:
3232
client: default

0 commit comments

Comments
 (0)