kourou 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/README.md +4 -1
- package/lib/commands/app/doctor.js +2 -2
- package/lib/commands/es/aliases/cat.js +2 -2
- package/lib/commands/es/indices/cat.js +2 -2
- package/lib/commands/es/indices/get.js +2 -2
- package/lib/commands/es/indices/insert.js +2 -2
- package/lib/commands/es/migrate.d.ts +1 -0
- package/lib/commands/es/migrate.js +13 -1
- package/lib/commands/es/snapshot/create-repository.js +2 -2
- package/lib/commands/es/snapshot/create.js +2 -2
- package/lib/commands/es/snapshot/list.js +2 -2
- package/lib/commands/es/snapshot/restore.js +2 -2
- package/lib/commands/instance/spawn.js +0 -2
- package/lib/support/docker/checkPrerequisites.js +1 -5
- package/lib/support/migrate/providers/{elasticsearch.d.ts → elasticsearch7.d.ts} +2 -5
- package/lib/support/migrate/providers/{elasticsearch.js → elasticsearch7.js} +5 -5
- package/lib/support/migrate/providers/elasticsearch8.d.ts +14 -0
- package/lib/support/migrate/providers/elasticsearch8.js +115 -0
- package/lib/support/migrate/providers/elasticsearchTypes.d.ts +4 -0
- package/lib/support/migrate/providers/elasticsearchTypes.js +2 -0
- package/lib/support/migrate/providers/index.d.ts +2 -1
- package/lib/support/migrate/providers/index.js +2 -1
- package/package.json +3 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025 Kuzzle SAS
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ $ npm install -g kourou
|
|
|
27
27
|
$ kourou COMMAND
|
|
28
28
|
running command...
|
|
29
29
|
$ kourou (-v|--version|version)
|
|
30
|
-
kourou/1.
|
|
30
|
+
kourou/1.2.0 linux-x64 node-v22.16.0
|
|
31
31
|
$ kourou --help [COMMAND]
|
|
32
32
|
USAGE
|
|
33
33
|
$ kourou COMMAND
|
|
@@ -717,6 +717,7 @@ OPTIONS
|
|
|
717
717
|
--batch-size=batch-size [default: 1000] How many documents to move in batch per operation
|
|
718
718
|
--dest=dest (required) Migration destination provider
|
|
719
719
|
--dry-run Print witch collections will be migrated
|
|
720
|
+
--esVersion=7|8 [default: 7] Elasticsearch version to use for the migration
|
|
720
721
|
--help show CLI help
|
|
721
722
|
--no-interactive Skip confirmation interactive prompts (perfect for scripting)
|
|
722
723
|
--only-mappings Only migrate mappings
|
|
@@ -734,6 +735,8 @@ EXAMPLES
|
|
|
734
735
|
kourou es:migrate --src http://elasticsearch:9200 --dest ./my-backup --batch-size 2000 --pattern
|
|
735
736
|
'&myindexes.collection-*'
|
|
736
737
|
kourou es:migrate --src ./my-backup --dest http://elasticsearch:9200 --reset --batch-size 2000 --no-interactive
|
|
738
|
+
kourou es:migrate --src ./my-backup --dest http://elasticsearch:9200 --reset --batch-size 2000 --no-interactive
|
|
739
|
+
--esVersion 8
|
|
737
740
|
```
|
|
738
741
|
|
|
739
742
|
_See code: [lib/commands/es/migrate.js](lib/commands/es/migrate.js)_
|
|
@@ -4,7 +4,7 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const command_1 = require("@oclif/command");
|
|
5
5
|
const common_1 = require("../../common");
|
|
6
6
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
7
|
-
const
|
|
7
|
+
const sdk_es7_1 = require("sdk-es7");
|
|
8
8
|
const execute_1 = require("../../support/execute");
|
|
9
9
|
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
10
10
|
const checkPrerequisites_1 = require("../../support/docker/checkPrerequisites");
|
|
@@ -124,7 +124,7 @@ class AppDoctor extends common_1.Kommand {
|
|
|
124
124
|
this.logKo(`=> ElasticSearch version ${elkVersion} is not compatible with Kuzzle (max version is ${this.ELK_MAX_VERSION})`);
|
|
125
125
|
suggestions.push(`Downgrade ElasticSearch to a compatible version (max: ${this.ELK_MAX_VERSION})`);
|
|
126
126
|
}
|
|
127
|
-
const client = new
|
|
127
|
+
const client = new sdk_es7_1.Client({ node: this.flags.elasticsearch });
|
|
128
128
|
const info = await client.info();
|
|
129
129
|
this.log(`ElasticSearch checks`);
|
|
130
130
|
this.logOk(`Elasticsearch Cluster name: ${info.body.cluster_name}`);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const command_1 = require("@oclif/command");
|
|
4
|
-
const
|
|
4
|
+
const sdk_es7_1 = require("sdk-es7");
|
|
5
5
|
const common_1 = require("../../../common");
|
|
6
6
|
class EsListAliases extends common_1.Kommand {
|
|
7
7
|
async runSafe() {
|
|
8
|
-
const esClient = new
|
|
8
|
+
const esClient = new sdk_es7_1.Client({ node: this.flags.node });
|
|
9
9
|
try {
|
|
10
10
|
const { body } = await esClient.cat.aliases({ format: 'json' });
|
|
11
11
|
const elements = body
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const command_1 = require("@oclif/command");
|
|
4
|
-
const
|
|
4
|
+
const sdk_es7_1 = require("sdk-es7");
|
|
5
5
|
const common_1 = require("../../../common");
|
|
6
6
|
class EsListIndex extends common_1.Kommand {
|
|
7
7
|
async runSafe() {
|
|
8
|
-
const esClient = new
|
|
8
|
+
const esClient = new sdk_es7_1.Client({ node: this.flags.node });
|
|
9
9
|
try {
|
|
10
10
|
const { body } = await esClient.cat.indices({ format: "json" });
|
|
11
11
|
// nice typescript destructuring syntax (:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const command_1 = require("@oclif/command");
|
|
4
|
-
const
|
|
4
|
+
const sdk_es7_1 = require("sdk-es7");
|
|
5
5
|
const common_1 = require("../../../common");
|
|
6
6
|
class EsGet extends common_1.Kommand {
|
|
7
7
|
async runSafe() {
|
|
8
|
-
const esClient = new
|
|
8
|
+
const esClient = new sdk_es7_1.Client({ node: this.flags.node });
|
|
9
9
|
const esRequest = {
|
|
10
10
|
index: this.args.index,
|
|
11
11
|
id: this.args.id,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const command_1 = require("@oclif/command");
|
|
4
|
-
const
|
|
4
|
+
const sdk_es7_1 = require("sdk-es7");
|
|
5
5
|
const common_1 = require("../../../common");
|
|
6
6
|
class EsInsert extends common_1.Kommand {
|
|
7
7
|
async runSafe() {
|
|
8
|
-
const esClient = new
|
|
8
|
+
const esClient = new sdk_es7_1.Client({ node: this.flags.node });
|
|
9
9
|
const esRequest = {
|
|
10
10
|
index: this.args.index,
|
|
11
11
|
id: this.flags.id,
|
|
@@ -14,6 +14,7 @@ export default class EsMigrate extends Kommand {
|
|
|
14
14
|
pattern: flags.IOptionFlag<string | undefined>;
|
|
15
15
|
scroll: flags.IOptionFlag<string>;
|
|
16
16
|
"only-mappings": import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
17
|
+
esVersion: flags.IOptionFlag<string>;
|
|
17
18
|
};
|
|
18
19
|
static examples: string[];
|
|
19
20
|
private src;
|
|
@@ -17,7 +17,13 @@ class EsMigrate extends common_1.Kommand {
|
|
|
17
17
|
}
|
|
18
18
|
async detectProviderType(provider) {
|
|
19
19
|
if ((0, providers_1.isURL)(provider)) {
|
|
20
|
-
|
|
20
|
+
if (this.flags.esVersion === "8") {
|
|
21
|
+
return new providers_1.Elasticsearch8(provider, {
|
|
22
|
+
batchSize: this.flags["batch-size"],
|
|
23
|
+
scrollDuration: this.flags.scroll,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return new providers_1.Elasticsearch7(provider, {
|
|
21
27
|
batchSize: this.flags["batch-size"],
|
|
22
28
|
scrollDuration: this.flags.scroll,
|
|
23
29
|
});
|
|
@@ -143,6 +149,11 @@ EsMigrate.flags = {
|
|
|
143
149
|
description: "Only migrate mappings",
|
|
144
150
|
default: false,
|
|
145
151
|
}),
|
|
152
|
+
esVersion: command_1.flags.string({
|
|
153
|
+
description: "Elasticsearch version to use for the migration",
|
|
154
|
+
default: "7",
|
|
155
|
+
options: ["7", "8"],
|
|
156
|
+
}),
|
|
146
157
|
};
|
|
147
158
|
EsMigrate.examples = [
|
|
148
159
|
"kourou es:migrate --src http://elasticsearch:9200 --dest ./my-backup",
|
|
@@ -151,4 +162,5 @@ EsMigrate.examples = [
|
|
|
151
162
|
"kourou es:migrate --src ./my-backup --dest http://nologin:api-key@elasticsearch:9200 --reset // nologin is a special username that allows you to use an API key as password",
|
|
152
163
|
"kourou es:migrate --src http://elasticsearch:9200 --dest ./my-backup --batch-size 2000 --pattern '&myindexes.collection-*'",
|
|
153
164
|
"kourou es:migrate --src ./my-backup --dest http://elasticsearch:9200 --reset --batch-size 2000 --no-interactive",
|
|
165
|
+
"kourou es:migrate --src ./my-backup --dest http://elasticsearch:9200 --reset --batch-size 2000 --no-interactive --esVersion 8",
|
|
154
166
|
];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const command_1 = require("@oclif/command");
|
|
4
|
-
const
|
|
4
|
+
const sdk_es7_1 = require("sdk-es7");
|
|
5
5
|
const common_1 = require("../../../common");
|
|
6
6
|
class EsSnapshotsCreateRepository extends common_1.Kommand {
|
|
7
7
|
async runSafe() {
|
|
8
|
-
const esClient = new
|
|
8
|
+
const esClient = new sdk_es7_1.Client({ node: this.flags.node });
|
|
9
9
|
const esRequest = {
|
|
10
10
|
repository: this.args.repository,
|
|
11
11
|
verify: true,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const command_1 = require("@oclif/command");
|
|
4
|
-
const
|
|
4
|
+
const sdk_es7_1 = require("sdk-es7");
|
|
5
5
|
const common_1 = require("../../../common");
|
|
6
6
|
class EsSnapshotsCreate extends common_1.Kommand {
|
|
7
7
|
async runSafe() {
|
|
8
|
-
const esClient = new
|
|
8
|
+
const esClient = new sdk_es7_1.Client({ node: this.flags.node });
|
|
9
9
|
const esRequest = {
|
|
10
10
|
repository: this.args.repository,
|
|
11
11
|
snapshot: this.args.name,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const command_1 = require("@oclif/command");
|
|
4
|
-
const
|
|
4
|
+
const sdk_es7_1 = require("sdk-es7");
|
|
5
5
|
const common_1 = require("../../../common");
|
|
6
6
|
class EsSnapshotsList extends common_1.Kommand {
|
|
7
7
|
async runSafe() {
|
|
8
|
-
const esClient = new
|
|
8
|
+
const esClient = new sdk_es7_1.Client({ node: this.flags.node });
|
|
9
9
|
const esRequest = {
|
|
10
10
|
repository: this.args.repository,
|
|
11
11
|
ignore_unavailable: true,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const command_1 = require("@oclif/command");
|
|
4
|
-
const
|
|
4
|
+
const sdk_es7_1 = require("sdk-es7");
|
|
5
5
|
const common_1 = require("../../../common");
|
|
6
6
|
class EsSnapshotsRestore extends common_1.Kommand {
|
|
7
7
|
async runSafe() {
|
|
8
|
-
const esClient = new
|
|
8
|
+
const esClient = new sdk_es7_1.Client({ node: this.flags.node });
|
|
9
9
|
await esClient.indices.close({
|
|
10
10
|
index: "*",
|
|
11
11
|
expand_wildcards: "all",
|
|
@@ -12,8 +12,6 @@ const node_emoji_1 = (0, tslib_1.__importDefault)(require("node-emoji"));
|
|
|
12
12
|
const common_1 = require("../../common");
|
|
13
13
|
const execute_1 = require("../../support/execute");
|
|
14
14
|
const checkPrerequisites_1 = require("../../support/docker/checkPrerequisites");
|
|
15
|
-
const MIN_MAX_MAP_COUNT = 262144;
|
|
16
|
-
const MIN_DOCO_VERSION = "2.0.0";
|
|
17
15
|
const kuzzleStackV1 = (increment) => `
|
|
18
16
|
services:
|
|
19
17
|
kuzzle:
|
|
@@ -4,11 +4,10 @@ exports.checkPrerequisites = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const listr_1 = (0, tslib_1.__importDefault)(require("listr"));
|
|
6
6
|
const execute_1 = require("../execute");
|
|
7
|
-
const MIN_DOCO_VERSION = "2.0.0";
|
|
8
7
|
async function checkPrerequisites(ctx) {
|
|
9
8
|
const checks = new listr_1.default([
|
|
10
9
|
{
|
|
11
|
-
title: `docker compose exists
|
|
10
|
+
title: `docker compose exists`,
|
|
12
11
|
task: async () => {
|
|
13
12
|
const docov = await (0, execute_1.execute)("docker", "compose", "version");
|
|
14
13
|
const matches = docov.stdout.match(/[^0-9.]*([0-9.]*).*/);
|
|
@@ -17,9 +16,6 @@ async function checkPrerequisites(ctx) {
|
|
|
17
16
|
if (!docoVersion) {
|
|
18
17
|
throw new Error("Unable to read the version of Docker Compose. Are you sure Docker and the Compose plugin are installed?");
|
|
19
18
|
}
|
|
20
|
-
if (docoVersion < MIN_DOCO_VERSION) {
|
|
21
|
-
throw new Error(`Your version of Docker Compose (${docoVersion}) is below the required version (${MIN_DOCO_VERSION}).`);
|
|
22
|
-
}
|
|
23
19
|
},
|
|
24
20
|
},
|
|
25
21
|
]);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { Provider } from ".";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
batchSize: number;
|
|
5
|
-
};
|
|
6
|
-
export declare class Elasticsearch implements Provider {
|
|
2
|
+
import { ElasticsearchProviderOptions } from "./elasticsearchTypes";
|
|
3
|
+
export declare class Elasticsearch7 implements Provider {
|
|
7
4
|
private readonly client;
|
|
8
5
|
private readonly options;
|
|
9
6
|
constructor(url: string, options: ElasticsearchProviderOptions);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
class
|
|
3
|
+
exports.Elasticsearch7 = void 0;
|
|
4
|
+
const sdk_es7_1 = require("sdk-es7");
|
|
5
|
+
class Elasticsearch7 {
|
|
6
6
|
constructor(url, options) {
|
|
7
7
|
const { auth, url: cleanedUrl } = this.extractCredentials(url);
|
|
8
|
-
this.client = new
|
|
8
|
+
this.client = new sdk_es7_1.Client({
|
|
9
9
|
node: cleanedUrl,
|
|
10
10
|
auth,
|
|
11
11
|
});
|
|
@@ -105,4 +105,4 @@ class Elasticsearch {
|
|
|
105
105
|
await this.client.indices.delete({ index: "_all" });
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
exports.
|
|
108
|
+
exports.Elasticsearch7 = Elasticsearch7;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Provider } from ".";
|
|
2
|
+
import { ElasticsearchProviderOptions } from "./elasticsearchTypes";
|
|
3
|
+
export declare class Elasticsearch8 implements Provider {
|
|
4
|
+
private readonly client;
|
|
5
|
+
private readonly options;
|
|
6
|
+
constructor(url: string, options: ElasticsearchProviderOptions);
|
|
7
|
+
private extractCredentials;
|
|
8
|
+
listIndices(pattern?: string): Promise<string[]>;
|
|
9
|
+
getIndex(index: string): Promise<any>;
|
|
10
|
+
createIndex(index: string, specifications: any): Promise<void>;
|
|
11
|
+
readData(index: string, args: any): Promise<any>;
|
|
12
|
+
writeData(index: string, docs: any): Promise<number>;
|
|
13
|
+
clear(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Elasticsearch8 = void 0;
|
|
4
|
+
const sdk_es8_1 = require("sdk-es8");
|
|
5
|
+
class Elasticsearch8 {
|
|
6
|
+
constructor(url, options) {
|
|
7
|
+
const { auth, url: cleanedUrl } = this.extractCredentials(url);
|
|
8
|
+
this.client = new sdk_es8_1.Client({
|
|
9
|
+
node: cleanedUrl,
|
|
10
|
+
auth,
|
|
11
|
+
});
|
|
12
|
+
this.options = options;
|
|
13
|
+
}
|
|
14
|
+
extractCredentials(url) {
|
|
15
|
+
let auth = undefined;
|
|
16
|
+
if (url.includes("@")) {
|
|
17
|
+
const urlCleaned = url.replace(/https?:\/\//, "");
|
|
18
|
+
const [credentials] = urlCleaned.split("@");
|
|
19
|
+
const [username, password] = credentials.split(":");
|
|
20
|
+
if (!username || !password) {
|
|
21
|
+
throw new Error("Invalid credentials format. Expected format: username:password@url");
|
|
22
|
+
}
|
|
23
|
+
if (username === "nologin" && password) {
|
|
24
|
+
auth = {
|
|
25
|
+
apiKey: password,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
else if (username && password) {
|
|
29
|
+
auth = {
|
|
30
|
+
username,
|
|
31
|
+
password,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (url.startsWith("http://")) {
|
|
35
|
+
url = url.replace(/https?:\/\/[^@]+@/, "http://");
|
|
36
|
+
}
|
|
37
|
+
else if (url.startsWith("https://")) {
|
|
38
|
+
url = url.replace(/https?:\/\/[^@]+@/, "https://");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return { auth, url };
|
|
42
|
+
}
|
|
43
|
+
async listIndices(pattern) {
|
|
44
|
+
const body = await this.client.cat.indices({ format: "json" });
|
|
45
|
+
return body
|
|
46
|
+
.map((record) => record.index)
|
|
47
|
+
.filter((index) => index.match(pattern))
|
|
48
|
+
.filter((index) => !index.startsWith(".")) // ignore system indices
|
|
49
|
+
.sort();
|
|
50
|
+
}
|
|
51
|
+
async getIndex(index) {
|
|
52
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
53
|
+
const resp = await this.client.indices.get({ index });
|
|
54
|
+
// Remove unsupported settings properties
|
|
55
|
+
const specifications = resp[index];
|
|
56
|
+
(_b = (_a = specifications === null || specifications === void 0 ? void 0 : specifications.settings) === null || _a === void 0 ? void 0 : _a.index) === null || _b === void 0 ? true : delete _b.creation_date;
|
|
57
|
+
(_d = (_c = specifications === null || specifications === void 0 ? void 0 : specifications.settings) === null || _c === void 0 ? void 0 : _c.index) === null || _d === void 0 ? true : delete _d.provided_name;
|
|
58
|
+
(_f = (_e = specifications === null || specifications === void 0 ? void 0 : specifications.settings) === null || _e === void 0 ? void 0 : _e.index) === null || _f === void 0 ? true : delete _f.uuid;
|
|
59
|
+
(_h = (_g = specifications === null || specifications === void 0 ? void 0 : specifications.settings) === null || _g === void 0 ? void 0 : _g.index) === null || _h === void 0 ? true : delete _h.version;
|
|
60
|
+
(_k = (_j = specifications === null || specifications === void 0 ? void 0 : specifications.settings) === null || _j === void 0 ? void 0 : _j.index) === null || _k === void 0 ? true : delete _k.routing;
|
|
61
|
+
(_m = (_l = specifications === null || specifications === void 0 ? void 0 : specifications.settings) === null || _l === void 0 ? void 0 : _l.index) === null || _m === void 0 ? true : delete _m.history;
|
|
62
|
+
return specifications;
|
|
63
|
+
}
|
|
64
|
+
async createIndex(index, specifications) {
|
|
65
|
+
specifications.settings.write = {
|
|
66
|
+
wait_for_active_shards: 1, // Wait for at least one shard to be active before returning
|
|
67
|
+
};
|
|
68
|
+
await this.client.indices.create({ index, body: specifications });
|
|
69
|
+
}
|
|
70
|
+
async readData(index, args) {
|
|
71
|
+
var _a;
|
|
72
|
+
if (!args || !args.scrollId) {
|
|
73
|
+
const body = await this.client.search({
|
|
74
|
+
index,
|
|
75
|
+
scroll: this.options.scrollDuration,
|
|
76
|
+
body: {
|
|
77
|
+
query: {
|
|
78
|
+
match_all: {},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
size: this.options.batchSize,
|
|
82
|
+
});
|
|
83
|
+
return {
|
|
84
|
+
documents: body.hits.hits,
|
|
85
|
+
total: (_a = body === null || body === void 0 ? void 0 : body.hits) === null || _a === void 0 ? void 0 : _a.total,
|
|
86
|
+
scrollId: body._scroll_id,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const { hits, } = await this.client.scroll({
|
|
91
|
+
scroll_id: args.scrollId,
|
|
92
|
+
scroll: this.options.scrollDuration,
|
|
93
|
+
});
|
|
94
|
+
return hits.hits;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async writeData(index, docs) {
|
|
98
|
+
const bulk = [];
|
|
99
|
+
for (const doc of docs) {
|
|
100
|
+
bulk.push({ index: { _index: index, _id: doc._id } });
|
|
101
|
+
bulk.push(doc._source);
|
|
102
|
+
}
|
|
103
|
+
await this.client.bulk({ body: bulk });
|
|
104
|
+
return bulk.length / 2;
|
|
105
|
+
}
|
|
106
|
+
async clear() {
|
|
107
|
+
const indices = await this.listIndices();
|
|
108
|
+
if (indices.length === 0) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
// Delete all indices
|
|
112
|
+
await this.client.indices.delete({ index: indices.join(",") });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.Elasticsearch8 = Elasticsearch8;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isURL = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
(0, tslib_1.__exportStar)(require("./
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./elasticsearch7"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./elasticsearch8"), exports);
|
|
6
7
|
(0, tslib_1.__exportStar)(require("./file"), exports);
|
|
7
8
|
function isURL(str) {
|
|
8
9
|
try {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kourou",
|
|
3
3
|
"description": "The CLI that helps you manage your Kuzzle instances",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"author": "The Kuzzle Team <support@kuzzle.io>",
|
|
6
6
|
"bin": {
|
|
7
7
|
"kourou": "./bin/run"
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"test:functional:cucumber": "./node_modules/.bin/cucumber-js --fail-fast"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"
|
|
22
|
+
"sdk-es7": "npm:@elastic/elasticsearch@7.12.0",
|
|
23
|
+
"sdk-es8": "npm:@elastic/elasticsearch@8.17.1",
|
|
23
24
|
"@oclif/command": "1.8.*",
|
|
24
25
|
"@oclif/config": "1.18.*",
|
|
25
26
|
"@oclif/plugin-autocomplete": "1.3.*",
|