Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elasticsearch 8 #2548

Merged
merged 66 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
6753640
feat(storage): upgrade to the Elasticsearch 8 client
Kuruyia Jan 4, 2024
50bfe58
fix(storage): update more types
Kuruyia Jan 4, 2024
9ce4aa4
test: fix StorageClient maxRetries
Kuruyia Jan 5, 2024
7c8d5b6
test: fix ES mock client
Kuruyia Jan 5, 2024
4a8038e
feat: only support ES 8.x
Kuruyia Jan 5, 2024
dfb83b7
chore: update gitignore
Kuruyia Jan 5, 2024
fcb6ad8
test: fix unit tests
Kuruyia Jan 5, 2024
a18d454
feat(storage): add more types, fix some requests
Kuruyia Jan 5, 2024
dc74696
Merge branch '2-dev' of github.com:kuzzleio/kuzzle into feat/es8
rolljee Jan 16, 2024
e472d9e
chore(elasticsearch): type elasticsearch.ts file
rolljee Jan 16, 2024
bdcce96
feat(es8): elasticsearch 8 unit tests & functional tests running
rolljee Jan 18, 2024
19a8086
Merge branch '2-dev' into feat/es8
rolljee Feb 12, 2024
e12c35a
feat(es8): support both es7 and es8
rolljee Feb 13, 2024
0fac6fe
docs(documentation): add a new panel to talk about ES8
rolljee Feb 14, 2024
312536f
test(lint): fix lint, modifying the command
rolljee Feb 14, 2024
de154ba
chore(gitignore): modify the gitignore and eslintignore files
rolljee Feb 14, 2024
bc95c25
chore(pipeline): remove the matrix for the lint, it is unnecessary
rolljee Feb 14, 2024
b426a01
style(linting): lint the application
rolljee Feb 14, 2024
6078b1f
chore(typescript): add typescript types, update deps, reinstall
rolljee Feb 14, 2024
56d1b53
chore(renaming): rename elasticsearch.ts to Elasticsearch.ts
rolljee Feb 15, 2024
1f4d1e8
feat(elasticsearch8): tests unit are now okay
rolljee Feb 26, 2024
b03ec88
style(elasticsearch 8): linting the application
rolljee Feb 27, 2024
1b45505
refactor(elasticsearch 8): refactoring deprecated methods
rolljee Feb 27, 2024
929adef
chore(elasticsearch 8): linting the app
rolljee Feb 27, 2024
ea9b9a6
test(pipeline): test against Elasticsearch 7 and 8
rolljee Mar 4, 2024
16fa788
chore(pipeline): typo inside the workflow.yaml
rolljee Mar 4, 2024
a429884
chore(pipeline): fix an issue in workflow.yaml
rolljee Mar 4, 2024
abd0cb0
chore(pipeline): typo in workflow.yaml
rolljee Mar 4, 2024
4b4a511
chore(elasticsearch 8): remove unwanted console.log
rolljee Mar 4, 2024
25c8910
test(pipeline): good Major_Version for ES
rolljee Mar 4, 2024
2d51dad
test(tests): unit testing fixes
rolljee Mar 4, 2024
f8351cd
test(pipeline): fix issues to pass es version
rolljee Mar 4, 2024
356b677
chore(pipeline): fixing typo
rolljee Mar 4, 2024
8012099
chore(pipeline): typo in variable for workflow.yaml
rolljee Mar 4, 2024
0514aff
test(pipeline): fixing environment variable for docker-compose
rolljee Mar 4, 2024
570c44c
test(doco): fixing docker compose files
rolljee Mar 4, 2024
ec98b89
test(pipeline): uncomment code to properly build kuzzle
rolljee Mar 5, 2024
4e525ba
test(tests): functional tests
rolljee Mar 5, 2024
a2283ed
ci(pipeline): update checkout@v3 to checkout@v4
rolljee Mar 5, 2024
05f5d4e
test(pipeline): typo in action.yaml build and run kuzzle
rolljee Mar 6, 2024
626c375
docs(es8): update documentation about ES8, with requested changes
rolljee Mar 12, 2024
d48b687
chore(releaserc): add a new branch elasticsearch-8 in releaserc to pu…
rolljee Mar 12, 2024
dac364a
test(test): fixing tests file
rolljee Mar 18, 2024
52f7582
docs(docs): add compose override and modify contributing
rolljee Mar 21, 2024
43eeeba
docs(docs): update documentation with a general migration guide
rolljee Mar 28, 2024
4d41108
docs(documentation): update the migration guide
rolljee Mar 28, 2024
7b609e6
Added documentation on how to upgrade project to elasticsearch in dev…
etrousset May 14, 2024
f087160
Added more documentation on how to upgrade project to elasticsearch i…
etrousset May 14, 2024
e763392
fix(conflicts): merge conflict
rolljee May 14, 2024
9f31d31
Merge branch 'feat/es8' of github.com:kuzzleio/kuzzle into feat/es8
rolljee May 14, 2024
e5e2683
chore(import): fixing import issues
rolljee May 14, 2024
50f2cac
fix(tests): fixing unit tests
rolljee May 14, 2024
8286522
fix(es8): update deployment to allow elasticsearch-8 package to be de…
rolljee May 15, 2024
e59cedd
fix(es8): add elasticsearch-8 in listened branches
rolljee May 15, 2024
2fc9cc2
chore(release): 2.31.0-elasticsearch-8.1 [skip ci]
semantic-release-bot May 15, 2024
d3263d1
docs(log): add a log to know which ES configuration is set up
cyrng Jun 21, 2024
f849e2c
fix(ci): indent to pass linter
cyrng Jun 24, 2024
d56ee72
Merge pull request #2538 from kuzzleio/feat/es8
cyrng Jun 24, 2024
f651632
chore(release): 2.31.0-elasticsearch-8.2 [skip ci]
semantic-release-bot Jun 24, 2024
d501577
chore(merge): merge 2-dev, OK
rolljee Aug 28, 2024
4943d54
chore(linting): linting the app
rolljee Aug 28, 2024
b2bd142
chore(lint): linting the app again
rolljee Aug 28, 2024
1822be2
chore(release): 2.32.0-elasticsearch-8.1 [skip ci]
semantic-release-bot Aug 28, 2024
3403a28
refactor(typescript): move queryTranslator to ts and export it
rolljee Aug 28, 2024
20d70f3
Merge branch 'elasticsearch-8' of github.com:kuzzleio/kuzzle into ela…
rolljee Aug 28, 2024
8115e64
chore: add queryTranslator.js to the gitignore
Kuruyia Aug 30, 2024
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
34 changes: 16 additions & 18 deletions .ci/scripts/run-monkey-tests.sh
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
#!/bin/bash

