drove-cli 0.0.2__tar.gz → 0.0.4__tar.gz

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.
@@ -1,8 +1,7 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: drove-cli
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Drove Command Line Interface
5
- Home-page: https://github.com/PhonePe/drove-cli
6
5
  License: Apache-2.0
7
6
  Keywords: container,docker,podman,distributed-systems,container-orchestrator
8
7
  Author: Santanu Sinha
@@ -21,6 +20,8 @@ Classifier: Programming Language :: Python :: 3.9
21
20
  Classifier: Programming Language :: Python :: 3.10
22
21
  Classifier: Programming Language :: Python :: 3.11
23
22
  Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
24
25
  Classifier: Topic :: System :: Clustering
25
26
  Classifier: Topic :: System :: Distributed Computing
26
27
  Requires-Dist: requests (>=2.31.0,<3.0.0)
@@ -38,16 +39,37 @@ Command line interface for the Drove Container Orchestrator.
38
39
 
39
40
  ## Installation
40
41
 
41
- You can install the cli from from PyPI.
42
+ You can install the CLI from PyPI.
42
43
 
43
44
  ```bash
44
45
  pip install drove-cli
45
46
  ```
46
47
 
47
- Reactivate/deactivate virtual environment based on the need to utilize drove cli.
48
+ ### To install in a virtual env
49
+
50
+ Create virtual environment
51
+ ```bash
52
+ mkdir -p ${HOME}/venvs
53
+ cd ${HOME}/venvs
54
+ python3 -m venv drove_cli
55
+ cd drove_cli
56
+ source bin/activate
57
+ pip install drove-cli
58
+ ```
59
+
60
+ To activate in another shell:
61
+
62
+ ```bash
63
+ source ${HOME}/venvs/drove_cli/bin/activate
64
+ ```
65
+
66
+ To deactivate the venv (run when in activated environment):
67
+ ```bash
68
+ deactivate
69
+ ```
48
70
 
49
71
  ## Running using docker
50
- The cli is pushed as a docker for easy access. This also elimintates the need for having python etc setup on your system.
72
+ The cli is pushed as a docker for easy access. This also eliminates the need for having python etc setup on your system.
51
73
 
52
74
  1) Pull the image:
53
75
  ```shell
@@ -97,16 +119,18 @@ To see basic help:
97
119
  $ drove -h
98
120
 
99
121
  usage: drove [-h] [--file FILE] [--cluster CLUSTER] [--endpoint ENDPOINT] [--auth-header AUTH_HEADER] [--insecure INSECURE] [--username USERNAME] [--password PASSWORD] [--debug]
100
- {executor,cluster,apps,appinstances,tasks} ...
122
+ {executor,cluster,apps,appinstances,tasks,config} ...
101
123
 
102
124
  positional arguments:
103
- {executor,cluster,apps,appinstances,tasks}
125
+ {executor,cluster,apps,appinstances,tasks,config}
104
126
  Available plugins
127
+ lsinstances Drove local service instance related commands
105
128
  executor Drove cluster executor related commands
106
129
  cluster Drove cluster related commands
107
130
  apps Drove application related commands
108
131
  appinstances Drove application instance related commands
109
132
  tasks Drove task related commands
133
+ config Manage drove cluster configurations
110
134
 
111
135
  options:
112
136
  -h, --help show this help message and exit
@@ -117,8 +141,7 @@ options:
117
141
  Drove endpoint. (For example: https://drove.test.com)
118
142
  --auth-header AUTH_HEADER, -t AUTH_HEADER
119
143
  Authorization header value for the provided drove endpoint
120
- --insecure INSECURE, -i INSECURE
121
- Do not verify SSL cert for server
144
+ --insecure, -i Do not verify SSL cert for server
122
145
  --username USERNAME, -u USERNAME
123
146
  Drove cluster username
124
147
  --password PASSWORD, -p PASSWORD
@@ -196,8 +219,23 @@ auth_header = %(prod_token)s
196
219
  ..
197
220
  ```
198
221
 
