kourou 0.27.0 → 0.28.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/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/0.28.0 darwin-arm64 node-v20.10.0
|
|
31
31
|
$ kourou --help [COMMAND]
|
|
32
32
|
USAGE
|
|
33
33
|
$ kourou COMMAND
|
|
@@ -161,6 +161,7 @@ All other arguments and options will be passed as-is to the `sdk:query` method.
|
|
|
161
161
|
* [`kourou instance:logs`](#kourou-instancelogs)
|
|
162
162
|
* [`kourou instance:spawn`](#kourou-instancespawn)
|
|
163
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)
|
|
164
165
|
* [`kourou paas:init PROJECT`](#kourou-paasinit-project)
|
|
165
166
|
* [`kourou paas:login`](#kourou-paaslogin)
|
|
166
167
|
* [`kourou paas:logs ENVIRONMENT APPLICATION`](#kourou-paaslogs-environment-application)
|
|
@@ -211,7 +212,7 @@ EXAMPLE
|
|
|
211
212
|
kourou api-key:check eyJhbG...QxfQrc
|
|
212
213
|
```
|
|
213
214
|
|
|
214
|
-
_See code: [
|
|
215
|
+
_See code: [lib/commands/api-key/check.js](lib/commands/api-key/check.js)_
|
|
215
216
|
|
|
216
217
|
## `kourou api-key:create USER`
|
|
217
218
|
|
|
@@ -239,7 +240,7 @@ OPTIONS
|
|
|
239
240
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
240
241
|
```
|
|
241
242
|
|
|
242
|
-
_See code: [
|
|
243
|
+
_See code: [lib/commands/api-key/create.js](lib/commands/api-key/create.js)_
|
|
243
244
|
|
|
244
245
|
## `kourou api-key:delete USER ID`
|
|
245
246
|
|
|
@@ -268,7 +269,7 @@ EXAMPLE
|
|
|
268
269
|
kourou vault:delete sigfox-gateway 1k-BF3EBjsXdvA2PR8x
|
|
269
270
|
```
|
|
270
271
|
|
|
271
|
-
_See code: [
|
|
272
|
+
_See code: [lib/commands/api-key/delete.js](lib/commands/api-key/delete.js)_
|
|
272
273
|
|
|
273
274
|
## `kourou api-key:search USER`
|
|
274
275
|
|
|
@@ -294,7 +295,7 @@ OPTIONS
|
|
|
294
295
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
295
296
|
```
|
|
296
297
|
|
|
297
|
-
_See code: [
|
|
298
|
+
_See code: [lib/commands/api-key/search.js](lib/commands/api-key/search.js)_
|
|
298
299
|
|
|
299
300
|
## `kourou app:debug-proxy`
|
|
300
301
|
|
|
@@ -332,7 +333,7 @@ OPTIONS
|
|
|
332
333
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
333
334
|
```
|
|
334
335
|
|
|
335
|
-
_See code: [
|
|
336
|
+
_See code: [lib/commands/app/debug-proxy.js](lib/commands/app/debug-proxy.js)_
|
|
336
337
|
|
|
337
338
|
## `kourou app:doctor`
|
|
338
339
|
|
|
@@ -355,7 +356,7 @@ OPTIONS
|
|
|
355
356
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
356
357
|
```
|
|
357
358
|
|
|
358
|
-
_See code: [
|
|
359
|
+
_See code: [lib/commands/app/doctor.js](lib/commands/app/doctor.js)_
|
|
359
360
|
|
|
360
361
|
## `kourou app:scaffold DESTINATION`
|
|
361
362
|
|
|
@@ -373,7 +374,7 @@ OPTIONS
|
|
|
373
374
|
--help show CLI help
|
|
374
375
|
```
|
|
375
376
|
|
|
376
|
-
_See code: [
|
|
377
|
+
_See code: [lib/commands/app/scaffold.js](lib/commands/app/scaffold.js)_
|
|
377
378
|
|
|
378
379
|
## `kourou app:start-services`
|
|
379
380
|
|
|
@@ -388,7 +389,7 @@ OPTIONS
|
|
|
388
389
|
--help show CLI help
|
|
389
390
|
```
|
|
390
391
|
|
|
391
|
-
_See code: [
|
|
392
|
+
_See code: [lib/commands/app/start-services.js](lib/commands/app/start-services.js)_
|
|
392
393
|
|
|
393
394
|
## `kourou autocomplete [SHELL]`
|
|
394
395
|
|
|
@@ -438,7 +439,7 @@ OPTIONS
|
|
|
438
439
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
439
440
|
```
|
|
440
441
|
|
|
441
|
-
_See code: [
|
|
442
|
+
_See code: [lib/commands/collection/create.js](lib/commands/collection/create.js)_
|
|
442
443
|
|
|
443
444
|
## `kourou collection:export INDEX COLLECTION`
|
|
444
445
|
|
|
@@ -519,7 +520,7 @@ EXAMPLES
|
|
|
519
520
|
kourou collection:export nyc-open-data yellow-taxi --query '{ term: { city: "Saigon" } }'
|
|
520
521
|
```
|
|
521
522
|
|
|
522
|
-
_See code: [
|
|
523
|
+
_See code: [lib/commands/collection/export.js](lib/commands/collection/export.js)_
|
|
523
524
|
|
|
524
525
|
## `kourou collection:import PATH`
|
|
525
526
|
|
|
@@ -548,7 +549,7 @@ OPTIONS
|
|
|
548
549
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
549
550
|
```
|
|
550
551
|
|
|
551
|
-
_See code: [
|
|
552
|
+
_See code: [lib/commands/collection/import.js](lib/commands/collection/import.js)_
|
|
552
553
|
|
|
553
554
|
## `kourou collection:migrate SCRIPT PATH`
|
|
554
555
|
|
|
@@ -577,7 +578,7 @@ OPTIONS
|
|
|
577
578
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
578
579
|
```
|
|
579
580
|
|
|
580
|
-
_See code: [
|
|
581
|
+
_See code: [lib/commands/collection/migrate.js](lib/commands/collection/migrate.js)_
|
|
581
582
|
|
|
582
583
|
## `kourou config:diff FIRST SECOND`
|
|
583
584
|
|
|
@@ -599,7 +600,7 @@ EXAMPLE
|
|
|
599
600
|
kourou config:diff config/local/kuzzlerc config/production/kuzzlerc
|
|
600
601
|
```
|
|
601
602
|
|
|
602
|
-
_See code: [
|
|
603
|
+
_See code: [lib/commands/config/diff.js](lib/commands/config/diff.js)_
|
|
603
604
|
|
|
604
605
|
## `kourou document:search INDEX COLLECTION [QUERY]`
|
|
605
606
|
|
|
@@ -637,7 +638,7 @@ EXAMPLES
|
|
|
637
638
|
kourou document:search iot sensors --editor
|
|
638
639
|
```
|
|
639
640
|
|
|
640
|
-
_See code: [
|
|
641
|
+
_See code: [lib/commands/document/search.js](lib/commands/document/search.js)_
|
|
641
642
|
|
|
642
643
|
## `kourou es:aliases:cat`
|
|
643
644
|
|
|
@@ -653,7 +654,7 @@ OPTIONS
|
|
|
653
654
|
--help show CLI help
|
|
654
655
|
```
|
|
655
656
|
|
|
656
|
-
_See code: [
|
|
657
|
+
_See code: [lib/commands/es/aliases/cat.js](lib/commands/es/aliases/cat.js)_
|
|
657
658
|
|
|
658
659
|
## `kourou es:indices:cat`
|
|
659
660
|
|
|
@@ -669,7 +670,7 @@ OPTIONS
|
|
|
669
670
|
--help show CLI help
|
|
670
671
|
```
|
|
671
672
|
|
|
672
|
-
_See code: [
|
|
673
|
+
_See code: [lib/commands/es/indices/cat.js](lib/commands/es/indices/cat.js)_
|
|
673
674
|
|
|
674
675
|
## `kourou es:indices:get INDEX ID`
|
|
675
676
|
|
|
@@ -688,7 +689,7 @@ OPTIONS
|
|
|
688
689
|
--help show CLI help
|
|
689
690
|
```
|
|
690
691
|
|
|
691
|
-
_See code: [
|
|
692
|
+
_See code: [lib/commands/es/indices/get.js](lib/commands/es/indices/get.js)_
|
|
692
693
|
|
|
693
694
|
## `kourou es:indices:insert INDEX`
|
|
694
695
|
|
|
@@ -708,7 +709,7 @@ OPTIONS
|
|
|
708
709
|
--id=id Document ID
|
|
709
710
|
```
|
|
710
711
|
|
|
711
|
-
_See code: [
|
|
712
|
+
_See code: [lib/commands/es/indices/insert.js](lib/commands/es/indices/insert.js)_
|
|
712
713
|
|
|
713
714
|
## `kourou es:migrate`
|
|
714
715
|
|
|
@@ -735,7 +736,7 @@ EXAMPLES
|
|
|
735
736
|
kourou es:migrate --src ./my-backup --dest http://elasticsearch:9200 --reset --batch-size 2000 --no-interactive
|
|
736
737
|
```
|
|
737
738
|
|
|
738
|
-
_See code: [
|
|
739
|
+
_See code: [lib/commands/es/migrate.js](lib/commands/es/migrate.js)_
|
|
739
740
|
|
|
740
741
|
## `kourou es:snapshot:create REPOSITORY NAME`
|
|
741
742
|
|
|
@@ -754,7 +755,7 @@ OPTIONS
|
|
|
754
755
|
--help show CLI help
|
|
755
756
|
```
|
|
756
757
|
|
|
757
|
-
_See code: [
|
|
758
|
+
_See code: [lib/commands/es/snapshot/create.js](lib/commands/es/snapshot/create.js)_
|
|
758
759
|
|
|
759
760
|
## `kourou es:snapshot:create-repository REPOSITORY LOCATION`
|
|
760
761
|
|
|
@@ -774,7 +775,7 @@ OPTIONS
|
|
|
774
775
|
--help show CLI help
|
|
775
776
|
```
|
|
776
777
|
|
|
777
|
-
_See code: [
|
|
778
|
+
_See code: [lib/commands/es/snapshot/create-repository.js](lib/commands/es/snapshot/create-repository.js)_
|
|
778
779
|
|
|
779
780
|
## `kourou es:snapshot:list REPOSITORY`
|
|
780
781
|
|
|
@@ -792,7 +793,7 @@ OPTIONS
|
|
|
792
793
|
--help show CLI help
|
|
793
794
|
```
|
|
794
795
|
|
|
795
|
-
_See code: [
|
|
796
|
+
_See code: [lib/commands/es/snapshot/list.js](lib/commands/es/snapshot/list.js)_
|
|
796
797
|
|
|
797
798
|
## `kourou file:decrypt FILE`
|
|
798
799
|
|
|
@@ -815,7 +816,7 @@ EXAMPLES
|
|
|
815
816
|
kourou file:decrypt books/cryptonomicon.txt.enc -o books/cryptonomicon.txt --vault-key <vault-key>
|
|
816
817
|
```
|
|
817
818
|
|
|
818
|
-
_See code: [
|
|
819
|
+
_See code: [lib/commands/file/decrypt.js](lib/commands/file/decrypt.js)_
|
|
819
820
|
|
|
820
821
|
## `kourou file:encrypt FILE`
|
|
821
822
|
|
|
@@ -838,7 +839,7 @@ EXAMPLES
|
|
|
838
839
|
kourou file:encrypt books/cryptonomicon.txt -o books/cryptonomicon.txt.enc --vault-key <vault-key>
|
|
839
840
|
```
|
|
840
841
|
|
|
841
|
-
_See code: [
|
|
842
|
+
_See code: [lib/commands/file/encrypt.js](lib/commands/file/encrypt.js)_
|
|
842
843
|
|
|
843
844
|
## `kourou file:test FILE`
|
|
844
845
|
|
|
@@ -858,7 +859,7 @@ EXAMPLE
|
|
|
858
859
|
kourou file:test books/cryptonomicon.txt.enc --vault-key <vault-key>
|
|
859
860
|
```
|
|
860
861
|
|
|
861
|
-
_See code: [
|
|
862
|
+
_See code: [lib/commands/file/test.js](lib/commands/file/test.js)_
|
|
862
863
|
|
|
863
864
|
## `kourou help [COMMAND]`
|
|
864
865
|
|
|
@@ -902,7 +903,7 @@ OPTIONS
|
|
|
902
903
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
903
904
|
```
|
|
904
905
|
|
|
905
|
-
_See code: [
|
|
906
|
+
_See code: [lib/commands/import.js](lib/commands/import.js)_
|
|
906
907
|
|
|
907
908
|
## `kourou index:export INDEX`
|
|
908
909
|
|
|
@@ -952,7 +953,7 @@ EXAMPLES
|
|
|
952
953
|
kourou index:export nyc-open-data --query '{"range":{"_kuzzle_info.createdAt":{"gt":1632935638866}}}'
|
|
953
954
|
```
|
|
954
955
|
|
|
955
|
-
_See code: [
|
|
956
|
+
_See code: [lib/commands/index/export.js](lib/commands/index/export.js)_
|
|
956
957
|
|
|
957
958
|
## `kourou index:import PATH`
|
|
958
959
|
|
|
@@ -984,7 +985,7 @@ EXAMPLES
|
|
|
984
985
|
kourou index:import ./dump/iot-data --index iot-data-production --no-mappings
|
|
985
986
|
```
|
|
986
987
|
|
|
987
|
-
_See code: [
|
|
988
|
+
_See code: [lib/commands/index/import.js](lib/commands/index/import.js)_
|
|
988
989
|
|
|
989
990
|
## `kourou instance:kill`
|
|
990
991
|
|
|
@@ -999,7 +1000,7 @@ OPTIONS
|
|
|
999
1000
|
-i, --instance=instance Kuzzle instance name [ex: stack-0]
|
|
1000
1001
|
```
|
|
1001
1002
|
|
|
1002
|
-
_See code: [
|
|
1003
|
+
_See code: [lib/commands/instance/kill.js](lib/commands/instance/kill.js)_
|
|
1003
1004
|
|
|
1004
1005
|
## `kourou instance:list`
|
|
1005
1006
|
|
|
@@ -1010,7 +1011,7 @@ USAGE
|
|
|
1010
1011
|
$ kourou instance:list
|
|
1011
1012
|
```
|
|
1012
1013
|
|
|
1013
|
-
_See code: [
|
|
1014
|
+
_See code: [lib/commands/instance/list.js](lib/commands/instance/list.js)_
|
|
1014
1015
|
|
|
1015
1016
|
## `kourou instance:logs`
|
|
1016
1017
|
|
|
@@ -1025,7 +1026,7 @@ OPTIONS
|
|
|
1025
1026
|
-i, --instance=instance Kuzzle instance name
|
|
1026
1027
|
```
|
|
1027
1028
|
|
|
1028
|
-
_See code: [
|
|
1029
|
+
_See code: [lib/commands/instance/logs.js](lib/commands/instance/logs.js)_
|
|
1029
1030
|
|
|
1030
1031
|
## `kourou instance:spawn`
|
|
1031
1032
|
|
|
@@ -1041,7 +1042,7 @@ OPTIONS
|
|
|
1041
1042
|
--help show CLI help
|
|
1042
1043
|
```
|
|
1043
1044
|
|
|
1044
|
-
_See code: [
|
|
1045
|
+
_See code: [lib/commands/instance/spawn.js](lib/commands/instance/spawn.js)_
|
|
1045
1046
|
|
|
1046
1047
|
## `kourou paas:deploy ENVIRONMENT APPLICATIONID IMAGE`
|
|
1047
1048
|
|
|
@@ -1062,7 +1063,26 @@ OPTIONS
|
|
|
1062
1063
|
--token=token Authentication token
|
|
1063
1064
|
```
|
|
1064
1065
|
|
|
1065
|
-
_See code: [
|
|
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
|
+
```
|
|
1066
1086
|
|
|
1067
1087
|
## `kourou paas:init PROJECT`
|
|
1068
1088
|
|
|
@@ -1079,7 +1099,7 @@ OPTIONS
|
|
|
1079
1099
|
--help show CLI help
|
|
1080
1100
|
```
|
|
1081
1101
|
|
|
1082
|
-
_See code: [
|
|
1102
|
+
_See code: [lib/commands/paas/init.js](lib/commands/paas/init.js)_
|
|
1083
1103
|
|
|
1084
1104
|
## `kourou paas:login`
|
|
1085
1105
|
|
|
@@ -1096,7 +1116,7 @@ OPTIONS
|
|
|
1096
1116
|
--username=username PaaS username
|
|
1097
1117
|
```
|
|
1098
1118
|
|
|
1099
|
-
_See code: [
|
|
1119
|
+
_See code: [lib/commands/paas/login.js](lib/commands/paas/login.js)_
|
|
1100
1120
|
|
|
1101
1121
|
## `kourou paas:logs ENVIRONMENT APPLICATION`
|
|
1102
1122
|
|
|
@@ -1121,7 +1141,7 @@ OPTIONS
|
|
|
1121
1141
|
--until=until Display logs until a specific absolute (e.g. 2022/12/02 09:41) or relative (e.g. a minute ago) time
|
|
1122
1142
|
```
|
|
1123
1143
|
|
|
1124
|
-
_See code: [
|
|
1144
|
+
_See code: [lib/commands/paas/logs.js](lib/commands/paas/logs.js)_
|
|
1125
1145
|
|
|
1126
1146
|
## `kourou paas:snapshots:cat ENVIRONMENT APPLICATIONID`
|
|
1127
1147
|
|
|
@@ -1144,7 +1164,7 @@ EXAMPLE
|
|
|
1144
1164
|
kourou paas:snapshots:cat --project paas-project-myproject api main
|
|
1145
1165
|
```
|
|
1146
1166
|
|
|
1147
|
-
_See code: [
|
|
1167
|
+
_See code: [lib/commands/paas/snapshots/cat.js](lib/commands/paas/snapshots/cat.js)_
|
|
1148
1168
|
|
|
1149
1169
|
## `kourou paas:snapshots:dump ENVIRONMENT APPLICATIONID`
|
|
1150
1170
|
|
|
@@ -1167,7 +1187,7 @@ EXAMPLE
|
|
|
1167
1187
|
kourou paas:snapshots:dump --project paas-project-myproject api main
|
|
1168
1188
|
```
|
|
1169
1189
|
|
|
1170
|
-
_See code: [
|
|
1190
|
+
_See code: [lib/commands/paas/snapshots/dump.js](lib/commands/paas/snapshots/dump.js)_
|
|
1171
1191
|
|
|
1172
1192
|
## `kourou paas:snapshots:restore ENVIRONMENT APPLICATIONID SNAPSHOTID`
|
|
1173
1193
|
|
|
@@ -1191,7 +1211,7 @@ EXAMPLE
|
|
|
1191
1211
|
kourou paas:snapshots:restore --project paas-project-myproject api main snapshot-id
|
|
1192
1212
|
```
|
|
1193
1213
|
|
|
1194
|
-
_See code: [
|
|
1214
|
+
_See code: [lib/commands/paas/snapshots/restore.js](lib/commands/paas/snapshots/restore.js)_
|
|
1195
1215
|
|
|
1196
1216
|
## `kourou profile:export`
|
|
1197
1217
|
|
|
@@ -1214,7 +1234,7 @@ OPTIONS
|
|
|
1214
1234
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
1215
1235
|
```
|
|
1216
1236
|
|
|
1217
|
-
_See code: [
|
|
1237
|
+
_See code: [lib/commands/profile/export.js](lib/commands/profile/export.js)_
|
|
1218
1238
|
|
|
1219
1239
|
## `kourou profile:import PATH`
|
|
1220
1240
|
|
|
@@ -1239,7 +1259,7 @@ OPTIONS
|
|
|
1239
1259
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
1240
1260
|
```
|
|
1241
1261
|
|
|
1242
|
-
_See code: [
|
|
1262
|
+
_See code: [lib/commands/profile/import.js](lib/commands/profile/import.js)_
|
|
1243
1263
|
|
|
1244
1264
|
## `kourou realtime:subscribe INDEX COLLECTION [FILTERS]`
|
|
1245
1265
|
|
|
@@ -1291,7 +1311,7 @@ EXAMPLES
|
|
|
1291
1311
|
kourou realtime:subscribe iot-data sensors --display result._source.temperature
|
|
1292
1312
|
```
|
|
1293
1313
|
|
|
1294
|
-
_See code: [
|
|
1314
|
+
_See code: [lib/commands/realtime/subscribe.js](lib/commands/realtime/subscribe.js)_
|
|
1295
1315
|
|
|
1296
1316
|
## `kourou redis:list-keys [MATCH]`
|
|
1297
1317
|
|
|
@@ -1323,7 +1343,7 @@ EXAMPLES
|
|
|
1323
1343
|
kourou redis:list-keys "counters/*" --remove
|
|
1324
1344
|
```
|
|
1325
1345
|
|
|
1326
|
-
_See code: [
|
|
1346
|
+
_See code: [lib/commands/redis/list-keys.js](lib/commands/redis/list-keys.js)_
|
|
1327
1347
|
|
|
1328
1348
|
## `kourou role:export`
|
|
1329
1349
|
|
|
@@ -1346,7 +1366,7 @@ OPTIONS
|
|
|
1346
1366
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
1347
1367
|
```
|
|
1348
1368
|
|
|
1349
|
-
_See code: [
|
|
1369
|
+
_See code: [lib/commands/role/export.js](lib/commands/role/export.js)_
|
|
1350
1370
|
|
|
1351
1371
|
## `kourou role:import PATH`
|
|
1352
1372
|
|
|
@@ -1372,7 +1392,7 @@ OPTIONS
|
|
|
1372
1392
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
1373
1393
|
```
|
|
1374
1394
|
|
|
1375
|
-
_See code: [
|
|
1395
|
+
_See code: [lib/commands/role/import.js](lib/commands/role/import.js)_
|
|
1376
1396
|
|
|
1377
1397
|
## `kourou sdk:execute [CODE]`
|
|
1378
1398
|
|
|
@@ -1430,7 +1450,7 @@ DESCRIPTION
|
|
|
1430
1450
|
- kourou sdk:execute 'return await sdk.server.now()' --editor
|
|
1431
1451
|
```
|
|
1432
1452
|
|
|
1433
|
-
_See code: [
|
|
1453
|
+
_See code: [lib/commands/sdk/execute.js](lib/commands/sdk/execute.js)_
|
|
1434
1454
|
|
|
1435
1455
|
## `kourou sdk:query CONTROLLER:ACTION`
|
|
1436
1456
|
|
|
@@ -1531,7 +1551,7 @@ DESCRIPTION
|
|
|
1531
1551
|
- kourou admin:loadMappings < mappings.json
|
|
1532
1552
|
```
|
|
1533
1553
|
|
|
1534
|
-
_See code: [
|
|
1554
|
+
_See code: [lib/commands/sdk/query.js](lib/commands/sdk/query.js)_
|
|
1535
1555
|
|
|
1536
1556
|
## `kourou user:export`
|
|
1537
1557
|
|
|
@@ -1583,7 +1603,7 @@ DESCRIPTION
|
|
|
1583
1603
|
- kourou user:export --generate-credentials --generated-username content.email
|
|
1584
1604
|
```
|
|
1585
1605
|
|
|
1586
|
-
_See code: [
|
|
1606
|
+
_See code: [lib/commands/user/export.js](lib/commands/user/export.js)_
|
|
1587
1607
|
|
|
1588
1608
|
## `kourou user:export-mappings`
|
|
1589
1609
|
|
|
@@ -1606,7 +1626,7 @@ OPTIONS
|
|
|
1606
1626
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
1607
1627
|
```
|
|
1608
1628
|
|
|
1609
|
-
_See code: [
|
|
1629
|
+
_See code: [lib/commands/user/export-mappings.js](lib/commands/user/export-mappings.js)_
|
|
1610
1630
|
|
|
1611
1631
|
## `kourou user:import PATH`
|
|
1612
1632
|
|
|
@@ -1631,7 +1651,7 @@ OPTIONS
|
|
|
1631
1651
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
1632
1652
|
```
|
|
1633
1653
|
|
|
1634
|
-
_See code: [
|
|
1654
|
+
_See code: [lib/commands/user/import.js](lib/commands/user/import.js)_
|
|
1635
1655
|
|
|
1636
1656
|
## `kourou user:import-mappings PATH`
|
|
1637
1657
|
|
|
@@ -1656,7 +1676,7 @@ OPTIONS
|
|
|
1656
1676
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
1657
1677
|
```
|
|
1658
1678
|
|
|
1659
|
-
_See code: [
|
|
1679
|
+
_See code: [lib/commands/user/import-mappings.js](lib/commands/user/import-mappings.js)_
|
|
1660
1680
|
|
|
1661
1681
|
## `kourou vault:add SECRETS-FILE KEY VALUE`
|
|
1662
1682
|
|
|
@@ -1687,7 +1707,7 @@ EXAMPLE
|
|
|
1687
1707
|
kourou vault:add config/secrets.enc.json aws.s3.keyId b61e267676660c314b006b06 --vault-key <vault-key>
|
|
1688
1708
|
```
|
|
1689
1709
|
|
|
1690
|
-
_See code: [
|
|
1710
|
+
_See code: [lib/commands/vault/add.js](lib/commands/vault/add.js)_
|
|
1691
1711
|
|
|
1692
1712
|
## `kourou vault:decrypt FILE`
|
|
1693
1713
|
|
|
@@ -1717,7 +1737,7 @@ EXAMPLES
|
|
|
1717
1737
|
kourou vault:decrypt config/secrets.enc.json -o config/secrets.json --vault-key <vault-key>
|
|
1718
1738
|
```
|
|
1719
1739
|
|
|
1720
|
-
_See code: [
|
|
1740
|
+
_See code: [lib/commands/vault/decrypt.js](lib/commands/vault/decrypt.js)_
|
|
1721
1741
|
|
|
1722
1742
|
## `kourou vault:encrypt FILE`
|
|
1723
1743
|
|
|
@@ -1758,7 +1778,7 @@ EXAMPLES
|
|
|
1758
1778
|
kourou vault:encrypt config/secrets.json -o config/secrets_prod.enc.json --vault-key <vault-key>
|
|
1759
1779
|
```
|
|
1760
1780
|
|
|
1761
|
-
_See code: [
|
|
1781
|
+
_See code: [lib/commands/vault/encrypt.js](lib/commands/vault/encrypt.js)_
|
|
1762
1782
|
|
|
1763
1783
|
## `kourou vault:show SECRETS-FILE [KEY]`
|
|
1764
1784
|
|
|
@@ -1789,7 +1809,7 @@ EXAMPLES
|
|
|
1789
1809
|
kourou vault:show config/secrets.enc.json aws.s3.secretKey --vault-key <vault-key>
|
|
1790
1810
|
```
|
|
1791
1811
|
|
|
1792
|
-
_See code: [
|
|
1812
|
+
_See code: [lib/commands/vault/show.js](lib/commands/vault/show.js)_
|
|
1793
1813
|
|
|
1794
1814
|
## `kourou vault:test SECRETS-FILE`
|
|
1795
1815
|
|
|
@@ -1814,7 +1834,7 @@ EXAMPLE
|
|
|
1814
1834
|
kourou vault:test config/secrets.enc.json --vault-key <vault-key>
|
|
1815
1835
|
```
|
|
1816
1836
|
|
|
1817
|
-
_See code: [
|
|
1837
|
+
_See code: [lib/commands/vault/test.js](lib/commands/vault/test.js)_
|
|
1818
1838
|
<!-- commandsstop -->
|
|
1819
1839
|
|
|
1820
1840
|
# Where does this weird name come from?
|
|
@@ -0,0 +1,35 @@
|
|
|
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;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
5
|
+
const promises_1 = (0, tslib_1.__importDefault)(require("node:fs/promises"));
|
|
6
|
+
const ndjson_1 = (0, tslib_1.__importDefault)(require("ndjson"));
|
|
7
|
+
const command_1 = require("@oclif/command");
|
|
8
|
+
const PaasKommand_1 = require("../../../support/PaasKommand");
|
|
9
|
+
class PaasEsDump extends PaasKommand_1.PaasKommand {
|
|
10
|
+
async runSafe() {
|
|
11
|
+
// Check that the batch size is positive
|
|
12
|
+
if (this.flags["batch-size"] <= 0) {
|
|
13
|
+
this.logKo(`The batch size must be greater than zero. (Specified batch size: ${this.flags["batch-size"]})`);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
// Log in to the PaaS
|
|
17
|
+
const apiKey = await this.getCredentials();
|
|
18
|
+
await this.initPaasClient({ apiKey });
|
|
19
|
+
const user = await this.paas.auth.getCurrentUser();
|
|
20
|
+
this.logInfo(`Logged as "${user._id}" for project "${this.flags.project || this.getProject()}"`);
|
|
21
|
+
// Create the dump directory
|
|
22
|
+
await promises_1.default.mkdir(this.args.dumpDirectory, { recursive: true });
|
|
23
|
+
// Dump the indexes
|
|
24
|
+
this.logInfo("Dumping Elasticsearch indexes...");
|
|
25
|
+
const indexesResult = await this.getAllIndexes();
|
|
26
|
+
await promises_1.default.writeFile(path_1.default.join(this.args.dumpDirectory, "indexes.json"), JSON.stringify(indexesResult));
|
|
27
|
+
this.logOk("Elasticsearch indexes dumped!");
|
|
28
|
+
// Dump all the documents
|
|
29
|
+
this.logInfo("Dumping Elasticsearch documents...");
|
|
30
|
+
await this.dumpAllDocuments();
|
|
31
|
+
this.logOk("Elasticsearch documents dumped!");
|
|
32
|
+
this.logOk(`The dumped files are available under "${path_1.default.resolve(this.args.dumpDirectory)}"`);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @description Get all indexes from the Elasticsearch of the PaaS application.
|
|
36
|
+
* @returns The indexes.
|
|
37
|
+
*/
|
|
38
|
+
async getAllIndexes() {
|
|
39
|
+
const { result } = await this.paas.query({
|
|
40
|
+
controller: "application/storage",
|
|
41
|
+
action: "getIndexes",
|
|
42
|
+
environmentId: this.args.environment,
|
|
43
|
+
projectId: this.flags.project || this.getProject(),
|
|
44
|
+
applicationId: this.args.applicationId,
|
|
45
|
+
body: {},
|
|
46
|
+
});
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @description Dump documents from the Elasticsearch of the PaaS application.
|
|
51
|
+
* @param pitId ID of the PIT opened on Elasticsearch.
|
|
52
|
+
* @param searchAfter Cursor for dumping documents after a certain one.
|
|
53
|
+
* @returns The dumped documents.
|
|
54
|
+
*/
|
|
55
|
+
async dumpDocuments(pitId, searchAfter) {
|
|
56
|
+
const { result } = await this.paas.query({
|
|
57
|
+
controller: "application/storage",
|
|
58
|
+
action: "dumpDocuments",
|
|
59
|
+
environmentId: this.args.environment,
|
|
60
|
+
projectId: this.flags.project || this.getProject(),
|
|
61
|
+
applicationId: this.args.applicationId,
|
|
62
|
+
body: {
|
|
63
|
+
pitId,
|
|
64
|
+
searchAfter: JSON.stringify(searchAfter),
|
|
65
|
+
size: this.flags["batch-size"],
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
async dumpAllDocuments() {
|
|
71
|
+
// Prepare dumping all documents
|
|
72
|
+
let pitId = "";
|
|
73
|
+
let searchAfter = [];
|
|
74
|
+
let dumpedDocuments = 0;
|
|
75
|
+
let totalDocuments = 0;
|
|
76
|
+
const fd = await promises_1.default.open(path_1.default.join(this.args.dumpDirectory, "documents.jsonl"), "w");
|
|
77
|
+
const writeStream = fd.createWriteStream();
|
|
78
|
+
const ndjsonStream = ndjson_1.default.stringify();
|
|
79
|
+
writeStream.on("error", (error) => {
|
|
80
|
+
throw error;
|
|
81
|
+
});
|
|
82
|
+
ndjsonStream.on("data", (line) => {
|
|
83
|
+
writeStream.write(line);
|
|
84
|
+
});
|
|
85
|
+
const teardown = async () => {
|
|
86
|
+
// Finish the dump session if a PIT ID is set
|
|
87
|
+
if (pitId.length > 0) {
|
|
88
|
+
await this.finishDump(pitId);
|
|
89
|
+
}
|
|
90
|
+
// Close the open streams/file
|
|
91
|
+
writeStream.close();
|
|
92
|
+
await fd.close();
|
|
93
|
+
};
|
|
94
|
+
try {
|
|
95
|
+
// Dump the first batch
|
|
96
|
+
let result = await this.dumpDocuments(pitId, searchAfter);
|
|
97
|
+
let hits = result.hits.hits;
|
|
98
|
+
while (hits.length > 0) {
|
|
99
|
+
// Update the PIT ID and the cursor for the next dump
|
|
100
|
+
pitId = result.pit_id;
|
|
101
|
+
searchAfter = hits[hits.length - 1].sort;
|
|
102
|
+
// Save the documents
|
|
103
|
+
for (let i = 0; i < hits.length; ++i) {
|
|
104
|
+
ndjsonStream.write(hits[i]);
|
|
105
|
+
}
|
|
106
|
+
dumpedDocuments += hits.length;
|
|
107
|
+
totalDocuments = result.hits.total.value;
|
|
108
|
+
this.logInfo(`Dumping Elasticsearch documents: ${Math.floor(dumpedDocuments / totalDocuments * 100)}% (${dumpedDocuments}/${totalDocuments})`);
|
|
109
|
+
// Dump the next batch
|
|
110
|
+
result = await this.dumpDocuments(pitId, searchAfter);
|
|
111
|
+
hits = result.hits.hits;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
teardown();
|
|
116
|
+
this.logKo(`Error while dumping the documents: ${error}`);
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
// Finish the dump
|
|
120
|
+
teardown();
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* @description Finish the document dumping session.
|
|
124
|
+
* @param pitId ID of the PIT opened on Elasticsearch.
|
|
125
|
+
*/
|
|
126
|
+
async finishDump(pitId) {
|
|
127
|
+
try {
|
|
128
|
+
await this.paas.query({
|
|
129
|
+
controller: "application/storage",
|
|
130
|
+
action: "finishDumpDocuments",
|
|
131
|
+
environmentId: this.args.environment,
|
|
132
|
+
projectId: this.flags.project || this.getProject(),
|
|
133
|
+
applicationId: this.args.applicationId,
|
|
134
|
+
body: {
|
|
135
|
+
pitId,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
this.logInfo(`Unable to cleanly finish the dump session: ${error}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
PaasEsDump.description = "Dump data from the Elasticsearch of a PaaS application";
|
|
145
|
+
PaasEsDump.flags = {
|
|
146
|
+
help: command_1.flags.help(),
|
|
147
|
+
project: command_1.flags.string({
|
|
148
|
+
description: "Current PaaS project",
|
|
149
|
+
}),
|
|
150
|
+
"batch-size": command_1.flags.integer({
|
|
151
|
+
description: "Maximum batch size",
|
|
152
|
+
default: 2000,
|
|
153
|
+
}),
|
|
154
|
+
};
|
|
155
|
+
PaasEsDump.args = [
|
|
156
|
+
{
|
|
157
|
+
name: "environment",
|
|
158
|
+
description: "Project environment name",
|
|
159
|
+
required: true,
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: "applicationId",
|
|
163
|
+
description: "Application Identifier",
|
|
164
|
+
required: true,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: "dumpDirectory",
|
|
168
|
+
description: "Directory where to store dump files",
|
|
169
|
+
required: true,
|
|
170
|
+
}
|
|
171
|
+
];
|
|
172
|
+
exports.default = PaasEsDump;
|
|
@@ -14,10 +14,7 @@ class PaasSnapshotsRestore extends PaasKommand_1.PaasKommand {
|
|
|
14
14
|
environmentId: this.args.environment,
|
|
15
15
|
projectId: this.flags.project || this.getProject(),
|
|
16
16
|
applicationId: this.args.applicationId,
|
|
17
|
-
|
|
18
|
-
repository: "automated",
|
|
19
|
-
snapshot: this.args.snapshotId,
|
|
20
|
-
},
|
|
17
|
+
snapshotId: this.args.snapshotId
|
|
21
18
|
});
|
|
22
19
|
this.logInfo("Ok");
|
|
23
20
|
}
|
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": "0.28.0",
|
|
5
5
|
"author": "The Kuzzle Team <support@kuzzle.io>",
|
|
6
6
|
"bin": {
|
|
7
7
|
"kourou": "./bin/run"
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"tar": "^6.1.11",
|
|
43
43
|
"tmp": "^0.2.1",
|
|
44
44
|
"tslib": "^2.3.1",
|
|
45
|
+
"typescript": "4.4.*",
|
|
45
46
|
"ws": "^8.8.0"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
"@types/listr": "^0.14.2",
|
|
56
57
|
"@types/mocha": "^8.2.2",
|
|
57
58
|
"@types/ndjson": "^2.0.0",
|
|
58
|
-
"@types/node": "^
|
|
59
|
+
"@types/node": "^18.19.0",
|
|
59
60
|
"@types/node-emoji": "^1.8.1",
|
|
60
61
|
"@types/node-fetch": "^2.6.1",
|
|
61
62
|
"@types/tar": "^6.1.3",
|
|
@@ -72,8 +73,7 @@
|
|
|
72
73
|
"prettier-eslint": "^12.0.0",
|
|
73
74
|
"should": "^13.2.3",
|
|
74
75
|
"source-map-support": "^0.5.19",
|
|
75
|
-
"ts-node": "10.9.*"
|
|
76
|
-
"typescript": "4.4.*"
|
|
76
|
+
"ts-node": "10.9.*"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": ">=10.0.0"
|