clever-tools 4.4.1 → 4.5.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/bin/clever.js +208 -2125
- package/package.json +33 -25
- package/src/commands/README.md +65 -0
- package/src/commands/accesslogs/accesslogs.command.js +158 -0
- package/src/commands/accesslogs/accesslogs.docs.md +20 -0
- package/src/commands/{activity.js → activity/activity.command.js} +74 -44
- package/src/commands/activity/activity.docs.md +19 -0
- package/src/commands/addon/addon.args.js +14 -0
- package/src/commands/addon/addon.command.js +7 -0
- package/src/commands/addon/addon.create.command.js +236 -0
- package/src/commands/addon/addon.delete.command.js +32 -0
- package/src/commands/addon/addon.docs.md +156 -0
- package/src/commands/addon/addon.env.command.js +50 -0
- package/src/commands/addon/addon.list.command.js +55 -0
- package/src/commands/addon/addon.providers.command.js +45 -0
- package/src/commands/addon/addon.providers.show.command.js +99 -0
- package/src/commands/addon/addon.rename.command.js +24 -0
- package/src/commands/applications/applications.command.js +59 -0
- package/src/commands/applications/applications.docs.md +31 -0
- package/src/commands/applications/applications.list.command.js +100 -0
- package/src/commands/cancel-deploy/cancel-deploy.command.js +30 -0
- package/src/commands/cancel-deploy/cancel-deploy.docs.md +16 -0
- package/src/commands/config/config.args.js +10 -0
- package/src/commands/config/config.command.js +20 -0
- package/src/commands/config/config.docs.md +86 -0
- package/src/commands/config/config.get.command.js +21 -0
- package/src/commands/config/config.set.command.js +38 -0
- package/src/commands/config/config.update.command.js +88 -0
- package/src/commands/console/console.command.js +31 -0
- package/src/commands/console/console.docs.md +16 -0
- package/src/commands/create/create.command.js +173 -0
- package/src/commands/create/create.docs.md +27 -0
- package/src/commands/{curl.js → curl/curl.command.js} +10 -3
- package/src/commands/curl/curl.docs.md +9 -0
- package/src/commands/database/database.args.js +8 -0
- package/src/commands/database/database.backups.command.js +60 -0
- package/src/commands/database/database.backups.download.command.js +55 -0
- package/src/commands/database/database.command.js +10 -0
- package/src/commands/database/database.docs.md +52 -0
- package/src/commands/delete/delete.command.js +43 -0
- package/src/commands/delete/delete.docs.md +17 -0
- package/src/commands/deploy/deploy.command.js +166 -0
- package/src/commands/deploy/deploy.docs.md +22 -0
- package/src/commands/diag/diag.command.js +136 -0
- package/src/commands/diag/diag.docs.md +15 -0
- package/src/commands/domain/domain.add.command.js +25 -0
- package/src/commands/domain/domain.args.js +8 -0
- package/src/commands/domain/domain.command.js +38 -0
- package/src/commands/domain/domain.diag.command.js +204 -0
- package/src/commands/domain/domain.docs.md +143 -0
- package/src/commands/domain/domain.favourite.command.js +35 -0
- package/src/commands/domain/domain.favourite.set.command.js +24 -0
- package/src/commands/domain/domain.favourite.unset.command.js +23 -0
- package/src/commands/domain/domain.overview.command.js +157 -0
- package/src/commands/domain/domain.rm.command.js +25 -0
- package/src/commands/drain/drain.args.js +8 -0
- package/src/commands/drain/drain.command.js +56 -0
- package/src/commands/drain/drain.create.command.js +128 -0
- package/src/commands/drain/drain.disable.command.js +27 -0
- package/src/commands/drain/drain.docs.md +129 -0
- package/src/commands/drain/drain.enable.command.js +27 -0
- package/src/commands/drain/drain.get.command.js +38 -0
- package/src/commands/drain/drain.remove.command.js +26 -0
- package/src/commands/emails/emails.add.command.js +32 -0
- package/src/commands/emails/emails.args.js +8 -0
- package/src/commands/emails/emails.command.js +35 -0
- package/src/commands/emails/emails.docs.md +79 -0
- package/src/commands/emails/emails.open.command.js +15 -0
- package/src/commands/emails/emails.primary.command.js +29 -0
- package/src/commands/emails/emails.remove-all.command.js +54 -0
- package/src/commands/emails/emails.remove.command.js +25 -0
- package/src/commands/env/env.command.js +77 -0
- package/src/commands/env/env.docs.md +99 -0
- package/src/commands/env/env.import-vars.command.js +45 -0
- package/src/commands/env/env.import.command.js +29 -0
- package/src/commands/env/env.rm.command.js +25 -0
- package/src/commands/env/env.set.command.js +32 -0
- package/src/commands/features/features.args.js +9 -0
- package/src/commands/features/features.command.js +7 -0
- package/src/commands/features/features.disable.command.js +25 -0
- package/src/commands/features/features.docs.md +71 -0
- package/src/commands/features/features.enable.command.js +32 -0
- package/src/commands/features/features.info.command.js +27 -0
- package/src/commands/features/features.list.command.js +49 -0
- package/src/commands/global.args.js +45 -0
- package/src/commands/global.commands.js +461 -0
- package/src/commands/global.options.js +186 -0
- package/src/commands/help/help.command.js +9 -0
- package/src/commands/help/help.docs.md +9 -0
- package/src/commands/k8s/k8s.add-persistent-storage.command.js +39 -0
- package/src/commands/k8s/k8s.args.js +9 -0
- package/src/commands/k8s/k8s.command.js +12 -0
- package/src/commands/k8s/k8s.create.command.js +86 -0
- package/src/commands/k8s/k8s.delete.command.js +40 -0
- package/src/commands/k8s/k8s.docs.md +131 -0
- package/src/commands/k8s/k8s.get-kubeconfig.command.js +32 -0
- package/src/commands/k8s/k8s.get.command.js +43 -0
- package/src/commands/k8s/k8s.list.command.js +38 -0
- package/src/commands/keycloak/keycloak.command.js +17 -0
- package/src/commands/keycloak/keycloak.disable-ng.command.js +13 -0
- package/src/commands/keycloak/keycloak.docs.md +197 -0
- package/src/commands/keycloak/keycloak.enable-ng.command.js +13 -0
- package/src/commands/keycloak/keycloak.get.command.js +17 -0
- package/src/commands/keycloak/keycloak.open.command.js +13 -0
- package/src/commands/keycloak/keycloak.open.logs.command.js +13 -0
- package/src/commands/keycloak/keycloak.open.webui.command.js +13 -0
- package/src/commands/keycloak/keycloak.rebuild.command.js +13 -0
- package/src/commands/keycloak/keycloak.restart.command.js +13 -0
- package/src/commands/keycloak/keycloak.version.check.command.js +17 -0
- package/src/commands/keycloak/keycloak.version.command.js +17 -0
- package/src/commands/keycloak/keycloak.version.update.command.js +17 -0
- package/src/commands/kv/kv.command.js +99 -0
- package/src/commands/kv/kv.docs.md +27 -0
- package/src/commands/link/link.command.js +31 -0
- package/src/commands/link/link.docs.md +22 -0
- package/src/commands/{login.js → login/login.command.js} +44 -22
- package/src/commands/login/login.docs.md +16 -0
- package/src/commands/logout/logout.command.js +15 -0
- package/src/commands/logout/logout.docs.md +9 -0
- package/src/commands/logs/logs.command.js +81 -0
- package/src/commands/logs/logs.docs.md +22 -0
- package/src/commands/make-default/make-default.command.js +17 -0
- package/src/commands/make-default/make-default.docs.md +15 -0
- package/src/commands/matomo/matomo.command.js +17 -0
- package/src/commands/matomo/matomo.docs.md +109 -0
- package/src/commands/matomo/matomo.get.command.js +17 -0
- package/src/commands/matomo/matomo.open.command.js +13 -0
- package/src/commands/matomo/matomo.open.logs.command.js +13 -0
- package/src/commands/matomo/matomo.open.webui.command.js +13 -0
- package/src/commands/matomo/matomo.rebuild.command.js +13 -0
- package/src/commands/matomo/matomo.restart.command.js +13 -0
- package/src/commands/metabase/metabase.command.js +17 -0
- package/src/commands/metabase/metabase.docs.md +169 -0
- package/src/commands/metabase/metabase.get.command.js +17 -0
- package/src/commands/metabase/metabase.open.command.js +13 -0
- package/src/commands/metabase/metabase.open.logs.command.js +13 -0
- package/src/commands/metabase/metabase.open.webui.command.js +13 -0
- package/src/commands/metabase/metabase.rebuild.command.js +13 -0
- package/src/commands/metabase/metabase.restart.command.js +13 -0
- package/src/commands/metabase/metabase.version.check.command.js +17 -0
- package/src/commands/metabase/metabase.version.command.js +17 -0
- package/src/commands/metabase/metabase.version.update.command.js +17 -0
- package/src/commands/ng/ng.args.js +27 -0
- package/src/commands/ng/ng.command.js +45 -0
- package/src/commands/ng/ng.create.command.js +60 -0
- package/src/commands/ng/ng.create.external.command.js +44 -0
- package/src/commands/ng/ng.delete.command.js +22 -0
- package/src/commands/ng/ng.delete.external.command.js +25 -0
- package/src/commands/ng/ng.docs.md +214 -0
- package/src/commands/ng/ng.get-config.command.js +32 -0
- package/src/commands/ng/ng.get.command.js +22 -0
- package/src/commands/ng/ng.link.command.js +25 -0
- package/src/commands/ng/ng.options.js +9 -0
- package/src/commands/ng/ng.search.command.js +22 -0
- package/src/commands/ng/ng.unlink.command.js +25 -0
- package/src/commands/notify-email/notify-email.add.command.js +65 -0
- package/src/commands/notify-email/notify-email.command.js +61 -0
- package/src/commands/notify-email/notify-email.docs.md +60 -0
- package/src/commands/notify-email/notify-email.remove.command.js +24 -0
- package/src/commands/open/open.command.js +24 -0
- package/src/commands/open/open.docs.md +16 -0
- package/src/commands/otoroshi/otoroshi.command.js +17 -0
- package/src/commands/otoroshi/otoroshi.disable-ng.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.docs.md +211 -0
- package/src/commands/otoroshi/otoroshi.enable-ng.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.get-config.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.get.command.js +17 -0
- package/src/commands/otoroshi/otoroshi.open.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.open.logs.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.open.webui.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.rebuild.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.restart.command.js +13 -0
- package/src/commands/otoroshi/otoroshi.version.check.command.js +17 -0
- package/src/commands/otoroshi/otoroshi.version.command.js +17 -0
- package/src/commands/otoroshi/otoroshi.version.update.command.js +17 -0
- package/src/commands/profile/profile.command.js +60 -0
- package/src/commands/profile/profile.docs.md +23 -0
- package/src/commands/profile/profile.open.command.js +12 -0
- package/src/commands/published-config/published-config.command.js +40 -0
- package/src/commands/published-config/published-config.docs.md +77 -0
- package/src/commands/published-config/published-config.import.command.js +29 -0
- package/src/commands/published-config/published-config.rm.command.js +27 -0
- package/src/commands/published-config/published-config.set.command.js +34 -0
- package/src/commands/restart/restart.command.js +77 -0
- package/src/commands/restart/restart.docs.md +21 -0
- package/src/commands/scale/scale.command.js +121 -0
- package/src/commands/scale/scale.docs.md +23 -0
- package/src/commands/service/service.command.js +91 -0
- package/src/commands/service/service.docs.md +104 -0
- package/src/commands/service/service.link-addon.command.js +24 -0
- package/src/commands/service/service.link-app.command.js +23 -0
- package/src/commands/service/service.unlink-addon.command.js +24 -0
- package/src/commands/service/service.unlink-app.command.js +23 -0
- package/src/commands/ssh/ssh.command.js +40 -0
- package/src/commands/ssh/ssh.docs.md +17 -0
- package/src/commands/ssh-keys/ssh-keys.add.command.js +41 -0
- package/src/commands/ssh-keys/ssh-keys.args.js +8 -0
- package/src/commands/ssh-keys/ssh-keys.command.js +50 -0
- package/src/commands/ssh-keys/ssh-keys.docs.md +66 -0
- package/src/commands/ssh-keys/ssh-keys.open.command.js +12 -0
- package/src/commands/ssh-keys/ssh-keys.remove-all.command.js +54 -0
- package/src/commands/ssh-keys/ssh-keys.remove.command.js +26 -0
- package/src/commands/status/status.command.js +122 -0
- package/src/commands/status/status.docs.md +17 -0
- package/src/commands/stop/stop.command.js +23 -0
- package/src/commands/stop/stop.docs.md +16 -0
- package/src/commands/tcp-redirs/tcp-redirs.add.command.js +24 -0
- package/src/commands/tcp-redirs/tcp-redirs.command.js +41 -0
- package/src/commands/tcp-redirs/tcp-redirs.docs.md +71 -0
- package/src/commands/tcp-redirs/tcp-redirs.list-namespaces.command.js +48 -0
- package/src/commands/tcp-redirs/tcp-redirs.options.js +11 -0
- package/src/commands/tcp-redirs/tcp-redirs.remove.command.js +34 -0
- package/src/commands/tokens/tokens.command.js +43 -0
- package/src/commands/tokens/tokens.create.command.js +108 -0
- package/src/commands/tokens/tokens.docs.md +50 -0
- package/src/commands/tokens/tokens.revoke.command.js +25 -0
- package/src/commands/unlink/unlink.command.js +21 -0
- package/src/commands/unlink/unlink.docs.md +15 -0
- package/src/commands/version/version.command.js +13 -0
- package/src/commands/version/version.docs.md +9 -0
- package/src/commands/webhooks/webhooks.add.command.js +51 -0
- package/src/commands/webhooks/webhooks.command.js +57 -0
- package/src/commands/webhooks/webhooks.docs.md +61 -0
- package/src/commands/webhooks/webhooks.remove.command.js +24 -0
- package/src/lib/cliparse-patched.js +192 -0
- package/src/lib/define-argument.js +7 -0
- package/src/lib/define-argument.types.d.ts +23 -0
- package/src/lib/define-command.js +7 -0
- package/src/lib/define-command.types.d.ts +85 -0
- package/src/lib/define-common.types.d.ts +18 -0
- package/src/lib/define-option.js +7 -0
- package/src/lib/define-option.types.d.ts +29 -0
- package/src/lib/get-command-info.js +86 -0
- package/src/lib/get-command-info.types.d.ts +42 -0
- package/src/lib/zod-utils.js +66 -0
- package/src/models/addon.js +2 -3
- package/src/models/application.js +4 -5
- package/src/models/application_configuration.js +5 -23
- package/src/models/domain.js +34 -2
- package/src/models/exit-strategy-option.js +0 -9
- package/src/models/git.js +1 -4
- package/src/models/log-v4.js +5 -0
- package/src/models/log.js +5 -0
- package/src/models/namespaces.js +1 -2
- package/src/models/notification.js +1 -7
- package/src/parsers.js +33 -92
- package/src/command-options.js +0 -55
- package/src/command-promise-handler.js +0 -16
- package/src/commands/accesslogs.js +0 -138
- package/src/commands/addon.js +0 -391
- package/src/commands/applications.js +0 -123
- package/src/commands/cancel-deploy.js +0 -19
- package/src/commands/config.js +0 -47
- package/src/commands/console.js +0 -20
- package/src/commands/create.js +0 -129
- package/src/commands/database.js +0 -73
- package/src/commands/delete.js +0 -24
- package/src/commands/deploy.js +0 -133
- package/src/commands/diag.js +0 -126
- package/src/commands/domain.js +0 -445
- package/src/commands/drain.js +0 -164
- package/src/commands/emails.js +0 -156
- package/src/commands/env.js +0 -124
- package/src/commands/features.js +0 -87
- package/src/commands/k8s.js +0 -193
- package/src/commands/keycloak.js +0 -138
- package/src/commands/kv.js +0 -93
- package/src/commands/link.js +0 -20
- package/src/commands/logout.js +0 -8
- package/src/commands/logs.js +0 -45
- package/src/commands/makeDefault.js +0 -11
- package/src/commands/matomo.js +0 -85
- package/src/commands/metabase.js +0 -112
- package/src/commands/ng.js +0 -202
- package/src/commands/notify-email.js +0 -99
- package/src/commands/open.js +0 -13
- package/src/commands/otoroshi.js +0 -149
- package/src/commands/profile.js +0 -55
- package/src/commands/published-config.js +0 -70
- package/src/commands/restart.js +0 -52
- package/src/commands/scale.js +0 -66
- package/src/commands/service.js +0 -105
- package/src/commands/ssh-keys.js +0 -144
- package/src/commands/ssh.js +0 -20
- package/src/commands/status.js +0 -115
- package/src/commands/stop.js +0 -12
- package/src/commands/tcp-redirs.js +0 -80
- package/src/commands/tokens.js +0 -144
- package/src/commands/unlink.js +0 -14
- package/src/commands/version.js +0 -6
- package/src/commands/webhooks.js +0 -74
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# 📖 `clever service` command reference
|
|
2
|
+
|
|
3
|
+
## ➡️ `clever service` <kbd>Since 0.5.0</kbd>
|
|
4
|
+
|
|
5
|
+
Manage service dependencies
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
clever service [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### ⚙️ Options
|
|
12
|
+
|
|
13
|
+
|Name|Description|
|
|
14
|
+
|---|---|
|
|
15
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
16
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
17
|
+
|`-F`, `--format` `<format>`|Output format (human, json) (default: human)|
|
|
18
|
+
|`--only-addons`|Only show add-on dependencies|
|
|
19
|
+
|`--only-apps`|Only show app dependencies|
|
|
20
|
+
|`--show-all`|Show all available add-ons and applications|
|
|
21
|
+
|
|
22
|
+
## ➡️ `clever service link-addon` <kbd>Since 0.5.0</kbd>
|
|
23
|
+
|
|
24
|
+
Link an existing add-on to this application
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
clever service link-addon <addon-id|addon-name> [options]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 📥 Arguments
|
|
31
|
+
|
|
32
|
+
|Name|Description|
|
|
33
|
+
|---|---|
|
|
34
|
+
|`addon-id|addon-name`|Add-on ID (or name, if unambiguous)|
|
|
35
|
+
|
|
36
|
+
### ⚙️ Options
|
|
37
|
+
|
|
38
|
+
|Name|Description|
|
|
39
|
+
|---|---|
|
|
40
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
41
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
42
|
+
|
|
43
|
+
## ➡️ `clever service link-app` <kbd>Since 0.5.0</kbd>
|
|
44
|
+
|
|
45
|
+
Add an existing app as a dependency
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
clever service link-app <app-id|app-name> [options]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 📥 Arguments
|
|
52
|
+
|
|
53
|
+
|Name|Description|
|
|
54
|
+
|---|---|
|
|
55
|
+
|`app-id|app-name`|Application ID (or name, if unambiguous)|
|
|
56
|
+
|
|
57
|
+
### ⚙️ Options
|
|
58
|
+
|
|
59
|
+
|Name|Description|
|
|
60
|
+
|---|---|
|
|
61
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
62
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
63
|
+
|
|
64
|
+
## ➡️ `clever service unlink-addon` <kbd>Since 0.5.0</kbd>
|
|
65
|
+
|
|
66
|
+
Unlink an add-on from this application
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
clever service unlink-addon <addon-id|addon-name> [options]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 📥 Arguments
|
|
73
|
+
|
|
74
|
+
|Name|Description|
|
|
75
|
+
|---|---|
|
|
76
|
+
|`addon-id|addon-name`|Add-on ID (or name, if unambiguous)|
|
|
77
|
+
|
|
78
|
+
### ⚙️ Options
|
|
79
|
+
|
|
80
|
+
|Name|Description|
|
|
81
|
+
|---|---|
|
|
82
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
83
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
84
|
+
|
|
85
|
+
## ➡️ `clever service unlink-app` <kbd>Since 0.5.0</kbd>
|
|
86
|
+
|
|
87
|
+
Remove an app from the dependencies
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
clever service unlink-app <app-id|app-name> [options]
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 📥 Arguments
|
|
94
|
+
|
|
95
|
+
|Name|Description|
|
|
96
|
+
|---|---|
|
|
97
|
+
|`app-id|app-name`|Application ID (or name, if unambiguous)|
|
|
98
|
+
|
|
99
|
+
### ⚙️ Options
|
|
100
|
+
|
|
101
|
+
|Name|Description|
|
|
102
|
+
|---|---|
|
|
103
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
104
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { Logger } from '../../logger.js';
|
|
3
|
+
import * as Addon from '../../models/addon.js';
|
|
4
|
+
import * as Application from '../../models/application.js';
|
|
5
|
+
import { addonIdOrNameArg } from '../global.args.js';
|
|
6
|
+
import { aliasOption, appIdOrNameOption } from '../global.options.js';
|
|
7
|
+
|
|
8
|
+
export const serviceLinkAddonCommand = defineCommand({
|
|
9
|
+
description: 'Link an existing add-on to this application',
|
|
10
|
+
since: '0.5.0',
|
|
11
|
+
options: {
|
|
12
|
+
alias: aliasOption,
|
|
13
|
+
app: appIdOrNameOption,
|
|
14
|
+
},
|
|
15
|
+
args: [addonIdOrNameArg],
|
|
16
|
+
async handler(options, addon) {
|
|
17
|
+
const { alias, app: appIdOrName } = options;
|
|
18
|
+
|
|
19
|
+
const { ownerId, appId } = await Application.resolveId(appIdOrName, alias);
|
|
20
|
+
|
|
21
|
+
await Addon.link(ownerId, appId, addon);
|
|
22
|
+
Logger.println(`Addon ${addon.addon_id || addon.addon_name} successfully linked`);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { Logger } from '../../logger.js';
|
|
3
|
+
import * as Application from '../../models/application.js';
|
|
4
|
+
import { appIdOrNameArg } from '../global.args.js';
|
|
5
|
+
import { aliasOption, appIdOrNameOption } from '../global.options.js';
|
|
6
|
+
|
|
7
|
+
export const serviceLinkAppCommand = defineCommand({
|
|
8
|
+
description: 'Add an existing app as a dependency',
|
|
9
|
+
since: '0.5.0',
|
|
10
|
+
options: {
|
|
11
|
+
alias: aliasOption,
|
|
12
|
+
app: appIdOrNameOption,
|
|
13
|
+
},
|
|
14
|
+
args: [appIdOrNameArg],
|
|
15
|
+
async handler(options, dependency) {
|
|
16
|
+
const { alias, app: appIdOrName } = options;
|
|
17
|
+
|
|
18
|
+
const { ownerId, appId } = await Application.resolveId(appIdOrName, alias);
|
|
19
|
+
|
|
20
|
+
await Application.link(ownerId, appId, dependency);
|
|
21
|
+
Logger.println(`App ${dependency.app_id || dependency.app_name} successfully linked`);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { Logger } from '../../logger.js';
|
|
3
|
+
import * as Addon from '../../models/addon.js';
|
|
4
|
+
import * as Application from '../../models/application.js';
|
|
5
|
+
import { addonIdOrNameArg } from '../global.args.js';
|
|
6
|
+
import { aliasOption, appIdOrNameOption } from '../global.options.js';
|
|
7
|
+
|
|
8
|
+
export const serviceUnlinkAddonCommand = defineCommand({
|
|
9
|
+
description: 'Unlink an add-on from this application',
|
|
10
|
+
since: '0.5.0',
|
|
11
|
+
options: {
|
|
12
|
+
alias: aliasOption,
|
|
13
|
+
app: appIdOrNameOption,
|
|
14
|
+
},
|
|
15
|
+
args: [addonIdOrNameArg],
|
|
16
|
+
async handler(options, addon) {
|
|
17
|
+
const { alias, app: appIdOrName } = options;
|
|
18
|
+
|
|
19
|
+
const { ownerId, appId } = await Application.resolveId(appIdOrName, alias);
|
|
20
|
+
|
|
21
|
+
await Addon.unlink(ownerId, appId, addon);
|
|
22
|
+
Logger.println(`Addon ${addon.addon_id || addon.addon_name} successfully unlinked`);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { Logger } from '../../logger.js';
|
|
3
|
+
import * as Application from '../../models/application.js';
|
|
4
|
+
import { appIdOrNameArg } from '../global.args.js';
|
|
5
|
+
import { aliasOption, appIdOrNameOption } from '../global.options.js';
|
|
6
|
+
|
|
7
|
+
export const serviceUnlinkAppCommand = defineCommand({
|
|
8
|
+
description: 'Remove an app from the dependencies',
|
|
9
|
+
since: '0.5.0',
|
|
10
|
+
options: {
|
|
11
|
+
alias: aliasOption,
|
|
12
|
+
app: appIdOrNameOption,
|
|
13
|
+
},
|
|
14
|
+
args: [appIdOrNameArg],
|
|
15
|
+
async handler(options, dependency) {
|
|
16
|
+
const { alias, app: appIdOrName } = options;
|
|
17
|
+
|
|
18
|
+
const { ownerId, appId } = await Application.resolveId(appIdOrName, alias);
|
|
19
|
+
|
|
20
|
+
await Application.unlink(ownerId, appId, dependency);
|
|
21
|
+
Logger.println(`App ${dependency.app_id || dependency.app_name} successfully unlinked`);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
4
|
+
import { defineOption } from '../../lib/define-option.js';
|
|
5
|
+
import * as Application from '../../models/application.js';
|
|
6
|
+
import { conf } from '../../models/configuration.js';
|
|
7
|
+
import { aliasOption, appIdOrNameOption } from '../global.options.js';
|
|
8
|
+
|
|
9
|
+
export const sshCommand = defineCommand({
|
|
10
|
+
description: 'Connect to running instances through SSH',
|
|
11
|
+
since: '0.7.0',
|
|
12
|
+
options: {
|
|
13
|
+
identityFile: defineOption({
|
|
14
|
+
name: 'identity-file',
|
|
15
|
+
schema: z.string().optional(),
|
|
16
|
+
description: 'SSH identity file',
|
|
17
|
+
aliases: ['i'],
|
|
18
|
+
placeholder: 'identity-file',
|
|
19
|
+
}),
|
|
20
|
+
alias: aliasOption,
|
|
21
|
+
app: appIdOrNameOption,
|
|
22
|
+
},
|
|
23
|
+
args: [],
|
|
24
|
+
async handler(options) {
|
|
25
|
+
const { alias, app: appIdOrName, identityFile } = options;
|
|
26
|
+
|
|
27
|
+
const { appId } = await Application.resolveId(appIdOrName, alias);
|
|
28
|
+
const sshParams = ['-t', conf.SSH_GATEWAY, appId];
|
|
29
|
+
if (identityFile != null) {
|
|
30
|
+
sshParams.push('-i', identityFile);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
await new Promise((resolve, reject) => {
|
|
34
|
+
// TODO: we should catch errors
|
|
35
|
+
const sshProcess = spawn('ssh', sshParams, { stdio: 'inherit' });
|
|
36
|
+
sshProcess.on('exit', resolve);
|
|
37
|
+
sshProcess.on('error', reject);
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# 📖 `clever ssh` command reference
|
|
2
|
+
|
|
3
|
+
## ➡️ `clever ssh` <kbd>Since 0.7.0</kbd>
|
|
4
|
+
|
|
5
|
+
Connect to running instances through SSH
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
clever ssh [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### ⚙️ Options
|
|
12
|
+
|
|
13
|
+
|Name|Description|
|
|
14
|
+
|---|---|
|
|
15
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
16
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
17
|
+
|`-i`, `--identity-file` `<identity-file>`|SSH identity file|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { todo_addSshKey as addSshKey } from '@clevercloud/client/esm/api/v2/user.js';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { defineArgument } from '../../lib/define-argument.js';
|
|
5
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
6
|
+
import { Logger } from '../../logger.js';
|
|
7
|
+
import { sendToApi } from '../../models/send-to-api.js';
|
|
8
|
+
import { sshKeyNameArg } from './ssh-keys.args.js';
|
|
9
|
+
|
|
10
|
+
export const sshKeysAddCommand = defineCommand({
|
|
11
|
+
description: 'Add a new SSH key to the current user',
|
|
12
|
+
since: '3.13.0',
|
|
13
|
+
options: {},
|
|
14
|
+
args: [
|
|
15
|
+
sshKeyNameArg,
|
|
16
|
+
defineArgument({
|
|
17
|
+
schema: z.string(),
|
|
18
|
+
description: 'SSH public key path (.pub)',
|
|
19
|
+
placeholder: 'ssh-key-path',
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
async handler(_options, keyName, filePath) {
|
|
23
|
+
if (!fs.existsSync(filePath)) {
|
|
24
|
+
throw new Error(`File ${filePath} does not exist`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const pubKeyContent = fs.readFileSync(filePath, 'utf8').trim();
|
|
28
|
+
Logger.debug(`SSH key file content: ${pubKeyContent}`);
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
await addSshKey({ key: encodeURIComponent(keyName) }, JSON.stringify(pubKeyContent)).then(sendToApi);
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.log(e?.responseBody?.id);
|
|
34
|
+
if (e?.responseBody?.id === 505) {
|
|
35
|
+
throw new Error("This SSH key is not valid, please make sure you're pointing to the public key file");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
Logger.printSuccess(`SSH key ${keyName} added successfully`);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import dedent from 'dedent';
|
|
2
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
3
|
+
import { styleText } from '../../lib/style-text.js';
|
|
4
|
+
import { Logger } from '../../logger.js';
|
|
5
|
+
import { getUserSshKeys } from '../../models/ssh-keys.js';
|
|
6
|
+
import { humanJsonOutputFormatOption } from '../global.options.js';
|
|
7
|
+
|
|
8
|
+
export const sshKeysCommand = defineCommand({
|
|
9
|
+
description: 'Manage SSH keys of the current user',
|
|
10
|
+
since: '3.13.0',
|
|
11
|
+
options: {
|
|
12
|
+
format: humanJsonOutputFormatOption,
|
|
13
|
+
},
|
|
14
|
+
args: [],
|
|
15
|
+
async handler(options) {
|
|
16
|
+
const { format } = options;
|
|
17
|
+
|
|
18
|
+
const keys = await getUserSshKeys();
|
|
19
|
+
|
|
20
|
+
switch (format) {
|
|
21
|
+
case 'json': {
|
|
22
|
+
Logger.printJson(keys);
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
case 'human':
|
|
26
|
+
default: {
|
|
27
|
+
if (keys.length === 0) {
|
|
28
|
+
Logger.println(dedent`
|
|
29
|
+
${styleText('blue', '🔐 No SSH keys')}
|
|
30
|
+
|
|
31
|
+
To list the SSH keys on your local system, use the following command:
|
|
32
|
+
${styleText('grey', 'ssh-add -l -E sha256')}
|
|
33
|
+
|
|
34
|
+
To create a new key pair, use the following command:
|
|
35
|
+
${styleText('grey', 'ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_clever -C "An optional comment"')}
|
|
36
|
+
|
|
37
|
+
Then add the public key to your Clever Cloud account:
|
|
38
|
+
${styleText('grey', 'clever ssh-keys add myNewKey ~/.ssh/id_ed25519_clever.pub')}
|
|
39
|
+
`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
Logger.println(`🔐 ${keys.length} SSH key(s):`);
|
|
44
|
+
keys.forEach((key) => {
|
|
45
|
+
Logger.println(` • ${styleText('blue', key.name)}`, styleText('grey', `(${key.fingerprint})`));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# 📖 `clever ssh-keys` command reference
|
|
2
|
+
|
|
3
|
+
## ➡️ `clever ssh-keys` <kbd>Since 3.13.0</kbd>
|
|
4
|
+
|
|
5
|
+
Manage SSH keys of the current user
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
clever ssh-keys [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### ⚙️ Options
|
|
12
|
+
|
|
13
|
+
|Name|Description|
|
|
14
|
+
|---|---|
|
|
15
|
+
|`-F`, `--format` `<format>`|Output format (human, json) (default: human)|
|
|
16
|
+
|
|
17
|
+
## ➡️ `clever ssh-keys add` <kbd>Since 3.13.0</kbd>
|
|
18
|
+
|
|
19
|
+
Add a new SSH key to the current user
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
clever ssh-keys add <ssh-key-name> <ssh-key-path>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 📥 Arguments
|
|
26
|
+
|
|
27
|
+
|Name|Description|
|
|
28
|
+
|---|---|
|
|
29
|
+
|`ssh-key-name`|SSH key name|
|
|
30
|
+
|`ssh-key-path`|SSH public key path (.pub)|
|
|
31
|
+
|
|
32
|
+
## ➡️ `clever ssh-keys open` <kbd>Since 3.13.0</kbd>
|
|
33
|
+
|
|
34
|
+
Open the SSH keys management page in the Console
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
clever ssh-keys open
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## ➡️ `clever ssh-keys remove` <kbd>Since 3.13.0</kbd>
|
|
41
|
+
|
|
42
|
+
Remove a SSH key from the current user
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
clever ssh-keys remove <ssh-key-name>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 📥 Arguments
|
|
49
|
+
|
|
50
|
+
|Name|Description|
|
|
51
|
+
|---|---|
|
|
52
|
+
|`ssh-key-name`|SSH key name|
|
|
53
|
+
|
|
54
|
+
## ➡️ `clever ssh-keys remove-all` <kbd>Since 3.13.0</kbd>
|
|
55
|
+
|
|
56
|
+
Remove all SSH keys from the current user
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
clever ssh-keys remove-all [options]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### ⚙️ Options
|
|
63
|
+
|
|
64
|
+
|Name|Description|
|
|
65
|
+
|---|---|
|
|
66
|
+
|`-y`, `--yes`|Skip confirmation and remove all SSH keys directly|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { openBrowser } from '../../models/utils.js';
|
|
3
|
+
|
|
4
|
+
export const sshKeysOpenCommand = defineCommand({
|
|
5
|
+
description: 'Open the SSH keys management page in the Console',
|
|
6
|
+
since: '3.13.0',
|
|
7
|
+
options: {},
|
|
8
|
+
args: [],
|
|
9
|
+
handler() {
|
|
10
|
+
return openBrowser('/users/me/ssh-keys', 'Opening the SSH keys management page of the Console in your browser');
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { todo_removeSshKey as removeSshKey } from '@clevercloud/client/esm/api/v2/user.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
4
|
+
import { defineOption } from '../../lib/define-option.js';
|
|
5
|
+
import { confirm } from '../../lib/prompts.js';
|
|
6
|
+
import { Logger } from '../../logger.js';
|
|
7
|
+
import { sendToApi } from '../../models/send-to-api.js';
|
|
8
|
+
import { getUserSshKeys } from '../../models/ssh-keys.js';
|
|
9
|
+
|
|
10
|
+
export const sshKeysRemoveAllCommand = defineCommand({
|
|
11
|
+
description: 'Remove all SSH keys from the current user',
|
|
12
|
+
since: '3.13.0',
|
|
13
|
+
options: {
|
|
14
|
+
yes: defineOption({
|
|
15
|
+
name: 'yes',
|
|
16
|
+
schema: z.boolean().default(false),
|
|
17
|
+
description: 'Skip confirmation and remove all SSH keys directly',
|
|
18
|
+
aliases: ['y'],
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
args: [],
|
|
22
|
+
async handler(options) {
|
|
23
|
+
if (!options.yes) {
|
|
24
|
+
await confirm('Are you sure you want to remove all your SSH keys?', 'No SSH keys removed');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const keys = await getUserSshKeys();
|
|
28
|
+
|
|
29
|
+
if (keys.length === 0) {
|
|
30
|
+
Logger.println('No SSH keys to remove');
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const results = await Promise.all(
|
|
35
|
+
keys.map((key) => {
|
|
36
|
+
const keyNameEncoded = encodeURIComponent(key.name);
|
|
37
|
+
return removeSshKey({ key: keyNameEncoded })
|
|
38
|
+
.then(sendToApi)
|
|
39
|
+
.then(() => [true, key.name])
|
|
40
|
+
.catch(() => [false, key.name]);
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
if (results.every(([isRemoved]) => isRemoved)) {
|
|
45
|
+
Logger.printSuccess('All SSH keys were removed successfully');
|
|
46
|
+
} else {
|
|
47
|
+
const keyNamesWithErrors = results
|
|
48
|
+
.filter(([isRemoved]) => !isRemoved)
|
|
49
|
+
.map(([_, keyName]) => keyName)
|
|
50
|
+
.join(', ');
|
|
51
|
+
throw new Error(`Some errors occured while removing these SSH keys: ${keyNamesWithErrors}`);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { todo_removeSshKey as removeSshKey } from '@clevercloud/client/esm/api/v2/user.js';
|
|
2
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
3
|
+
import { styleText } from '../../lib/style-text.js';
|
|
4
|
+
import { Logger } from '../../logger.js';
|
|
5
|
+
import { sendToApi } from '../../models/send-to-api.js';
|
|
6
|
+
import { getUserSshKeys } from '../../models/ssh-keys.js';
|
|
7
|
+
import { sshKeyNameArg } from './ssh-keys.args.js';
|
|
8
|
+
|
|
9
|
+
export const sshKeysRemoveCommand = defineCommand({
|
|
10
|
+
description: 'Remove a SSH key from the current user',
|
|
11
|
+
since: '3.13.0',
|
|
12
|
+
options: {},
|
|
13
|
+
args: [sshKeyNameArg],
|
|
14
|
+
async handler(_options, keyName) {
|
|
15
|
+
const keys = await getUserSshKeys();
|
|
16
|
+
|
|
17
|
+
if (keys.find((key) => key.name === keyName) == null) {
|
|
18
|
+
throw new Error(`SSH key ${styleText('red', keyName)} not found`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const keyNameEncoded = encodeURIComponent(keyName);
|
|
22
|
+
await removeSshKey({ key: keyNameEncoded }).then(sendToApi);
|
|
23
|
+
|
|
24
|
+
Logger.printSuccess(`SSH key ${keyName} removed successfully`);
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { getAllInstances, get as getApplication } from '@clevercloud/client/esm/api/v2/application.js';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
4
|
+
import { styleText } from '../../lib/style-text.js';
|
|
5
|
+
import { Logger } from '../../logger.js';
|
|
6
|
+
import * as Application from '../../models/application.js';
|
|
7
|
+
import { sendToApi } from '../../models/send-to-api.js';
|
|
8
|
+
import { aliasOption, appIdOrNameOption, humanJsonOutputFormatOption } from '../global.options.js';
|
|
9
|
+
|
|
10
|
+
function displayInstances(instances, commit) {
|
|
11
|
+
return `(${instances.map((instance) => `${instance.count}*${instance.flavor}`)}, Commit: ${commit || 'N/A'})`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function computeStatus(instances, app) {
|
|
15
|
+
const upInstances = _.filter(instances, ({ state }) => state === 'UP');
|
|
16
|
+
const isUp = !_.isEmpty(upInstances);
|
|
17
|
+
const upCommit = _(upInstances).map('commit').head();
|
|
18
|
+
|
|
19
|
+
const deployingInstances = _.filter(instances, ({ state }) => state === 'DEPLOYING');
|
|
20
|
+
const isDeploying = !_.isEmpty(deployingInstances);
|
|
21
|
+
const deployingCommit = _(deployingInstances).map('commit').head();
|
|
22
|
+
|
|
23
|
+
const { minFlavor, maxFlavor, minInstances, maxInstances } = app.instance;
|
|
24
|
+
|
|
25
|
+
const scalabilityEnabled = minFlavor.name !== maxFlavor.name || minInstances !== maxInstances;
|
|
26
|
+
|
|
27
|
+
const status = {
|
|
28
|
+
id: app.id,
|
|
29
|
+
name: app.name,
|
|
30
|
+
type: {
|
|
31
|
+
name: app.instance.variant.name,
|
|
32
|
+
slug: app.instance.variant.slug,
|
|
33
|
+
},
|
|
34
|
+
lifetime: app.instance.lifetime,
|
|
35
|
+
status: isUp ? 'running' : 'stopped',
|
|
36
|
+
commit: upCommit,
|
|
37
|
+
instances: groupInstances(upInstances),
|
|
38
|
+
scalability: {
|
|
39
|
+
enabled: scalabilityEnabled,
|
|
40
|
+
vertical: { min: minFlavor.name, max: maxFlavor.name },
|
|
41
|
+
horizontal: { min: minInstances, max: maxInstances },
|
|
42
|
+
},
|
|
43
|
+
separateBuild: app.separateBuild,
|
|
44
|
+
buildFlavor: app.buildFlavor.name,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
if (isDeploying) {
|
|
48
|
+
status.deploymentInProgress = {
|
|
49
|
+
commit: deployingCommit,
|
|
50
|
+
instances: groupInstances(deployingInstances),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return status;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function formatScalability({ min, max }) {
|
|
58
|
+
return min === max ? min.toString() : `${min} to ${max}`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function groupInstances(instances) {
|
|
62
|
+
return _(instances)
|
|
63
|
+
.groupBy((i) => i.flavor.name)
|
|
64
|
+
.map((instances, flavorName) => ({
|
|
65
|
+
flavor: flavorName,
|
|
66
|
+
count: instances.length,
|
|
67
|
+
}))
|
|
68
|
+
.value();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const statusCommand = defineCommand({
|
|
72
|
+
description: 'See the status of an application',
|
|
73
|
+
since: '0.2.0',
|
|
74
|
+
options: {
|
|
75
|
+
alias: aliasOption,
|
|
76
|
+
app: appIdOrNameOption,
|
|
77
|
+
format: humanJsonOutputFormatOption,
|
|
78
|
+
},
|
|
79
|
+
args: [],
|
|
80
|
+
async handler(options) {
|
|
81
|
+
const { alias, app: appIdOrName, format } = options;
|
|
82
|
+
const { ownerId, appId } = await Application.resolveId(appIdOrName, alias);
|
|
83
|
+
|
|
84
|
+
const instances = await getAllInstances({ id: ownerId, appId }).then(sendToApi);
|
|
85
|
+
const app = await getApplication({ id: ownerId, appId }).then(sendToApi);
|
|
86
|
+
|
|
87
|
+
const status = computeStatus(instances, app);
|
|
88
|
+
|
|
89
|
+
switch (format) {
|
|
90
|
+
case 'json': {
|
|
91
|
+
Logger.printJson(status);
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
case 'human':
|
|
95
|
+
default: {
|
|
96
|
+
const statusMessage =
|
|
97
|
+
status.status === 'running'
|
|
98
|
+
? `${styleText(['bold', 'green'], 'running')} ${displayInstances(status.instances, status.commit)}`
|
|
99
|
+
: styleText(['bold', 'red'], 'stopped');
|
|
100
|
+
|
|
101
|
+
Logger.println(`${status.name}: ${statusMessage}`);
|
|
102
|
+
Logger.println(`Type: ${status.type.name}`);
|
|
103
|
+
Logger.println(`Executed as: ${styleText('bold', status.lifetime)}`);
|
|
104
|
+
if (status.deploymentInProgress) {
|
|
105
|
+
Logger.println(
|
|
106
|
+
`Deployment in progress ${displayInstances(status.deploymentInProgress.instances, status.deploymentInProgress.commit)}`,
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
Logger.println();
|
|
110
|
+
Logger.println('Scalability:');
|
|
111
|
+
Logger.println(
|
|
112
|
+
` Auto scalability: ${status.scalability.enabled ? styleText('green', 'enabled') : styleText('red', 'disabled')}`,
|
|
113
|
+
);
|
|
114
|
+
Logger.println(` Scalers: ${styleText('bold', formatScalability(status.scalability.horizontal))}`);
|
|
115
|
+
Logger.println(` Sizes: ${styleText('bold', formatScalability(status.scalability.vertical))}`);
|
|
116
|
+
Logger.println(
|
|
117
|
+
` Dedicated build: ${status.separateBuild ? styleText('bold', status.buildFlavor) : styleText('red', 'disabled')}`,
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# 📖 `clever status` command reference
|
|
2
|
+
|
|
3
|
+
## ➡️ `clever status` <kbd>Since 0.2.0</kbd>
|
|
4
|
+
|
|
5
|
+
See the status of an application
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
clever status [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### ⚙️ Options
|
|
12
|
+
|
|
13
|
+
|Name|Description|
|
|
14
|
+
|---|---|
|
|
15
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
16
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
17
|
+
|`-F`, `--format` `<format>`|Output format (human, json) (default: human)|
|