set -ex
echo "Testing Kuzzle against node v$NODE_VERSION"

if [ -z "$NODE_VERSION" ];
then
echo "Missing NODE_VERSION, use default NODE_20_VERSION"
export NODE_VERSION=$NODE_20_VERSION
if [ "$ES_VERSION" == "7" ]; then
YML_FILE='./.ci/test-cluster-7.yml'
elif [ "$ES_VERSION" == "8" ]; then
YML_FILE='./.ci/test-cluster-8.yml'
else
echo "Invalid ES_VERSION. It should be either '7' or '8'."
exit 1
fi

echo "Testing Kuzzle against node v$NODE_VERSION"

docker compose -f ./.ci/test-cluster.yml down -v
docker compose -f $YML_FILE down -v

echo "Installing dependencies..."
docker compose -f ./.ci/test-cluster.yml run --rm kuzzle_node_1 npm ci
docker compose -f $YML_FILE run --rm kuzzle_node_1 npm ci

if [ "$REBUILD" == "true" ];
then
docker compose -f ./.ci/test-cluster.yml run --rm kuzzle_node_1 npm rebuild
if [ "$REBUILD" == "true" ]; then
docker compose -f $YML_FILE run --rm kuzzle_node_1 npm rebuild
fi

docker compose -f ./.ci/test-cluster.yml run --rm kuzzle_node_1 npm run build
docker compose -f $YML_FILE run --rm kuzzle_node_1 npm run build

