Skip to content

Commit

Permalink
Merge pull request #2377 from kuzzleio/2.19.1-proposal
Browse files Browse the repository at this point in the history
# [2.19.3](https://github.com/kuzzleio/kuzzle/releases/tag/2.19.3) (2022-08-08)


#### Bug fixes

- [ [#2372](#2372) ] Allow to use vault key from env   ([Aschen](https://github.com/Aschen))

#### Enhancements

- [ [#2376](#2376) ] Add type for BackendPlugin.get   ([Aschen](https://github.com/Aschen))
- [ [#2364](#2364) ] Better notification dispatch pipe   ([Shiranuit](https://github.com/Shiranuit))
- [ [#2329](#2329) ] Add kuzzle config settings for internal index's number of shards and replicas   ([ChillPC](https://github.com/ChillPC))
  • Loading branch information
Adrien Maret authored Aug 9, 2022
2 parents 18fd4e1 + 5190711 commit 3ba51d0
Show file tree
Hide file tree
Showing 29 changed files with 20,454 additions and 8,385 deletions.
2 changes: 1 addition & 1 deletion .ci/privatebuild/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN set -x \
\
&& echo "Patch version" \
&& jq ' .version="'${KUZZLE_VERSION}'" ' package.json > package.json.tmp && mv package.json.tmp package.json \
&& jq ' .version="'${KUZZLE_VERSION}'" ' npm-shrinkwrap.json > npm-shrinkwrap.json.tmp && mv npm-shrinkwrap.json.tmp npm-shrinkwrap.json \
&& jq ' .version="'${KUZZLE_VERSION}'" ' package-lock.json > package-lock.json.tmp && mv package-lock.json.tmp package-lock.json \
\
&& echo "Replace koncorde with last commit from security branch" \
&& npm uninstall koncorde \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/workflow-deployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/npm-shrinkwrap.json') }}
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ env.NODE_LTS_CURRENT_VERSION }}-${{ hashFiles('**/npm-shrinkwrap.json') }}
key: ${{ runner.os }}-${{ env.NODE_LTS_CURRENT_VERSION }}-${{ hashFiles('**/package-lock.json') }}
- run: npm install
- name: Test error codes
run: ./.ci/scripts/check-error-codes-documentation.sh
Expand All @@ -94,7 +94,7 @@ jobs:
- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/npm-shrinkwrap.json') }}
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
- uses: ./.github/actions/es-lint

unit-tests:
Expand All @@ -113,7 +113,7 @@ jobs:
- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/npm-shrinkwrap.json') }}
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
- uses: ./.github/actions/unit-tests
env:
NODE_VERSION: ${{ matrix.node-version }}
Expand All @@ -139,7 +139,7 @@ jobs:
- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/npm-shrinkwrap.json') }}
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
- uses: ./.github/actions/build-and-run-kuzzle
with:
KUZZLE_IMAGE: ${{ matrix.kuzzle-image }}
Expand All @@ -161,7 +161,7 @@ jobs:
- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/npm-shrinkwrap.json') }}
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
- uses: ./.github/actions/functional-tests
with:
test-set: test:functional:${{ matrix.test_set }}
Expand All @@ -188,7 +188,7 @@ jobs:
- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/npm-shrinkwrap.json') }}
key: ${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
- uses: ./.github/actions/monkey-tests
with:
node-version: ${{ matrix.node-version }}
Expand Down
99 changes: 70 additions & 29 deletions .kuzzlerc.sample
Original file line number Diff line number Diff line change
Expand Up @@ -779,57 +779,98 @@
}
},
// Internal index default name and collections
// When starting, at initialisation, kuzzle will attempt
// to update all ES dynamic settings of existing internal
// index's collections. Static settings are setted only at
// creation.
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.5/index-modules.html#index-modules-settings
"internalIndex": {
"name": "kuzzle",
"collections": {
"dynamic": "false",
"users": {
"properties": {
"profileIds": { "type": "keyword" }
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"dynamic": "false",
"properties": {
"profileIds": { "type": "keyword" }
}
}
},
"profiles": {
"dynamic": "false",
"properties": {
"policies": {
"properties": {
"roleId": { "type": "keyword" }
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"dynamic": "false",
"properties": {
"policies": {
"properties": {
"roleId": { "type": "keyword" }
}
}
}
}
},
"roles": {
"dynamic": "false",
"properties": {
"controllers": {
"dynamic": "false",
"properties": {}
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"dynamic": "false",
"properties": {
"controllers": {
"dynamic": "false",
"properties": {}
}
}
}
},
"validations": {
"properties": {
"index": { "type": "keyword" },
"collection": { "type": "keyword" },
"validations": {
"dynamic": "false",
"properties": {}
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"properties": {
"index": { "type": "keyword" },
"collection": { "type": "keyword" },
"validations": {
"dynamic": "false",
"properties": {}
}
}
}
},
"config": {
"dynamic": "false",
"properties": {}
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"dynamic": "false",
"properties": {}
}
},
"api-keys": {
"dynamic": "false",
"properties": {
"userId": { "type": "keyword" },
"hash": { "type": "keyword" },
"expiresAt": { "type": "long" },
"ttl": { "type": "keyword" },
"description": { "type": "text" },
"token": { "type": "keyword" }
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"dynamic": "false",
"properties": {
"userId": { "type": "keyword" },
"hash": { "type": "keyword" },
"expiresAt": { "type": "long" },
"ttl": { "type": "keyword" },
"description": { "type": "text" },
"token": { "type": "keyword" }
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions doc/2/api/errors/error-codes/services/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ description: Error codes definitions
| services.storage.multiple_indice_alias<br/><pre>0x01010030</pre> | [PreconditionError](/core/2/api/errors/error-codes#preconditionerror) <pre>(412)</pre> | An %s is not allowed to be associated with multiple %s. This is probably not linked to this request but rather the consequence of previous actions on ElasticSearch. | The unique association between an indice and its alias has not been respected |
| services.storage.invalid_multi_index_collection_usage<br/><pre>0x01010031</pre> | [BadRequestError](/core/2/api/errors/error-codes#badrequesterror) <pre>(400)</pre> | Searches on multiple collections should be achieved with the "targets" argument who contains list of indexes and collections to search within. | Searches on multiple collections should be achieved with the "targets" argument who contains list of indexes and collections to search within. |
| services.storage.invalid_target_format<br/><pre>0x01010032</pre> | [BadRequestError](/core/2/api/errors/error-codes#badrequesterror) <pre>(400)</pre> | The %s ("%s") contains invalid characters ",+*" or is equal to "_all" which is forbidden | When a target index or collections contains invalid characters used for multi index search or "_all" |
| services.storage.wrong_es_static_settings_for_collection_recreation<br/><pre>0x01010033</pre> | [BadRequestError](/core/2/api/errors/error-codes#badrequesterror) <pre>(400)</pre> | Attempt to recreate an existing collection %s of index %s of scope %s with non matching static setting : %s at %s while existing one is at %s | The ES static settings specified at the creation of an existing collection does not match existing settings |

---

Expand Down
4 changes: 2 additions & 2 deletions doc/2/framework/classes/backend-plugin/get/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description: BackendPlugin.get method
Gets the instance of an already loaded plugin.

```ts
get (name: string): Plugin
get<TPlugin extends Plugin> (name: string): TPlugin
```
<br/>
Expand All @@ -24,5 +24,5 @@ get (name: string): Plugin
## Usage
```js
const mailerPlugin = app.plugin.get('mailer');
const mailerPlugin = app.plugin.get<MailerPlugin>('mailer');
```
65 changes: 65 additions & 0 deletions doc/2/framework/classes/mutex/wait/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
code: false
type: page
title: wait
description: Mutex class wait() method
---

# wait

<SinceBadge version="2.19.1"/>

```js
async wait ({ attemptDelay = this.attemptDelay, timeout = this.timeout }): Promise<boolean> {
```
Wait for the ressource specified in the promise to be unlocked.
<br/>
| Arguments | Type | Description |
| ------------------- | ----------------- | -------------------------------------------------------------------------------------------- |
| `options` | <pre>object</pre> | (optional) Mutex override options (see below) |
### options
The `options` object is used to override some mutex properties for this function. The following properties can be provided:
| Option | Type | Description |
| -------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------- |
| `attemptDelay` | <pre>number</pre> | (default: `this.attemptDelay`) Delay in milliseconds between resource check attempts |
| `timeout` | <pre>number</pre> | (default: `this.timeout`) Mutex check attempt timeout, in milliseconds. If set to 0, wait will return immediately, whether it the resource is locked within the 1st attempt. If set to -1, the mutex will wait for the resource to be free indefinitely |
<br/>
## Returns
True if the ressource has been unlocked before the `timeout`
---
## Usage
Waiting indefinitely until a resource is available:
```ts
import { Mutex } from 'kuzzle';

async function ConcurrentAccessMethod () {
const mutex = new Mutex(
'concurrentAccessMethodResource', { timeout: 0 });

if (await mutex.lock())) {
try {
// Initialize shared stuff
}
finally {
await mutex.unlock();
}
}
}
else {
mutex.wait({ timeout: -1 }); // Wait for shared stuff to be initialized
}
}
```
Loading

0 comments on commit 3ba51d0

Please sign in to comment.