kourou 0.28.0 → 1.0.1-beta.1
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/README.md +21 -160
- package/lib/commands/app/scaffold.d.ts +1 -1
- package/lib/commands/app/scaffold.js +3 -3
- package/lib/commands/app/start-services.js +0 -2
- package/lib/commands/es/snapshot/create.js +5 -1
- package/lib/commands/{paas/deploy.d.ts → es/snapshot/restore.d.ts} +4 -5
- package/lib/commands/es/snapshot/restore.js +40 -0
- package/lib/commands/instance/spawn.js +0 -4
- package/lib/common.d.ts +2 -2
- package/lib/common.js +1 -2
- package/lib/support/PaasKommand.d.ts +0 -1
- package/lib/support/PaasKommand.js +0 -10
- package/lib/support/dump-collection.js +6 -1
- package/lib/support/kuzzle.d.ts +1 -1
- package/lib/support/kuzzle.js +1 -1
- package/package.json +57 -51
- package/lib/commands/paas/deploy.js +0 -57
- package/lib/commands/paas/elasticsearch/dump.d.ts +0 -35
- package/lib/commands/paas/elasticsearch/dump.js +0 -172
- package/lib/commands/paas/init.d.ts +0 -14
- package/lib/commands/paas/init.js +0 -35
- package/lib/commands/paas/logs.d.ts +0 -42
- package/lib/commands/paas/logs.js +0 -181
- package/lib/commands/paas/snapshots/cat.d.ts +0 -18
- package/lib/commands/paas/snapshots/cat.js +0 -46
- package/lib/commands/paas/snapshots/dump.d.ts +0 -18
- package/lib/commands/paas/snapshots/dump.js +0 -46
- package/lib/commands/paas/snapshots/restore.d.ts +0 -18
- package/lib/commands/paas/snapshots/restore.js +0 -51
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/0.
|
|
30
|
+
kourou/1.0.1-beta.1 linux-x64 node-v22.12.0
|
|
31
31
|
$ kourou --help [COMMAND]
|
|
32
32
|
USAGE
|
|
33
33
|
$ kourou COMMAND
|
|
@@ -149,6 +149,7 @@ All other arguments and options will be passed as-is to the `sdk:query` method.
|
|
|
149
149
|
* [`kourou es:snapshot:create REPOSITORY NAME`](#kourou-essnapshotcreate-repository-name)
|
|
150
150
|
* [`kourou es:snapshot:create-repository REPOSITORY LOCATION`](#kourou-essnapshotcreate-repository-repository-location)
|
|
151
151
|
* [`kourou es:snapshot:list REPOSITORY`](#kourou-essnapshotlist-repository)
|
|
152
|
+
* [`kourou es:snapshot:restore REPOSITORY NAME`](#kourou-essnapshotrestore-repository-name)
|
|
152
153
|
* [`kourou file:decrypt FILE`](#kourou-filedecrypt-file)
|
|
153
154
|
* [`kourou file:encrypt FILE`](#kourou-fileencrypt-file)
|
|
154
155
|
* [`kourou file:test FILE`](#kourou-filetest-file)
|
|
@@ -160,14 +161,7 @@ All other arguments and options will be passed as-is to the `sdk:query` method.
|
|
|
160
161
|
* [`kourou instance:list`](#kourou-instancelist)
|
|
161
162
|
* [`kourou instance:logs`](#kourou-instancelogs)
|
|
162
163
|
* [`kourou instance:spawn`](#kourou-instancespawn)
|
|
163
|
-
* [`kourou paas:deploy ENVIRONMENT APPLICATIONID IMAGE`](#kourou-paasdeploy-environment-applicationid-image)
|
|
164
|
-
* [`kourou paas:elasticsearch:dump ENVIRONMENT APPLICATIONID DUMPDIRECTORY`](#kourou-paaselasticsearchdump-environment-applicationid-dumpdirectory)
|
|
165
|
-
* [`kourou paas:init PROJECT`](#kourou-paasinit-project)
|
|
166
164
|
* [`kourou paas:login`](#kourou-paaslogin)
|
|
167
|
-
* [`kourou paas:logs ENVIRONMENT APPLICATION`](#kourou-paaslogs-environment-application)
|
|
168
|
-
* [`kourou paas:snapshots:cat ENVIRONMENT APPLICATIONID`](#kourou-paassnapshotscat-environment-applicationid)
|
|
169
|
-
* [`kourou paas:snapshots:dump ENVIRONMENT APPLICATIONID`](#kourou-paassnapshotsdump-environment-applicationid)
|
|
170
|
-
* [`kourou paas:snapshots:restore ENVIRONMENT APPLICATIONID SNAPSHOTID`](#kourou-paassnapshotsrestore-environment-applicationid-snapshotid)
|
|
171
165
|
* [`kourou profile:export`](#kourou-profileexport)
|
|
172
166
|
* [`kourou profile:import PATH`](#kourou-profileimport-path)
|
|
173
167
|
* [`kourou realtime:subscribe INDEX COLLECTION [FILTERS]`](#kourou-realtimesubscribe-index-collection-filters)
|
|
@@ -795,6 +789,25 @@ OPTIONS
|
|
|
795
789
|
|
|
796
790
|
_See code: [lib/commands/es/snapshot/list.js](lib/commands/es/snapshot/list.js)_
|
|
797
791
|
|
|
792
|
+
## `kourou es:snapshot:restore REPOSITORY NAME`
|
|
793
|
+
|
|
794
|
+
Restore a snapshot repository inside an ES instance
|
|
795
|
+
|
|
796
|
+
```
|
|
797
|
+
USAGE
|
|
798
|
+
$ kourou es:snapshot:restore REPOSITORY NAME
|
|
799
|
+
|
|
800
|
+
ARGUMENTS
|
|
801
|
+
REPOSITORY ES repository name
|
|
802
|
+
NAME ES snapshot name
|
|
803
|
+
|
|
804
|
+
OPTIONS
|
|
805
|
+
-n, --node=node [default: http://localhost:9200] Elasticsearch server URL
|
|
806
|
+
--help show CLI help
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
_See code: [lib/commands/es/snapshot/restore.js](lib/commands/es/snapshot/restore.js)_
|
|
810
|
+
|
|
798
811
|
## `kourou file:decrypt FILE`
|
|
799
812
|
|
|
800
813
|
Decrypts an encrypted file.
|
|
@@ -1044,63 +1057,6 @@ OPTIONS
|
|
|
1044
1057
|
|
|
1045
1058
|
_See code: [lib/commands/instance/spawn.js](lib/commands/instance/spawn.js)_
|
|
1046
1059
|
|
|
1047
|
-
## `kourou paas:deploy ENVIRONMENT APPLICATIONID IMAGE`
|
|
1048
|
-
|
|
1049
|
-
Deploy a new version of the application in the PaaS
|
|
1050
|
-
|
|
1051
|
-
```
|
|
1052
|
-
USAGE
|
|
1053
|
-
$ kourou paas:deploy ENVIRONMENT APPLICATIONID IMAGE
|
|
1054
|
-
|
|
1055
|
-
ARGUMENTS
|
|
1056
|
-
ENVIRONMENT Project environment name
|
|
1057
|
-
APPLICATIONID Application Identifier
|
|
1058
|
-
IMAGE Image name and hash as myimage:mytag
|
|
1059
|
-
|
|
1060
|
-
OPTIONS
|
|
1061
|
-
--help show CLI help
|
|
1062
|
-
--project=project Current PaaS project
|
|
1063
|
-
--token=token Authentication token
|
|
1064
|
-
```
|
|
1065
|
-
|
|
1066
|
-
_See code: [lib/commands/paas/deploy.js](lib/commands/paas/deploy.js)_
|
|
1067
|
-
|
|
1068
|
-
## `kourou paas:elasticsearch:dump ENVIRONMENT APPLICATIONID DUMPDIRECTORY`
|
|
1069
|
-
|
|
1070
|
-
Dump data from the Elasticsearch of a PaaS application
|
|
1071
|
-
|
|
1072
|
-
```
|
|
1073
|
-
USAGE
|
|
1074
|
-
$ kourou paas:elasticsearch:dump ENVIRONMENT APPLICATIONID DUMPDIRECTORY
|
|
1075
|
-
|
|
1076
|
-
ARGUMENTS
|
|
1077
|
-
ENVIRONMENT Project environment name
|
|
1078
|
-
APPLICATIONID Application Identifier
|
|
1079
|
-
DUMPDIRECTORY Directory where to store dump files
|
|
1080
|
-
|
|
1081
|
-
OPTIONS
|
|
1082
|
-
--batch-size=batch-size [default: 2000] Maximum batch size
|
|
1083
|
-
--help show CLI help
|
|
1084
|
-
--project=project Current PaaS project
|
|
1085
|
-
```
|
|
1086
|
-
|
|
1087
|
-
## `kourou paas:init PROJECT`
|
|
1088
|
-
|
|
1089
|
-
Initialize a PaaS project in current directory
|
|
1090
|
-
|
|
1091
|
-
```
|
|
1092
|
-
USAGE
|
|
1093
|
-
$ kourou paas:init PROJECT
|
|
1094
|
-
|
|
1095
|
-
ARGUMENTS
|
|
1096
|
-
PROJECT Kuzzle PaaS project name
|
|
1097
|
-
|
|
1098
|
-
OPTIONS
|
|
1099
|
-
--help show CLI help
|
|
1100
|
-
```
|
|
1101
|
-
|
|
1102
|
-
_See code: [lib/commands/paas/init.js](lib/commands/paas/init.js)_
|
|
1103
|
-
|
|
1104
1060
|
## `kourou paas:login`
|
|
1105
1061
|
|
|
1106
1062
|
Login for a PaaS project
|
|
@@ -1118,101 +1074,6 @@ OPTIONS
|
|
|
1118
1074
|
|
|
1119
1075
|
_See code: [lib/commands/paas/login.js](lib/commands/paas/login.js)_
|
|
1120
1076
|
|
|
1121
|
-
## `kourou paas:logs ENVIRONMENT APPLICATION`
|
|
1122
|
-
|
|
1123
|
-
Show logs of the targeted application
|
|
1124
|
-
|
|
1125
|
-
```
|
|
1126
|
-
USAGE
|
|
1127
|
-
$ kourou paas:logs ENVIRONMENT APPLICATION
|
|
1128
|
-
|
|
1129
|
-
ARGUMENTS
|
|
1130
|
-
ENVIRONMENT Kuzzle PaaS environment
|
|
1131
|
-
APPLICATION Kuzzle PaaS application
|
|
1132
|
-
|
|
1133
|
-
OPTIONS
|
|
1134
|
-
-f, --follow Follow log output
|
|
1135
|
-
-n, --tail=tail Number of lines to show from the end of the logs
|
|
1136
|
-
-t, --timestamp Show timestamp
|
|
1137
|
-
--help show CLI help
|
|
1138
|
-
--podName=podName Name of the pod to show logs from
|
|
1139
|
-
--project=project Current PaaS project
|
|
1140
|
-
--since=since Display logs from a specific absolute (e.g. 2022/12/02 09:41) or relative (e.g. a minute ago) time
|
|
1141
|
-
--until=until Display logs until a specific absolute (e.g. 2022/12/02 09:41) or relative (e.g. a minute ago) time
|
|
1142
|
-
```
|
|
1143
|
-
|
|
1144
|
-
_See code: [lib/commands/paas/logs.js](lib/commands/paas/logs.js)_
|
|
1145
|
-
|
|
1146
|
-
## `kourou paas:snapshots:cat ENVIRONMENT APPLICATIONID`
|
|
1147
|
-
|
|
1148
|
-
List all snapshots for a given kuzzle application in a environment
|
|
1149
|
-
|
|
1150
|
-
```
|
|
1151
|
-
USAGE
|
|
1152
|
-
$ kourou paas:snapshots:cat ENVIRONMENT APPLICATIONID
|
|
1153
|
-
|
|
1154
|
-
ARGUMENTS
|
|
1155
|
-
ENVIRONMENT Project environment name
|
|
1156
|
-
APPLICATIONID Application Identifier
|
|
1157
|
-
|
|
1158
|
-
OPTIONS
|
|
1159
|
-
--help show CLI help
|
|
1160
|
-
--project=project Current PaaS project
|
|
1161
|
-
--token=token Authentication token
|
|
1162
|
-
|
|
1163
|
-
EXAMPLE
|
|
1164
|
-
kourou paas:snapshots:cat --project paas-project-myproject api main
|
|
1165
|
-
```
|
|
1166
|
-
|
|
1167
|
-
_See code: [lib/commands/paas/snapshots/cat.js](lib/commands/paas/snapshots/cat.js)_
|
|
1168
|
-
|
|
1169
|
-
## `kourou paas:snapshots:dump ENVIRONMENT APPLICATIONID`
|
|
1170
|
-
|
|
1171
|
-
Create a new snapshot of the current application state
|
|
1172
|
-
|
|
1173
|
-
```
|
|
1174
|
-
USAGE
|
|
1175
|
-
$ kourou paas:snapshots:dump ENVIRONMENT APPLICATIONID
|
|
1176
|
-
|
|
1177
|
-
ARGUMENTS
|
|
1178
|
-
ENVIRONMENT Project environment name
|
|
1179
|
-
APPLICATIONID Application Identifier
|
|
1180
|
-
|
|
1181
|
-
OPTIONS
|
|
1182
|
-
--help show CLI help
|
|
1183
|
-
--project=project Current PaaS project
|
|
1184
|
-
--token=token Authentication token
|
|
1185
|
-
|
|
1186
|
-
EXAMPLE
|
|
1187
|
-
kourou paas:snapshots:dump --project paas-project-myproject api main
|
|
1188
|
-
```
|
|
1189
|
-
|
|
1190
|
-
_See code: [lib/commands/paas/snapshots/dump.js](lib/commands/paas/snapshots/dump.js)_
|
|
1191
|
-
|
|
1192
|
-
## `kourou paas:snapshots:restore ENVIRONMENT APPLICATIONID SNAPSHOTID`
|
|
1193
|
-
|
|
1194
|
-
Restore a snapshot of the current application state
|
|
1195
|
-
|
|
1196
|
-
```
|
|
1197
|
-
USAGE
|
|
1198
|
-
$ kourou paas:snapshots:restore ENVIRONMENT APPLICATIONID SNAPSHOTID
|
|
1199
|
-
|
|
1200
|
-
ARGUMENTS
|
|
1201
|
-
ENVIRONMENT Project environment name
|
|
1202
|
-
APPLICATIONID Application Identifier
|
|
1203
|
-
SNAPSHOTID Snapshot Identifier
|
|
1204
|
-
|
|
1205
|
-
OPTIONS
|
|
1206
|
-
--help show CLI help
|
|
1207
|
-
--project=project Current PaaS project
|
|
1208
|
-
--token=token Authentication token
|
|
1209
|
-
|
|
1210
|
-
EXAMPLE
|
|
1211
|
-
kourou paas:snapshots:restore --project paas-project-myproject api main snapshot-id
|
|
1212
|
-
```
|
|
1213
|
-
|
|
1214
|
-
_See code: [lib/commands/paas/snapshots/restore.js](lib/commands/paas/snapshots/restore.js)_
|
|
1215
|
-
|
|
1216
1077
|
## `kourou profile:export`
|
|
1217
1078
|
|
|
1218
1079
|
Exports profiles
|
|
@@ -19,5 +19,5 @@ export default class AppScaffold extends Kommand {
|
|
|
19
19
|
prepareTemplate(): Promise<void>;
|
|
20
20
|
cloneTemplate(flavor: string): Promise<void>;
|
|
21
21
|
copyTemplate(destination: string): Promise<void>;
|
|
22
|
-
cleanup(): Promise<void>;
|
|
22
|
+
cleanup(destination: string): Promise<void>;
|
|
23
23
|
}
|
|
@@ -32,7 +32,7 @@ class AppScaffold extends common_1.Kommand {
|
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
title: "Cleaning up",
|
|
35
|
-
task: async () => this.cleanup()
|
|
35
|
+
task: async () => this.cleanup(destination)
|
|
36
36
|
}
|
|
37
37
|
]);
|
|
38
38
|
await tasks.run();
|
|
@@ -41,7 +41,6 @@ class AppScaffold extends common_1.Kommand {
|
|
|
41
41
|
this.logOk(`Use ${chalk_1.default.blue.bold(`cd ${destination} && docker compose up -d`)} to start your Kuzzle stack.`);
|
|
42
42
|
}
|
|
43
43
|
getRepo(flavor) {
|
|
44
|
-
console.log(flavor);
|
|
45
44
|
switch (flavor) {
|
|
46
45
|
case "generic":
|
|
47
46
|
return "template-kuzzle-project";
|
|
@@ -76,8 +75,9 @@ class AppScaffold extends common_1.Kommand {
|
|
|
76
75
|
async copyTemplate(destination) {
|
|
77
76
|
await (0, execute_1.execute)("cp", "-r", `${this.templatesDir}/`, `${destination}/`);
|
|
78
77
|
}
|
|
79
|
-
async cleanup() {
|
|
78
|
+
async cleanup(destination) {
|
|
80
79
|
await (0, execute_1.execute)("rm", "-rf", this.templatesDir);
|
|
80
|
+
await (0, execute_1.execute)("rm", "-rf", `${destination}/.git`);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
exports.default = AppScaffold;
|
|
@@ -10,8 +10,6 @@ const common_1 = require("../../common");
|
|
|
10
10
|
const execute_1 = require("../../support/execute");
|
|
11
11
|
const checkPrerequisites_1 = require("../../support/docker/checkPrerequisites");
|
|
12
12
|
const kuzzleServicesFile = `
|
|
13
|
-
version: '3'
|
|
14
|
-
|
|
15
13
|
services:
|
|
16
14
|
redis:
|
|
17
15
|
image: redis:5
|
|
@@ -9,7 +9,11 @@ class EsSnapshotsCreate extends common_1.Kommand {
|
|
|
9
9
|
const esRequest = {
|
|
10
10
|
repository: this.args.repository,
|
|
11
11
|
snapshot: this.args.name,
|
|
12
|
-
body: {
|
|
12
|
+
body: {
|
|
13
|
+
indices: "*",
|
|
14
|
+
include_global_state: false,
|
|
15
|
+
partial: false,
|
|
16
|
+
},
|
|
13
17
|
};
|
|
14
18
|
const response = await esClient.snapshot.create(esRequest);
|
|
15
19
|
this.logOk(`Success ${JSON.stringify(response.body)}`);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { flags } from "@oclif/command";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { Kommand } from "../../../common";
|
|
3
|
+
export default class EsSnapshotsRestore extends Kommand {
|
|
4
|
+
static initSdk: boolean;
|
|
4
5
|
static description: string;
|
|
5
6
|
static flags: {
|
|
7
|
+
node: flags.IOptionFlag<string>;
|
|
6
8
|
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
7
|
-
token: flags.IOptionFlag<string | undefined>;
|
|
8
|
-
project: flags.IOptionFlag<string | undefined>;
|
|
9
9
|
};
|
|
10
10
|
static args: {
|
|
11
11
|
name: string;
|
|
@@ -14,4 +14,3 @@ declare class PaasDeploy extends PaasKommand {
|
|
|
14
14
|
}[];
|
|
15
15
|
runSafe(): Promise<void>;
|
|
16
16
|
}
|
|
17
|
-
export default PaasDeploy;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_1 = require("@oclif/command");
|
|
4
|
+
const elasticsearch_1 = require("@elastic/elasticsearch");
|
|
5
|
+
const common_1 = require("../../../common");
|
|
6
|
+
class EsSnapshotsRestore extends common_1.Kommand {
|
|
7
|
+
async runSafe() {
|
|
8
|
+
const esClient = new elasticsearch_1.Client({ node: this.flags.node });
|
|
9
|
+
await esClient.indices.close({
|
|
10
|
+
index: "*",
|
|
11
|
+
expand_wildcards: "all",
|
|
12
|
+
});
|
|
13
|
+
const esRequest = {
|
|
14
|
+
repository: this.args.repository,
|
|
15
|
+
snapshot: this.args.name,
|
|
16
|
+
body: {
|
|
17
|
+
feature_states: ["none"],
|
|
18
|
+
include_global_state: false,
|
|
19
|
+
indices: "*",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
const response = await esClient.snapshot.restore(esRequest);
|
|
23
|
+
this.logOk(`Success ${JSON.stringify(response.body)}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.default = EsSnapshotsRestore;
|
|
27
|
+
EsSnapshotsRestore.initSdk = false;
|
|
28
|
+
EsSnapshotsRestore.description = "Restore a snapshot repository inside an ES instance";
|
|
29
|
+
EsSnapshotsRestore.flags = {
|
|
30
|
+
node: command_1.flags.string({
|
|
31
|
+
char: "n",
|
|
32
|
+
description: "Elasticsearch server URL",
|
|
33
|
+
default: "http://localhost:9200",
|
|
34
|
+
}),
|
|
35
|
+
help: command_1.flags.help(),
|
|
36
|
+
};
|
|
37
|
+
EsSnapshotsRestore.args = [
|
|
38
|
+
{ name: "repository", description: "ES repository name", required: true },
|
|
39
|
+
{ name: "name", description: "ES snapshot name", required: true },
|
|
40
|
+
];
|
|
@@ -15,8 +15,6 @@ const checkPrerequisites_1 = require("../../support/docker/checkPrerequisites");
|
|
|
15
15
|
const MIN_MAX_MAP_COUNT = 262144;
|
|
16
16
|
const MIN_DOCO_VERSION = "2.0.0";
|
|
17
17
|
const kuzzleStackV1 = (increment) => `
|
|
18
|
-
version: '3'
|
|
19
|
-
|
|
20
18
|
services:
|
|
21
19
|
kuzzle:
|
|
22
20
|
image: kuzzleio/kuzzle:1
|
|
@@ -50,8 +48,6 @@ services:
|
|
|
50
48
|
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
|
|
51
49
|
`;
|
|
52
50
|
const kuzzleStackV2 = (increment) => `
|
|
53
|
-
version: '3'
|
|
54
|
-
|
|
55
51
|
services:
|
|
56
52
|
kuzzle:
|
|
57
53
|
image: kuzzleio/kuzzle:2
|
package/lib/common.d.ts
CHANGED
|
@@ -22,8 +22,8 @@ export declare abstract class Kommand extends Command {
|
|
|
22
22
|
logOk(message: string): void;
|
|
23
23
|
logInfo(message: string): void;
|
|
24
24
|
logKo(message?: string): void;
|
|
25
|
-
run(): Promise<
|
|
26
|
-
beforeConnect(): void
|
|
25
|
+
run(): Promise<void>;
|
|
26
|
+
beforeConnect(): Promise<void>;
|
|
27
27
|
runSafe(): Promise<void>;
|
|
28
28
|
/**
|
|
29
29
|
* Reads a value from STDIN.
|
package/lib/common.js
CHANGED
|
@@ -129,9 +129,8 @@ class Kommand extends command_1.Command {
|
|
|
129
129
|
this.sdk.disconnect();
|
|
130
130
|
process.exit(this.exitCode);
|
|
131
131
|
}
|
|
132
|
-
return this.exitCode;
|
|
133
132
|
}
|
|
134
|
-
beforeConnect() {
|
|
133
|
+
async beforeConnect() {
|
|
135
134
|
// will be called before connecting to Kuzzle
|
|
136
135
|
}
|
|
137
136
|
async runSafe() {
|
|
@@ -56,16 +56,6 @@ class PaasKommand extends common_1.Kommand {
|
|
|
56
56
|
}
|
|
57
57
|
return this.flags.project;
|
|
58
58
|
}
|
|
59
|
-
async getCredentials() {
|
|
60
|
-
const project = this.getProject();
|
|
61
|
-
const projectFile = this.fileProjectCredentials(project);
|
|
62
|
-
if (!fs_1.default.existsSync(projectFile)) {
|
|
63
|
-
this.logKo("You are not logged in. You should run paas:login first. Aborting.");
|
|
64
|
-
process.exit(1);
|
|
65
|
-
}
|
|
66
|
-
const credentials = JSON.parse(fs_1.default.readFileSync(projectFile, "utf8"));
|
|
67
|
-
return credentials.apiKey;
|
|
68
|
-
}
|
|
69
59
|
}
|
|
70
60
|
exports.PaasKommand = PaasKommand;
|
|
71
61
|
PaasKommand.initSdk = false;
|
|
@@ -245,7 +245,12 @@ async function dumpCollectionMappings(sdk, index, collection, destPath, format =
|
|
|
245
245
|
type: "mappings",
|
|
246
246
|
content: {
|
|
247
247
|
[index]: {
|
|
248
|
-
[collection]:
|
|
248
|
+
[collection]: {
|
|
249
|
+
mappings
|
|
250
|
+
// For later use, we could add the settings here
|
|
251
|
+
// eg: "settings": { "index.mapping.total_fields.limit": 10000 }
|
|
252
|
+
// This can be added after the dump and it will work with kourou:import command
|
|
253
|
+
},
|
|
249
254
|
},
|
|
250
255
|
},
|
|
251
256
|
};
|
package/lib/support/kuzzle.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare class KuzzleSDK {
|
|
|
40
40
|
(): Promise<void>;
|
|
41
41
|
}): Promise<void>;
|
|
42
42
|
disconnect(): void;
|
|
43
|
-
query(request: any): Promise<import("kuzzle-sdk").ResponsePayload<
|
|
43
|
+
query(request: any): Promise<import("kuzzle-sdk").ResponsePayload<JSONObject>>;
|
|
44
44
|
/**
|
|
45
45
|
* Query the Kuzzle API and return a streamed response.
|
|
46
46
|
* @param request The request to send to Kuzzle
|
package/lib/support/kuzzle.js
CHANGED
|
@@ -116,7 +116,7 @@ class KuzzleSDK {
|
|
|
116
116
|
const currentToken = this.sdk.jwt;
|
|
117
117
|
let apiKey;
|
|
118
118
|
try {
|
|
119
|
-
apiKey = await this.security.createApiKey(userKuid, "Kourou impersonation token", { expiresIn: "2h", refresh:
|
|
119
|
+
apiKey = await this.security.createApiKey(userKuid, "Kourou impersonation token", { expiresIn: "2h", refresh: "wait_for" });
|
|
120
120
|
this.sdk.jwt = apiKey._source.token;
|
|
121
121
|
await callback();
|
|
122
122
|
}
|
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": "0.
|
|
4
|
+
"version": "1.0.1-beta.1",
|
|
5
5
|
"author": "The Kuzzle Team <support@kuzzle.io>",
|
|
6
6
|
"bin": {
|
|
7
7
|
"kourou": "./bin/run"
|
|
@@ -19,64 +19,70 @@
|
|
|
19
19
|
"test:functional:cucumber": "./node_modules/.bin/cucumber-js --fail-fast"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@elastic/elasticsearch": "
|
|
22
|
+
"@elastic/elasticsearch": "7.12.0",
|
|
23
23
|
"@oclif/command": "1.8.*",
|
|
24
24
|
"@oclif/config": "1.18.*",
|
|
25
25
|
"@oclif/plugin-autocomplete": "1.3.*",
|
|
26
26
|
"@oclif/plugin-help": "3.2.2",
|
|
27
|
-
"bluebird": "
|
|
28
|
-
"chalk": "
|
|
29
|
-
"chrono-node": "
|
|
30
|
-
"cli-ux": "
|
|
31
|
-
"inquirer": "
|
|
32
|
-
"kepler-companion": "
|
|
33
|
-
"kuzzle-sdk": "
|
|
34
|
-
"kuzzle-vault": "
|
|
35
|
-
"listr": "
|
|
36
|
-
"lodash": "
|
|
37
|
-
"ndjson": "
|
|
38
|
-
"node-emoji": "
|
|
39
|
-
"node-fetch": "
|
|
40
|
-
"production": "
|
|
41
|
-
"strip-json-comments": "
|
|
42
|
-
"tar": "
|
|
43
|
-
"tmp": "
|
|
44
|
-
"tslib": "
|
|
45
|
-
"
|
|
46
|
-
"
|
|
27
|
+
"bluebird": "3.7.2",
|
|
28
|
+
"chalk": "4.1.0",
|
|
29
|
+
"chrono-node": "2.4.2",
|
|
30
|
+
"cli-ux": "5.5.1",
|
|
31
|
+
"inquirer": "8.0.0",
|
|
32
|
+
"kepler-companion": "1.1.3",
|
|
33
|
+
"kuzzle-sdk": "7.14.0",
|
|
34
|
+
"kuzzle-vault": "2.0.4",
|
|
35
|
+
"listr": "0.14.3",
|
|
36
|
+
"lodash": "4.17.21",
|
|
37
|
+
"ndjson": "2.0.0",
|
|
38
|
+
"node-emoji": "1.10.0",
|
|
39
|
+
"node-fetch": "2.6.7",
|
|
40
|
+
"production": "0.0.2",
|
|
41
|
+
"strip-json-comments": "3.1.1",
|
|
42
|
+
"tar": "6.1.11",
|
|
43
|
+
"tmp": "0.2.1",
|
|
44
|
+
"tslib": "2.3.1",
|
|
45
|
+
"ws": "8.8.0",
|
|
46
|
+
"typescript": "4.4.*"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@istanbuljs/nyc-config-typescript": "
|
|
50
|
-
"@oclif/dev-cli": "
|
|
51
|
-
"@oclif/test": "
|
|
52
|
-
"@types/bluebird": "
|
|
53
|
-
"@types/chai": "
|
|
54
|
-
"@types/compare-version": "
|
|
55
|
-
"@types/inquirer": "
|
|
56
|
-
"@types/listr": "
|
|
57
|
-
"@types/mocha": "
|
|
58
|
-
"@types/ndjson": "
|
|
59
|
-
"@types/node": "
|
|
60
|
-
"@types/node-emoji": "
|
|
61
|
-
"@types/node-fetch": "
|
|
62
|
-
"@types/tar": "
|
|
63
|
-
"@types/tmp": "
|
|
64
|
-
"@types/ws": "
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "
|
|
66
|
-
"@typescript-eslint/parser": "
|
|
67
|
-
"chai": "
|
|
68
|
-
"cucumber": "
|
|
69
|
-
"eslint": "
|
|
70
|
-
"globby": "
|
|
71
|
-
"mocha": "
|
|
72
|
-
"nyc": "
|
|
73
|
-
"prettier-eslint": "
|
|
74
|
-
"should": "
|
|
75
|
-
"source-map-support": "
|
|
76
|
-
"ts-node": "10.9.*"
|
|
49
|
+
"@istanbuljs/nyc-config-typescript": "1.0.1",
|
|
50
|
+
"@oclif/dev-cli": "1.26.0",
|
|
51
|
+
"@oclif/test": "1.2.8",
|
|
52
|
+
"@types/bluebird": "3.5.33",
|
|
53
|
+
"@types/chai": "4.2.16",
|
|
54
|
+
"@types/compare-version": "0.1.31",
|
|
55
|
+
"@types/inquirer": "7.3.3",
|
|
56
|
+
"@types/listr": "0.14.2",
|
|
57
|
+
"@types/mocha": "8.2.2",
|
|
58
|
+
"@types/ndjson": "2.0.0",
|
|
59
|
+
"@types/node": "18.19.0",
|
|
60
|
+
"@types/node-emoji": "1.8.1",
|
|
61
|
+
"@types/node-fetch": "2.6.1",
|
|
62
|
+
"@types/tar": "6.1.3",
|
|
63
|
+
"@types/tmp": "0.2.0",
|
|
64
|
+
"@types/ws": "8.5.3",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "4.22.0",
|
|
66
|
+
"@typescript-eslint/parser": "4.22.0",
|
|
67
|
+
"chai": "4.3.4",
|
|
68
|
+
"cucumber": "6.0.7",
|
|
69
|
+
"eslint": "7.24.0",
|
|
70
|
+
"globby": "11.0.3",
|
|
71
|
+
"mocha": "8.3.2",
|
|
72
|
+
"nyc": "15.1.0",
|
|
73
|
+
"prettier-eslint": "12.0.0",
|
|
74
|
+
"should": "13.2.3",
|
|
75
|
+
"source-map-support": "0.5.19",
|
|
76
|
+
"ts-node": "10.9.*",
|
|
77
|
+
"semantic-release-config-kuzzle": "1.0.0",
|
|
78
|
+
"semantic-release-slack-bot": "4.0.2",
|
|
79
|
+
"@semantic-release/changelog": "6.0.3",
|
|
80
|
+
"@semantic-release/commit-analyzer": "13.0.0",
|
|
81
|
+
"@semantic-release/git": "10.0.1",
|
|
82
|
+
"@semantic-release/release-notes-generator": "14.0.1"
|
|
77
83
|
},
|
|
78
84
|
"engines": {
|
|
79
|
-
"node": ">=
|
|
85
|
+
"node": ">=18.0.0"
|
|
80
86
|
},
|
|
81
87
|
"files": [
|
|
82
88
|
"/bin",
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const command_1 = require("@oclif/command");
|
|
4
|
-
const PaasKommand_1 = require("../../support/PaasKommand");
|
|
5
|
-
class PaasDeploy extends PaasKommand_1.PaasKommand {
|
|
6
|
-
async runSafe() {
|
|
7
|
-
const apiKey = await this.getCredentials();
|
|
8
|
-
await this.initPaasClient({ apiKey });
|
|
9
|
-
const user = await this.paas.auth.getCurrentUser();
|
|
10
|
-
this.logInfo(`Logged as "${user._id}" for project "${this.flags.project || this.getProject()}"`);
|
|
11
|
-
const [image, tag] = this.args.image.split(":");
|
|
12
|
-
this.logInfo(`Deploy application with image "${image}:${tag}"`);
|
|
13
|
-
await this.paas.query({
|
|
14
|
-
controller: "application",
|
|
15
|
-
action: "deploy",
|
|
16
|
-
environmentId: this.args.environment,
|
|
17
|
-
projectId: this.flags.project || this.getProject(),
|
|
18
|
-
applicationId: this.args.applicationId,
|
|
19
|
-
body: {
|
|
20
|
-
image: {
|
|
21
|
-
name: image,
|
|
22
|
-
tag,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
this.logOk("Deployment in progress");
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
PaasDeploy.description = "Deploy a new version of the application in the PaaS";
|
|
30
|
-
PaasDeploy.flags = {
|
|
31
|
-
help: command_1.flags.help(),
|
|
32
|
-
token: command_1.flags.string({
|
|
33
|
-
default: process.env.KUZZLE_PAAS_TOKEN,
|
|
34
|
-
description: "Authentication token",
|
|
35
|
-
}),
|
|
36
|
-
project: command_1.flags.string({
|
|
37
|
-
description: "Current PaaS project",
|
|
38
|
-
}),
|
|
39
|
-
};
|
|
40
|
-
PaasDeploy.args = [
|
|
41
|
-
{
|
|
42
|
-
name: "environment",
|
|
43
|
-
description: "Project environment name",
|
|
44
|
-
required: true,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "applicationId",
|
|
48
|
-
description: "Application Identifier",
|
|
49
|
-
required: true,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "image",
|
|
53
|
-
description: "Image name and hash as myimage:mytag",
|
|
54
|
-
required: true,
|
|
55
|
-
},
|
|
56
|
-
];
|
|
57
|
-
exports.default = PaasDeploy;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { flags } from "@oclif/command";
|
|
2
|
-
import { PaasKommand } from "../../../support/PaasKommand";
|
|
3
|
-
declare class PaasEsDump extends PaasKommand {
|
|
4
|
-
static description: string;
|
|
5
|
-
static flags: {
|
|
6
|
-
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
7
|
-
project: flags.IOptionFlag<string | undefined>;
|
|
8
|
-
"batch-size": import("@oclif/parser/lib/flags").IOptionFlag<number>;
|
|
9
|
-
};
|
|
10
|
-
static args: {
|
|
11
|
-
name: string;
|
|
12
|
-
description: string;
|
|
13
|
-
required: boolean;
|
|
14
|
-
}[];
|
|
15
|
-
runSafe(): Promise<void>;
|
|
16
|
-
/**
|
|
17
|
-
* @description Get all indexes from the Elasticsearch of the PaaS application.
|
|
18
|
-
* @returns The indexes.
|
|
19
|
-
*/
|
|
20
|
-
private getAllIndexes;
|
|
21
|
-
/**
|
|
22
|
-
* @description Dump documents from the Elasticsearch of the PaaS application.
|
|
23
|
-
* @param pitId ID of the PIT opened on Elasticsearch.
|
|
24
|
-
* @param searchAfter Cursor for dumping documents after a certain one.
|
|
25
|
-
* @returns The dumped documents.
|
|
26
|
-
*/
|
|
27
|
-
private dumpDocuments;
|
|
28
|
-
private dumpAllDocuments;
|
|
29
|
-
/**
|
|
30
|
-
* @description Finish the document dumping session.
|
|
31
|
-
* @param pitId ID of the PIT opened on Elasticsearch.
|
|
32
|
-
*/
|
|
33
|
-
private finishDump;
|
|
34
|
-
}
|
|
35
|
-
export default PaasEsDump;
|