echo "[$(date)] - Starting Kuzzle Cluster..."

trap 'docker compose -f ./.ci/test-cluster.yml logs' err
trap 'docker compose -f $YML_FILE logs' err

docker compose -f ./.ci/test-cluster.yml up -d
docker compose -f $YML_FILE up -d

# don't wait on 7512: nginx will accept connections far before Kuzzle does
KUZZLE_PORT=17510 ./bin/wait-kuzzle
Expand All @@ -39,4 +37,4 @@ echo "Installing Kuzzle Monkey Tester..."

cd kuzzle-monkey-tests
npm ci
node index.js
node index.js
24 changes: 16 additions & 8 deletions .ci/scripts/run-test-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

set -ex


if [ -z "$NODE_VERSION" ];
then
echo "Missing NODE_VERSION, use default NODE_20_VERSION"
Expand All @@ -11,23 +10,32 @@ fi

echo "Testing Kuzzle against node v$NODE_VERSION"

docker compose -f ./.ci/test-cluster.yml down -v
if [ "$ES_VERSION" == "7" ]; then
YML_FILE='./.ci/test-cluster-7.yml'
elif [ "$ES_VERSION" == "8" ]; then
YML_FILE='./.ci/test-cluster-8.yml'
else
echo "Invalid ES_VERSION. It should be either '7' or '8'."
exit 1
fi

docker compose -f $YML_FILE down -v

echo "Installing dependencies..."
docker compose -f ./.ci/test-cluster.yml run --rm kuzzle_node_1 npm ci
docker compose -f $YML_FILE run --rm kuzzle_node_1 npm ci

if [ "$REBUILD" == "true" ];
then
docker compose -f ./.ci/test-cluster.yml run --rm kuzzle_node_1 npm rebuild
docker compose -f $YML_FILE run --rm kuzzle_node_1 npm rebuild
fi

docker compose -f ./.ci/test-cluster.yml run --rm kuzzle_node_1 npm run build
docker compose -f $YML_FILE run --rm kuzzle_node_1 npm run build

echo "[$(date)] - Starting Kuzzle Cluster..."

trap 'docker compose -f ./.ci/test-cluster.yml logs' err
trap 'docker compose -f $YML_FILE logs' err

docker compose -f ./.ci/test-cluster.yml up -d
docker compose -f $YML_FILE up -d

# don't wait on 7512: nginx will accept connections far before Kuzzle does
KUZZLE_PORT=17510 ./bin/wait-kuzzle
Expand All @@ -36,4 +44,4 @@ KUZZLE_PORT=17512 ./bin/wait-kuzzle

trap - err

npm run $KUZZLE_FUNCTIONAL_TESTS
npm run $KUZZLE_FUNCTIONAL_TESTS
1 change: 1 addition & 0 deletions .ci/services.yml → .ci/services-7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ services:
sysctls:
- net.core.somaxconn=8192
environment:
- kuzzle_services__storageEngine__majorVersion=7
- kuzzle_services__storageEngine__client__node=http://elasticsearch:9200
- kuzzle_services__internalCache__node__host=redis
- kuzzle_services__memoryStorage__node__host=redis
Expand Down
40 changes: 40 additions & 0 deletions .ci/services-8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: '3'