199
- The `DEFAULT` section can be used to define common variables like Insecure etc. The `local`, `stage`, `production` etc are names for inidividual clusters and these sections can be used to define configuration for individual clusters. Cluster name is referred to in the command line by using the `-c` command line option.\
200
- *Interpolation* of values is supported and can be acieved by using `%(variable_name)s` references.
222
+ ### Setting a Default Cluster
223
+ You can set a default cluster so you don't need to specify `-c cluster` on every command:
224
+
225
+ ```ini
226
+ [DEFAULT]
227
+ current_cluster = local
228
+ ...
229
+ ```
230
+
231
+ When `current_cluster` is set, commands will automatically use that cluster unless overridden with `-c`.
232
+
233
+ Priority order for cluster selection:
234
+
235
+ `-c cluster` command line flag >`current_cluster` in `[DEFAULT]` section > `DEFAULT` section endpoint
236
+
237
+ The `DEFAULT` section can be used to define common variables like Insecure etc. The `local`, `stage`, `production` etc are names for individual clusters and these sections can be used to define configuration for individual clusters. Cluster name is referred to in the command line by using the `-c` command line option.\
238
+ *Interpolation* of values is supported and can be achieved by using `%(variable_name)s` references.
201
239
 
202
240
  > * Note: The `DEFAULT` section is mandatory
203
241
  > * Note: The `s` at the end of `%(var)s` is mandatory for interpolation
@@ -247,11 +285,11 @@ $ drove -e http://localhost:10000 -u guest -p guest ...
247
285
  ```
248
286
 
249
287
  ## CLI format
250
- The following cli format is followed:
288
+ The following CLI format is followed:
251
289
 
252
290
  ```
253
291
  usage: drove [-h] [--file FILE] [--cluster CLUSTER] [--endpoint ENDPOINT] [--auth-header AUTH_HEADER] [--insecure INSECURE] [--username USERNAME] [--password PASSWORD] [--debug]
254
- {executor,cluster,apps,appinstances,tasks} ...
292
+ {executor,cluster,apps,appinstances,tasks,config} ...
255
293
  ```
256
294
  ### Basic Arguments
257
295
  ```