services:
kuzzle:
build:
dockerfile: ./docker/images/${KUZZLE_IMAGE}/Dockerfile
context: ..
command: ["kuzzle", "start"]
cap_add:
- SYS_PTRACE
ulimits:
nofile: 65536
sysctls:
- net.core.somaxconn=8192
environment:
- kuzzle_services__storageEngine__majorVersion=8
- kuzzle_services__storageEngine__client__node=http://elasticsearch:9200
- kuzzle_services__internalCache__node__host=redis
- kuzzle_services__memoryStorage__node__host=redis
depends_on:
- redis
- elasticsearch
ports:
- "7512:7512"

redis:
image: redis:6

elasticsearch:
image: elasticsearch:8.11.3
environment:
- xpack.security.enabled=false
- action.destructive_requires_name=false
- cluster.name=kuzzle
- node.name=alyx
- discovery.type=single-node
- ingest.geoip.downloader.enabled=false
- indices.id_field_data.enabled=true
ports:
- '9200:9200'
1 change: 1 addition & 0 deletions .ci/test-cluster.yml → .ci/test-cluster-7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ x-kuzzle-config: &kuzzle-config
- redis
- elasticsearch
environment:
- kuzzle_services__storageEngine__majorVersion=7
- kuzzle_services__storageEngine__client__node=http://elasticsearch:9200
- kuzzle_services__storageEngine__commonMapping__dynamic=true
- kuzzle_services__internalCache__node__host=redis
Expand Down
81 changes: 81 additions & 0 deletions .ci/test-cluster-8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
version: '3.4'

x-kuzzle-config: &kuzzle-config
image: kuzzleio/kuzzle-runner:${NODE_VERSION:-20}
command: >
bash -c "
node ./docker/scripts/start-kuzzle-test.js --enable-plugins kuzzle-plugin-cluster,functional-test-plugin
"
volumes:
- "..:/var/app"
cap_add:
- SYS_PTRACE
ulimits:
nofile: 65536
sysctls:
- net.core.somaxconn=8192
depends_on:
- redis
- elasticsearch
environment:
- kuzzle_services__storageEngine__majorVersion=8
- kuzzle_services__storageEngine__client__node=http://elasticsearch:9200
- kuzzle_services__storageEngine__commonMapping__dynamic=true
- kuzzle_services__internalCache__node__host=redis
- kuzzle_services__memoryStorage__node__host=redis
- kuzzle_server__protocols__mqtt__enabled=true
- kuzzle_server__protocols__mqtt__developmentMode=false
- kuzzle_http__accessControlAllowOrigin=localhost
- kuzzle_limits__loginsPerSecond=50
- kuzzle_server__protocols__http__additionalContentTypes=*json:["application/x-yaml"]
- NODE_ENV=development
- NODE_VERSION=${NODE_VERSION:-20}
- DEBUG=none
- SECRETS_FILE_PREFIX=/var/app/
# cluster
- kuzzle_plugins__cluster__privileged=true
- kuzzle_plugins__cluster__minimumNodes=3

services:
nginx:
image: nginx:1.19-alpine
depends_on:
- kuzzle_node_1
- kuzzle_node_2
- kuzzle_node_3
ports:
- "7512:7512"
volumes:
- ../docker/nginx-dev:/etc/nginx/conf.d

kuzzle_node_1:
<<: *kuzzle-config
ports:
- "17510:7512"
- "1883:1883"

kuzzle_node_2:
<<: *kuzzle-config
ports:
- "17511:7512"

kuzzle_node_3:
<<: *kuzzle-config
ports:
- "17512:7512"

redis:
image: redis:6