@@ -263,8 +301,7 @@ usage: drove [-h] [--file FILE] [--cluster CLUSTER] [--endpoint ENDPOINT] [--aut
263
301
  Drove endpoint. (For example: https://drove.test.com)
264
302
  --auth-header AUTH_HEADER, -t AUTH_HEADER
265
303
  Authorization header value for the provided drove endpoint
266
- --insecure INSECURE, -i INSECURE
267
- Do not verify SSL cert for server
304
+ --insecure, -i Do not verify SSL cert for server
268
305
  --username USERNAME, -u USERNAME
269
306
  Drove cluster username
270
307
  --password PASSWORD, -p PASSWORD
@@ -280,6 +317,7 @@ Commands in drove are meant to address specific functionality. They can be summa
280
317
  info Show details about executor
281
318
  appinstances Show app instances running on this executor
282
319
  tasks Show tasks running on this executor
320
+ lsinstances Show local service instances running on this executor
283
321
  blacklist Blacklist executors
284
322
  unblacklist Un-blacklist executors
285
323
  ```
@@ -351,6 +389,25 @@ drove executor tasks [-h] [--sort {0,1,2,3,4,5}] [--reverse] executor-id
351
389
  --reverse, -r Sort in reverse order
352
390
  ```
353
391
 
392
+ ##### lsinstances
393
+
394
+ Show local service instances running on this executor
395
+
396
+ ```shell
397
+ drove executor lsinstances [-h] [--sort {0,1,2,3,4,5}] [--reverse] executor-id
398
+ ```
399
+ ###### Positional Arguments
400
+
401
+ `executor-id` - Executor id for which info is to be shown
402
+
403
+ ###### Arguments
404
+
405
+ ```
406
+ --sort {0,1,2,3,4,5}, -s {0,1,2,3,4,5}
407
+ Sort output by column
408
+ --reverse, -r Sort in reverse order
409
+ ```
410
+
354
411
  ##### blacklist
355
412
 
356
413
  Take executors out of rotation.
@@ -368,12 +425,12 @@ drove executor blacklist executor-id [executor-id ...]
368
425
  Bring blacklisted executors back into rotation.
369
426
 
370
427
  ```shell
371
- drove executor blacklist executor-id [executor-id ...]
428
+ drove executor unblacklist executor-id [executor-id ...]
372
429
  ```
373
430
 
374
431
  ###### Positional Arguments
375
432
 
376
- `executor-id` - List of executor ids to be blacklisted. At least one is mandatory.
433
+ `executor-id` - List of executor ids to be brought in to the rotation. At least one is mandatory.
377
434
 
378
435
  ### cluster
379
436
  ---
@@ -820,6 +877,407 @@ drove tasks download [-h] [--out OUT] source-app task-id file
820
877
  ```
821
878
  --out OUT, -o OUT Filename to download to. Default is the same filename as provided.
822
879
  ```
880
+ ### localservices
881
+ ---
882
+ Drove local service related commands
883
+
884
+ ```shell
885
+ drove localservices [-h] {list,summary,spec,create,destroy,activate,deactivate,restart,cancelop} ...
886
+ ```
887
+ #### Sub-commands
888
+
889
+ ##### list
890
+
891
+ List all local services
892
+
893
+ ```shell
894
+ drove localservices list [-h] [--sort {0,1,2,3,4,5,6,7,8}] [--reverse]
895
+ ```
896
+
897
+ ###### Named Arguments
898
+
899
+ ```
900
+ --sort {0,1,2,3,4,5,6,7,8}, -s {0,1,2,3,4,5,6,7,8}
901
+ Sort output by column
902
+ --reverse, -r Sort in reverse order
903
+ ```
904
+
905
+ ##### summary
906
+
907
+ Show a summary for a local service
908
+ ```shell
909
+ drove localservices summary [-h] service-id
910
+ ```
911
+ ###### Positional Arguments
912
+
913
+ `service-id` - Local Service ID
914
+
915
+ ##### spec
916
+
917
+ Print the raw json spec for a local service
918
+ ```shell
919
+ drove localservices spec [-h] service-id
920
+ ```
921
+ ###### Positional Arguments
922
+
923
+ `service-id` - Local Service ID
924
+
925
+ ##### create
926
+
927
+ Create local service on cluster
928
+ ```shell
929
+ drove localservices create [-h] spec-file
930
+ ```
931
+ ###### Positional Arguments
932
+
933
+ `spec-file` - JSON spec file for the local service
934
+
935
+ ##### destroy
936
+
937
+ Destroy an inactive local service
938
+
939
+ ```shell
940
+ drove localservices destroy [-h] service-id
941
+ ```
942
+ ###### Positional Arguments
943
+
944
+ `service-id` - Local Service ID
945
+
946
+
947
+ ##### activate
948
+
949
+ Activate a local service
950
+
951
+ ```shell
952
+ drove localservices activate [-h] service-id
953
+ ```
954
+ ###### Positional Arguments
955
+
956
+ `service-id` - Local Service ID
957
+
958
+ ##### deactivate
959
+
960
+ Deactivate a local service
961
+
962
+ ```shell
963
+ drove localservices deactivate [-h] service-id
964
+ ```
965
+ ###### Positional Arguments
966
+
967
+ `service-id` - Local Service ID
968
+
969
+ ##### update
970
+
971
+ Deactivate a local service
972
+
973
+ ```shell
974
+ drove localservices update [-h] service-id count
975
+ ```
976
+ ###### Positional Arguments
977
+
978
+ `service-id` - Local Service ID
979
+ `count` - Number of instances per executor
980
+
981
+ ##### restart
982
+
983
+ Restart a local service.
984
+
985
+ ```shell
986
+ drove localservices restart [-h] [--stop] [--parallelism PARALLELISM] [--timeout TIMEOUT] [--wait] service-id
987
+ ```
988
+
989
+ ###### Positional Arguments
990
+
991
+ `service-id` - Local Service ID
992
+
993
+ ###### Named Arguments
994
+ ```
995
+ --stop, -s Stop current instance before spinning up new ones
996
+ --parallelism PARALLELISM, -p PARALLELISM
997
+ Number of parallel threads to be used to execute operation
998
+ --timeout TIMEOUT, -t TIMEOUT
999
+ Timeout for the operation on the cluster
1000
+ --wait, -w Wait to ensure all instances are replaced
1001
+ ```
1002
+ ##### cancelop
1003
+
1004
+ Cancel current operation
1005
+ ```shell
1006
+ drove localservices cancelop [-h] service-id
1007
+ ```
1008
+ ###### Positional Arguments
1009
+ `service-id` - Service ID
1010
+
1011
+ ### lsinstances
1012
+ ---
1013
+ Drove local service instance related commands
1014
+
1015
+ ```shell
1016
+ drove lsinstances [-h] {list,info,logs,tail,download,replace,kill} ...
1017
+ ```
1018
+ #### Sub-commands
1019
+
1020
+ ##### list
1021
+
1022
+ List all local service instances
1023
+ ```shell
1024
+ drove lsinstances list [-h] [--old] [--sort {0,1,2,3,4,5}] [--reverse] service-id
1025
+ ```
1026
+ ###### Positional Arguments
1027
+ `service-id` - Local Service ID
1028
+
1029
+ ###### Named Arguments
1030
+
1031
+ ```
1032
+ --parallelism PARALLELISM, -p PARALLELISM
1033
+ Number of parallel threads to be used to execute operation (default: 1)
1034
+ --timeout TIMEOUT, -t TIMEOUT
1035
+ Timeout for the operation on the cluster (default: 5 minutes)
1036
+ ```
1037
+ ##### info
1038
+
1039
+ Print details for an local service instance
1040
+ ```shell
1041
+ drove lsinstances info [-h] service-id instance-id
1042
+ ```
1043
+ ###### Positional Arguments
1044
+ `service-id` - Local Service ID\
1045
+ `instance-id` - Local Service Instance ID
1046
+
1047
+ ##### logs
1048
+
1049
+ Print list of logs for local service instance
1050
+ ```shell
1051
+ drove lsinstances logs [-h] service-id instance-id
1052
+ ```
1053
+ ###### Positional Arguments
1054
+
1055
+ `service-id` - Local Service ID\
1056
+ `instance-id` - Local Service Instance ID
1057
+
1058
+ ##### tail
1059
+
1060
+ Tail log for local service instance
1061
+ ```shell
1062
+ drove lsinstances tail [-h] [--file FILE] service-id instance-id
1063
+ ```
1064
+ ###### Positional Arguments
1065
+
1066
+ `service-id` - Local Service ID
1067
+ `instance-id` - Local Service Instance ID
1068
+
1069
+ ###### Named Arguments
1070
+
1071
+ ```
1072
+ --log LOG, -l LOG Log filename to tail. Default is to tail output.log
1073
+ ```
1074
+
1075
+ ##### download
1076
+
1077
+ Download log for local service instance
1078
+ ```shell
1079
+ drove lsinstances download [-h] [--out OUT] service-id instance-id file
1080
+ ```
1081
+ ###### Positional Arguments
1082
+
1083
+ `service-id` - Local Service ID
1084
+ `instance-id` - Local Service Instance ID
1085
+ `file` - Log filename to download
1086
+
1087
+ ###### Named Arguments
1088
+ ```
1089
+ --out, -o Filename to download to. Default is the same filename as provided.
1090
+ ```
1091
+ ##### replace
1092
+
1093
+ Replace specific local service instances with fresh instances
1094
+ ```shell
1095
+ drove lsinstances replace [-h] [--stop] [--parallelism PARALLELISM] [--timeout TIMEOUT] [--wait] service-id instance-id [instance-id ...]
1096
+ ```
1097
+ ###### Positional Arguments
1098
+ `service-id` - Local Service ID
1099
+ `instance-id` - Local Service Instance IDs
1100
+
1101
+ ###### Named Arguments
1102
+ ```
1103
+ --stop, -s Stop the instance before spinning up a new one
1104
+ --parallelism PARALLELISM, -p PARALLELISM
1105
+ Number of parallel threads to be used to execute operation
1106
+ --timeout TIMEOUT, -t TIMEOUT
1107
+ Timeout for the operation on the cluster
1108
+ --wait, -w Wait to ensure all instances are replaced
1109
+ ```
1110
+
1111
+ ##### kill
1112
+
1113
+ Kill specific local service instances
1114
+ ```shell
1115
+ drove lsinstances kill [-h] [--parallelism PARALLELISM] [--timeout TIMEOUT] service-id instance-id [instance-id ...]
1116
+ ```
1117
+ ###### Positional Arguments
1118
+ `service-id` - Local Service ID
1119
+ `instance-id` - Local Service Instance IDs
1120
+
1121
+ ###### Named Arguments
1122
+
1123
+ ```
1124
+ --parallelism PARALLELISM, -p PARALLELISM
1125
+ Number of parallel threads to be used to execute operation
1126
+ --timeout TIMEOUT, -t TIMEOUT
1127
+ Timeout for the operation on the cluster (default: 5 minutes)
1128
+ --wait, -w Wait to ensure all instances are killed
1129
+ ```
1130
+
1131
+ ### config
1132
+ ---
1133
+ Manage drove cluster configurations (similar to kubectl config). These commands do not require an active cluster connection.
1134
+
1135
+ ```shell
1136
+ drove config [-h] {get-clusters,current-cluster,use-cluster,view,init,add-cluster,delete-cluster} ...
1137
+ ```
1138
+
1139
+ #### Sub-commands
1140
+
1141
+ ##### get-clusters
1142
+
1143
+ List all configured clusters
1144
+
1145
+ ```shell
1146
+ drove config get-clusters [-h]
1147
+ ```
1148
+
1149
+ Example output:
1150
+ ```
1151
+ CURRENT NAME ENDPOINT AUTH INSECURE
1152
+ -----------------------------------------------------------------------------------------------
1153
+ * local http://localhost:4000 yes no
1154
+ stage http://stage.drove.com:4000 yes no
1155
+
1156
+ Current cluster: local
1157
+ ```
1158
+
1159
+ ##### current-cluster
1160
+
1161
+ Show the current default cluster
1162
+
1163
+ ```shell
1164
+ drove config current-cluster [-h]
1165
+ ```
1166
+
1167
+ ##### use-cluster
1168
+
1169
+ Set the default cluster. After setting, all commands will use this cluster unless overridden with `-c`.
1170
+
1171
+ ```shell
1172
+ drove config use-cluster [-h] cluster-name
1173
+ ```
1174
+
1175
+ ###### Positional Arguments
1176
+
1177
+ `cluster-name` - Name of the cluster to set as default
1178
+
1179
+ Example:
1180
+ ```shell
1181
+ $ drove config use-cluster stage
1182
+ Switched to cluster "stage".
1183
+ ```
1184
+
1185
+ ##### view
1186
+
1187
+ Display the full configuration file
1188
+
1189
+ ```shell
1190
+ drove config view [-h] [--raw]
1191
+ ```
1192
+
1193
+ ###### Named Arguments
1194
+
1195
+ ```
1196
+ --raw, -r Show raw config file content instead of formatted output
1197
+ ```
1198
+
1199
+ ##### init
1200
+
1201
+ Initialize a new `~/.drove` config file. Will fail if the file already exists.
1202
+
1203
+ ```shell
1204
+ drove config init [-h] --endpoint ENDPOINT [--name NAME] [--username USERNAME] [--password PASSWORD] [--auth-header AUTH_HEADER] [--insecure]
1205
+ ```
1206
+
1207
+ ###### Named Arguments
1208
+
1209
+ ```
1210
+ --endpoint ENDPOINT, -e ENDPOINT
1211
+ Drove endpoint URL (required)
1212
+ --name NAME, -n NAME Cluster name (default: "default")
1213
+ --username USERNAME, -u USERNAME
1214
+ Username for basic auth
1215
+ --password PASSWORD, -p PASSWORD
1216
+ Password for basic auth
1217
+ --auth-header AUTH_HEADER, -t AUTH_HEADER
1218
+ Authorization header value
1219
+ --insecure, -i Skip SSL verification
1220
+ ```
1221
+
1222
+ Example:
1223
+ ```shell
1224
+ $ drove config init -e http://localhost:4000 -n local -u admin -p admin
1225
+ Config initialized at: /home/user/.drove
1226
+ Current cluster set to: local
1227
+ ```
1228
+
1229
+ ##### add-cluster
1230
+
1231
+ Add a new cluster to the config file
1232
+
1233
+ ```shell
1234
+ drove config add-cluster [-h] --endpoint ENDPOINT [--username USERNAME] [--password PASSWORD] [--auth-header AUTH_HEADER] [--insecure] cluster-name
1235
+ ```
1236
+
1237
+ ###### Positional Arguments
1238
+
1239
+ `cluster-name` - Name for this cluster
1240
+
1241
+ ###### Named Arguments
1242
+
1243
+ ```
1244
+ --endpoint ENDPOINT, -e ENDPOINT
1245
+ Drove endpoint URL (required)
1246
+ --username USERNAME, -u USERNAME
1247
+ Username for basic auth
1248
+ --password PASSWORD, -p PASSWORD
1249
+ Password for basic auth
1250
+ --auth-header AUTH_HEADER, -t AUTH_HEADER
1251
+ Authorization header value
1252
+ --insecure, -i Skip SSL verification
1253
+ ```
1254
+
1255
+ Example:
1256
+ ```shell
1257
+ $ drove config add-cluster production -e https://prod.drove.com -t "Bearer <token>"
1258
+ Cluster 'production' added to /home/user/.drove
1259
+ ```
1260
+
1261
+ ##### delete-cluster
1262
+
1263
+ Remove a cluster from the config file
1264
+
1265
+ ```shell
1266
+ drove config delete-cluster [-h] cluster-name
1267
+ ```
1268
+
1269
+ ###### Positional Arguments
1270
+
1271
+ `cluster-name` - Name of the cluster to remove
1272
+
1273
+ Example:
1274
+ ```shell
1275
+ $ drove config delete-cluster stage
1276
+
1277
+ Cluster 'staging' deleted from /home/user/.drove
1278
+ ```
1279
+
1280
+ > **Note:** If you delete the current default cluster, it will be unset and you'll need to use `drove config use-cluster` to set a new default.
823
1281
 
824
1282
  ©2024, Santanu Sinha.
825
1283