elasticsearch:
image: elasticsearch:8.11.3
environment:
- xpack.security.enabled=false
- action.destructive_requires_name=false
- cluster.name=kuzzle
- node.name=alyx
- discovery.type=single-node
- ingest.geoip.downloader.enabled=false
- indices.id_field_data.enabled=true
ports:
- '9200:9200'
8 changes: 6 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ lib/types/Token.js
lib/types/User.js
lib/types/Global.d.ts
lib/types/Global.js
lib/types/storage/Elasticsearch.js
lib/types/storage/7/Elasticsearch.js
lib/types/storage/8/Elasticsearch.js
lib/util/interfaces.js
lib/util/mutex.js
lib/util/Inflector.js
Expand Down Expand Up @@ -126,7 +127,10 @@ lib/util/dump-collection.js
lib/api/controllers/debugController.js
lib/api/openapi/components/security/index.js
lib/config/documentEventAliases.js
lib/service/storage/elasticsearch.js
lib/service/storage/Elasticsearch.js
lib/service/storage/7/elasticsearch.js
lib/service/storage/8/elasticsearch.js
lib/service/storage/commons/queryTranslator.js
lib/types/DebugModule.js
lib/util/time.js
lib/util/async.js
Expand Down
49 changes: 44 additions & 5 deletions .github/actions/build-and-run-kuzzle/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ name: Build and Run Kuzzle image
description: Build and Run Kuzzle image

inputs:
KUZZLE_IMAGE:
kuzzle-image:
description: Kuzzle image target
required: true
es-version:
description: Elasticsearch version to use
required: true

runs:
using: "composite"
Expand All @@ -19,18 +22,54 @@ runs:
shell: bash

- run: |
export KUZZLE_IMAGE=${{ inputs.KUZZLE_IMAGE }}
docker compose -f ./.ci/services.yml up -d
export KUZZLE_IMAGE=${{ inputs.kuzzle-image }}
export ES_VERSION=${{ inputs.es-version }}

if [ "$ES_VERSION" == "7" ]; then
YML_FILE='./.ci/services-7.yml'
elif [ "$ES_VERSION" == "8" ]; then
YML_FILE='./.ci/services-8.yml'
else
echo "Invalid ES_VERSION. It should be either '7' or '8'."
exit 1
fi

docker compose -f $YML_FILE up -d
shell: bash

- run: |
trap 'docker compose -f ./.ci/services.yml logs' err
export KUZZLE_IMAGE=${{ inputs.kuzzle-image }}
export ES_VERSION=${{ inputs.es-version }}

if [ "$ES_VERSION" == "7" ]; then
YML_FILE='./.ci/services-7.yml'
elif [ "$ES_VERSION" == "8" ]; then
YML_FILE='./.ci/services-8.yml'
else
echo "Invalid ES_VERSION. It should be either '7' or '8'."
exit 1
fi

trap 'docker compose -f $YML_FILE logs' err

export MAX_TRIES=60
./bin/wait-kuzzle

trap - err
shell: bash

- run: docker compose -f ./.ci/services.yml down
- run: |
export KUZZLE_IMAGE=${{ inputs.kuzzle-image }}
export ES_VERSION=${{ inputs.es-version }}

if [ "$ES_VERSION" == "7" ]; then
YML_FILE='./.ci/services-7.yml'
elif [ "$ES_VERSION" == "8" ]; then
YML_FILE='./.ci/services-8.yml'
else
echo "Invalid ES_VERSION. It should be either '7' or '8'."
exit 1
fi

docker compose -f $YML_FILE down -v
shell: bash
4 changes: 4 additions & 0 deletions .github/actions/functional-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ inputs:
node-version:
description: Node version to use in the Kuzzle Docker image
required: true
es-version:
description: Elasticsearch version to use
required: true

runs:
using: "composite"
Expand All @@ -18,4 +21,5 @@ runs:
env:
KUZZLE_FUNCTIONAL_TESTS: ${{ inputs.test-set }}
NODE_VERSION: ${{ inputs.node-version }}
ES_VERSION: ${{ inputs.es-version }}
shell: bash
1 change: 1 addition & 0 deletions .github/actions/monkey-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ runs:
- run: ./.ci/scripts/run-monkey-tests.sh
env:
NODE_VERSION: ${{ inputs.node-version }}
ES_VERSION: ${{ inputs.es-version }}
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/core-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: core-dev image
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
name: Elasticsearch image
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down
Loading
Loading