@hideandseeklab/aoox 0.1.0-alpha.7 → 0.1.0-alpha.8
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 +127 -30
- package/dist/commands/deploy.js +12 -17
- package/dist/commands/domain/set.js +2 -0
- package/dist/commands/link.js +2 -0
- package/dist/commands/login.d.ts +2 -0
- package/dist/commands/login.js +56 -8
- package/dist/commands/registry/build.d.ts +22 -0
- package/dist/commands/registry/build.js +33 -0
- package/dist/commands/registry/domain.js +2 -0
- package/dist/commands/registry/push.d.ts +19 -0
- package/dist/commands/registry/push.js +37 -0
- package/dist/commands/update/panel.d.ts +18 -0
- package/dist/commands/update/panel.js +62 -0
- package/dist/commands/update.d.ts +4 -5
- package/dist/commands/update.js +54 -40
- package/dist/commands/whoami.js +2 -0
- package/dist/help.d.ts +9 -0
- package/dist/help.js +16 -0
- package/dist/lib/api.d.ts +1 -1
- package/dist/lib/api.js +2 -2
- package/dist/lib/config.d.ts +4 -0
- package/dist/lib/config.js +5 -1
- package/dist/lib/connection-summary.d.ts +23 -0
- package/dist/lib/connection-summary.js +70 -0
- package/dist/lib/discovery.d.ts +47 -0
- package/dist/lib/discovery.js +222 -0
- package/dist/lib/flags.d.ts +7 -0
- package/dist/lib/flags.js +18 -3
- package/dist/lib/image-ref.d.ts +16 -0
- package/dist/lib/image-ref.js +66 -0
- package/dist/lib/outdated.d.ts +9 -0
- package/dist/lib/outdated.js +23 -0
- package/dist/lib/registry-check.d.ts +35 -0
- package/dist/lib/registry-check.js +102 -0
- package/dist/lib/registry-image-command.d.ts +36 -0
- package/dist/lib/registry-image-command.js +127 -0
- package/dist/lib/registry-select.d.ts +21 -0
- package/dist/lib/registry-select.js +48 -0
- package/dist/lib/self-update.d.ts +30 -0
- package/dist/lib/self-update.js +94 -0
- package/dist/lib/types.d.ts +2 -0
- package/dist/lib/version.d.ts +7 -0
- package/dist/lib/version.js +57 -0
- package/oclif.manifest.json +220 -23
- package/package.json +10 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ $ npm install -g @hideandseeklab/aoox
|
|
|
27
27
|
$ aoox COMMAND
|
|
28
28
|
running command...
|
|
29
29
|
$ aoox (--version)
|
|
30
|
-
@hideandseeklab/aoox/0.1.0-alpha.
|
|
30
|
+
@hideandseeklab/aoox/0.1.0-alpha.8 linux-x64 node-v24.21.0
|
|
31
31
|
$ aoox --help [COMMAND]
|
|
32
32
|
USAGE
|
|
33
33
|
$ aoox COMMAND
|
|
@@ -57,14 +57,12 @@ for every environment variable it accepts (pinning a version, a custom install d
|
|
|
57
57
|
|
|
58
58
|
## npm (Windows, Alpine, or if you already have Node.js)
|
|
59
59
|
|
|
60
|
-
`aoox` is still in **alpha** — published to npm under the `alpha` dist-tag, not `latest`
|
|
61
|
-
(the package has never had a stable release, so `npm install -g @hideandseeklab/aoox` without a
|
|
62
|
-
tag will fail to find a version). Install explicitly with this tag:
|
|
63
|
-
|
|
64
60
|
```sh-session
|
|
65
|
-
npm install -g @hideandseeklab/aoox
|
|
61
|
+
npm install -g @hideandseeklab/aoox
|
|
66
62
|
```
|
|
67
63
|
|
|
64
|
+
While the project is in alpha every release is published under both the `latest` and `alpha` tags, so no tag is needed. To update later, run `aoox update` (`aoox update panel` updates the panel).
|
|
65
|
+
|
|
68
66
|
`aoox` is then available globally. This also applies to `aoox install` on a new VPS —
|
|
69
67
|
Node ≥22 must already be installed on that VPS **before** the step above (`aoox install`
|
|
70
68
|
itself needs Node to run, so it cannot install Node for you first) — or use the install script
|
|
@@ -101,9 +99,12 @@ npm link # or: npm install -g .
|
|
|
101
99
|
* [`aoox plugins uninstall [PLUGIN]`](#aoox-plugins-uninstall-plugin)
|
|
102
100
|
* [`aoox plugins unlink [PLUGIN]`](#aoox-plugins-unlink-plugin)
|
|
103
101
|
* [`aoox plugins update`](#aoox-plugins-update)
|
|
102
|
+
* [`aoox registry build IMAGE`](#aoox-registry-build-image)
|
|
104
103
|
* [`aoox registry domain`](#aoox-registry-domain)
|
|
104
|
+
* [`aoox registry push IMAGE`](#aoox-registry-push-image)
|
|
105
105
|
* [`aoox reinstall`](#aoox-reinstall)
|
|
106
106
|
* [`aoox update`](#aoox-update)
|
|
107
|
+
* [`aoox update panel`](#aoox-update-panel)
|
|
107
108
|
* [`aoox whoami`](#aoox-whoami)
|
|
108
109
|
|
|
109
110
|
## `aoox deploy`
|
|
@@ -118,7 +119,8 @@ USAGE
|
|
|
118
119
|
FLAGS
|
|
119
120
|
-f, --dockerfile=<value> [default: Dockerfile] Path to the Dockerfile
|
|
120
121
|
-t, --token=<value> [env: AOOX_TOKEN] API token (aoox_…); defaults to the value from `aoox login`
|
|
121
|
-
-u, --url=<value> [env: AOOX_URL]
|
|
122
|
+
-u, --url=<value> [env: AOOX_URL] Dashboard URL (the address you open the dashboard with, e.g.
|
|
123
|
+
https://dashboard.example.com); defaults to the value from `aoox login`
|
|
122
124
|
--context=<value> [default: .] Docker build context
|
|
123
125
|
--registry=<value> Registry ID to push to; defaults to the self-hosted registry
|
|
124
126
|
--tag=<value> Image tag; defaults to the git short SHA (+ -dirty)
|
|
@@ -132,7 +134,7 @@ EXAMPLES
|
|
|
132
134
|
$ aoox deploy --tag v1.2.3
|
|
133
135
|
```
|
|
134
136
|
|
|
135
|
-
_See code: [src/commands/deploy.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.
|
|
137
|
+
_See code: [src/commands/deploy.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.8/src/commands/deploy.ts)_
|
|
136
138
|
|
|
137
139
|
## `aoox domain set`
|
|
138
140
|
|
|
@@ -144,7 +146,8 @@ USAGE
|
|
|
144
146
|
|
|
145
147
|
FLAGS
|
|
146
148
|
-t, --token=<value> [env: AOOX_TOKEN] API token (aoox_…); defaults to the value from `aoox login`
|
|
147
|
-
-u, --url=<value> [env: AOOX_URL]
|
|
149
|
+
-u, --url=<value> [env: AOOX_URL] Dashboard URL (the address you open the dashboard with, e.g.
|
|
150
|
+
https://dashboard.example.com); defaults to the value from `aoox login`
|
|
148
151
|
--acme-email=<value> Email for the Let's Encrypt certificate
|
|
149
152
|
--api=<value> (required) Domain for the panel API
|
|
150
153
|
--web=<value> (required) Domain for the panel dashboard
|
|
@@ -158,7 +161,7 @@ EXAMPLES
|
|
|
158
161
|
$ aoox domain set --web panel.example.com --api api.example.com --acme-email you@example.com
|
|
159
162
|
```
|
|
160
163
|
|
|
161
|
-
_See code: [src/commands/domain/set.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.
|
|
164
|
+
_See code: [src/commands/domain/set.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.8/src/commands/domain/set.ts)_
|
|
162
165
|
|
|
163
166
|
## `aoox help [COMMAND]`
|
|
164
167
|
|
|
@@ -214,7 +217,7 @@ EXAMPLES
|
|
|
214
217
|
sudo aoox install --web-domain panel.example.com --api-domain api.panel.example.com --acme-email me@example.com
|
|
215
218
|
```
|
|
216
219
|
|
|
217
|
-
_See code: [src/commands/install.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.
|
|
220
|
+
_See code: [src/commands/install.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.8/src/commands/install.ts)_
|
|
218
221
|
|
|
219
222
|
## `aoox link`
|
|
220
223
|
|
|
@@ -226,7 +229,8 @@ USAGE
|
|
|
226
229
|
|
|
227
230
|
FLAGS
|
|
228
231
|
-t, --token=<value> [env: AOOX_TOKEN] API token (aoox_…); defaults to the value from `aoox login`
|
|
229
|
-
-u, --url=<value> [env: AOOX_URL]
|
|
232
|
+
-u, --url=<value> [env: AOOX_URL] Dashboard URL (the address you open the dashboard with, e.g.
|
|
233
|
+
https://dashboard.example.com); defaults to the value from `aoox login`
|
|
230
234
|
--app=<value> Application ID; skip the interactive selection
|
|
231
235
|
--project=<value> Project ID; skip the interactive selection
|
|
232
236
|
|
|
@@ -239,11 +243,11 @@ EXAMPLES
|
|
|
239
243
|
$ aoox link --project <id> --app <id>
|
|
240
244
|
```
|
|
241
245
|
|
|
242
|
-
_See code: [src/commands/link.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.
|
|
246
|
+
_See code: [src/commands/link.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.8/src/commands/link.ts)_
|
|
243
247
|
|
|
244
248
|
## `aoox login`
|
|
245
249
|
|
|
246
|
-
Save the
|
|
250
|
+
Save the dashboard address and API token for other commands (the API address is discovered automatically)
|
|
247
251
|
|
|
248
252
|
```
|
|
249
253
|
USAGE
|
|
@@ -251,18 +255,21 @@ USAGE
|
|
|
251
255
|
|
|
252
256
|
FLAGS
|
|
253
257
|
-t, --token=<value> [env: AOOX_TOKEN] API token (aoox_…); defaults to the value from `aoox login`
|
|
254
|
-
-u, --url=<value> [env: AOOX_URL]
|
|
258
|
+
-u, --url=<value> [env: AOOX_URL] Dashboard URL (the address you open the dashboard with, e.g.
|
|
259
|
+
https://dashboard.example.com); defaults to the value from `aoox login`
|
|
255
260
|
|
|
256
261
|
DESCRIPTION
|
|
257
|
-
Save the
|
|
262
|
+
Save the dashboard address and API token for other commands (the API address is discovered automatically)
|
|
258
263
|
|
|
259
264
|
EXAMPLES
|
|
260
265
|
$ aoox login
|
|
261
266
|
|
|
262
|
-
$ aoox login --url https://
|
|
267
|
+
$ aoox login --url https://dashboard.example.com --token aoox_xxx
|
|
268
|
+
|
|
269
|
+
$ aoox login --url 203.0.113.10:3000 --token aoox_xxx
|
|
263
270
|
```
|
|
264
271
|
|
|
265
|
-
_See code: [src/commands/login.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.
|
|
272
|
+
_See code: [src/commands/login.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.8/src/commands/login.ts)_
|
|
266
273
|
|
|
267
274
|
## `aoox plugins`
|
|
268
275
|
|
|
@@ -554,6 +561,40 @@ DESCRIPTION
|
|
|
554
561
|
|
|
555
562
|
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.5.2/src/commands/plugins/update.ts)_
|
|
556
563
|
|
|
564
|
+
## `aoox registry build IMAGE`
|
|
565
|
+
|
|
566
|
+
Build an image from a Dockerfile, named for the aoox registry (refuses a version that already exists there)
|
|
567
|
+
|
|
568
|
+
```
|
|
569
|
+
USAGE
|
|
570
|
+
$ aoox registry build IMAGE [-t <value>] [-u <value>] [--force] [--registry <value>] [--context <value>] [-f
|
|
571
|
+
<value>]
|
|
572
|
+
|
|
573
|
+
ARGUMENTS
|
|
574
|
+
IMAGE Image name and version, e.g. myapp:1.0.0
|
|
575
|
+
|
|
576
|
+
FLAGS
|
|
577
|
+
-f, --dockerfile=<value> [default: Dockerfile] Path to the Dockerfile
|
|
578
|
+
-t, --token=<value> [env: AOOX_TOKEN] API token (aoox_…); defaults to the value from `aoox login`
|
|
579
|
+
-u, --url=<value> [env: AOOX_URL] Dashboard URL (the address you open the dashboard with, e.g.
|
|
580
|
+
https://dashboard.example.com); defaults to the value from `aoox login`
|
|
581
|
+
--context=<value> [default: .] Docker build context
|
|
582
|
+
--force Overwrite a version that already exists in the registry
|
|
583
|
+
--registry=<value> Registry ID; defaults to the self-hosted registry
|
|
584
|
+
|
|
585
|
+
DESCRIPTION
|
|
586
|
+
Build an image from a Dockerfile, named for the aoox registry (refuses a version that already exists there)
|
|
587
|
+
|
|
588
|
+
EXAMPLES
|
|
589
|
+
$ aoox registry build myapp:1.0.0
|
|
590
|
+
|
|
591
|
+
$ aoox registry build team/api:2.1.0 -f docker/Dockerfile --context .
|
|
592
|
+
|
|
593
|
+
$ aoox registry build myapp:1.0.0 --force
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
_See code: [src/commands/registry/build.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.8/src/commands/registry/build.ts)_
|
|
597
|
+
|
|
557
598
|
## `aoox registry domain`
|
|
558
599
|
|
|
559
600
|
Set or remove the custom domain for the self-hosted registry
|
|
@@ -564,7 +605,8 @@ USAGE
|
|
|
564
605
|
|
|
565
606
|
FLAGS
|
|
566
607
|
-t, --token=<value> [env: AOOX_TOKEN] API token (aoox_…); defaults to the value from `aoox login`
|
|
567
|
-
-u, --url=<value> [env: AOOX_URL]
|
|
608
|
+
-u, --url=<value> [env: AOOX_URL] Dashboard URL (the address you open the dashboard with, e.g.
|
|
609
|
+
https://dashboard.example.com); defaults to the value from `aoox login`
|
|
568
610
|
--clear Remove the domain, falling back to host:port
|
|
569
611
|
--set=<value> Domain for the self-hosted registry
|
|
570
612
|
|
|
@@ -577,7 +619,38 @@ EXAMPLES
|
|
|
577
619
|
$ aoox registry domain --clear
|
|
578
620
|
```
|
|
579
621
|
|
|
580
|
-
_See code: [src/commands/registry/domain.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.
|
|
622
|
+
_See code: [src/commands/registry/domain.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.8/src/commands/registry/domain.ts)_
|
|
623
|
+
|
|
624
|
+
## `aoox registry push IMAGE`
|
|
625
|
+
|
|
626
|
+
Push a local image to the aoox registry (refuses a version that already exists there)
|
|
627
|
+
|
|
628
|
+
```
|
|
629
|
+
USAGE
|
|
630
|
+
$ aoox registry push IMAGE [-t <value>] [-u <value>] [--force] [--registry <value>]
|
|
631
|
+
|
|
632
|
+
ARGUMENTS
|
|
633
|
+
IMAGE Image name and version (short or full), e.g. myapp:1.0.0
|
|
634
|
+
|
|
635
|
+
FLAGS
|
|
636
|
+
-t, --token=<value> [env: AOOX_TOKEN] API token (aoox_…); defaults to the value from `aoox login`
|
|
637
|
+
-u, --url=<value> [env: AOOX_URL] Dashboard URL (the address you open the dashboard with, e.g.
|
|
638
|
+
https://dashboard.example.com); defaults to the value from `aoox login`
|
|
639
|
+
--force Overwrite a version that already exists in the registry
|
|
640
|
+
--registry=<value> Registry ID; defaults to the self-hosted registry
|
|
641
|
+
|
|
642
|
+
DESCRIPTION
|
|
643
|
+
Push a local image to the aoox registry (refuses a version that already exists there)
|
|
644
|
+
|
|
645
|
+
EXAMPLES
|
|
646
|
+
$ aoox registry push myapp:1.0.0
|
|
647
|
+
|
|
648
|
+
$ aoox registry push registry.example.com/myapp:1.0.0
|
|
649
|
+
|
|
650
|
+
$ aoox registry push myapp:1.0.0 --force
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
_See code: [src/commands/registry/push.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.8/src/commands/registry/push.ts)_
|
|
581
654
|
|
|
582
655
|
## `aoox reinstall`
|
|
583
656
|
|
|
@@ -607,31 +680,54 @@ EXAMPLES
|
|
|
607
680
|
sudo aoox reinstall --yes --terminal-ssh-user root
|
|
608
681
|
```
|
|
609
682
|
|
|
610
|
-
_See code: [src/commands/reinstall.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.
|
|
683
|
+
_See code: [src/commands/reinstall.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.8/src/commands/reinstall.ts)_
|
|
611
684
|
|
|
612
685
|
## `aoox update`
|
|
613
686
|
|
|
614
|
-
|
|
687
|
+
Update the aoox CLI itself (use `aoox update panel` to update the panel)
|
|
688
|
+
|
|
689
|
+
```
|
|
690
|
+
USAGE
|
|
691
|
+
$ aoox update [--check]
|
|
692
|
+
|
|
693
|
+
FLAGS
|
|
694
|
+
--check Only report whether a newer version exists; change nothing
|
|
695
|
+
|
|
696
|
+
DESCRIPTION
|
|
697
|
+
Update the aoox CLI itself (use `aoox update panel` to update the panel)
|
|
698
|
+
|
|
699
|
+
EXAMPLES
|
|
700
|
+
$ aoox update
|
|
701
|
+
|
|
702
|
+
$ aoox update --check
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
_See code: [src/commands/update.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.8/src/commands/update.ts)_
|
|
706
|
+
|
|
707
|
+
## `aoox update panel`
|
|
708
|
+
|
|
709
|
+
Check for or apply updates to the aoox panel itself (the aoox-api and aoox-web images)
|
|
615
710
|
|
|
616
711
|
```
|
|
617
712
|
USAGE
|
|
618
|
-
$ aoox update [-t <value>] [-u <value>] [--apply]
|
|
713
|
+
$ aoox update panel [-t <value>] [-u <value>] [--apply]
|
|
619
714
|
|
|
620
715
|
FLAGS
|
|
621
716
|
-t, --token=<value> [env: AOOX_TOKEN] API token (aoox_…); defaults to the value from `aoox login`
|
|
622
|
-
-u, --url=<value> [env: AOOX_URL]
|
|
717
|
+
-u, --url=<value> [env: AOOX_URL] Dashboard URL (the address you open the dashboard with, e.g.
|
|
718
|
+
https://dashboard.example.com); defaults to the value from `aoox login`
|
|
623
719
|
--apply Apply the update if one is available (pull + restart)
|
|
624
720
|
|
|
625
721
|
DESCRIPTION
|
|
626
|
-
Check for or apply updates to the aoox panel itself
|
|
722
|
+
Check for or apply updates to the aoox panel itself (the aoox-api and aoox-web images)
|
|
627
723
|
|
|
628
724
|
EXAMPLES
|
|
629
|
-
$ aoox update
|
|
725
|
+
$ aoox update panel
|
|
630
726
|
|
|
631
|
-
$ aoox update --apply
|
|
727
|
+
$ aoox update panel --apply
|
|
632
728
|
```
|
|
633
729
|
|
|
634
|
-
_See code: [src/commands/update.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.
|
|
730
|
+
_See code: [src/commands/update/panel.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.8/src/commands/update/panel.ts)_
|
|
635
731
|
|
|
636
732
|
## `aoox whoami`
|
|
637
733
|
|
|
@@ -643,7 +739,8 @@ USAGE
|
|
|
643
739
|
|
|
644
740
|
FLAGS
|
|
645
741
|
-t, --token=<value> [env: AOOX_TOKEN] API token (aoox_…); defaults to the value from `aoox login`
|
|
646
|
-
-u, --url=<value> [env: AOOX_URL]
|
|
742
|
+
-u, --url=<value> [env: AOOX_URL] Dashboard URL (the address you open the dashboard with, e.g.
|
|
743
|
+
https://dashboard.example.com); defaults to the value from `aoox login`
|
|
647
744
|
|
|
648
745
|
GLOBAL FLAGS
|
|
649
746
|
--json Format output as json.
|
|
@@ -657,7 +754,7 @@ EXAMPLES
|
|
|
657
754
|
$ aoox whoami --json
|
|
658
755
|
```
|
|
659
756
|
|
|
660
|
-
_See code: [src/commands/whoami.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.
|
|
757
|
+
_See code: [src/commands/whoami.ts](https://github.com/hideandseeklab/aoox-cli/blob/v0.1.0-alpha.8/src/commands/whoami.ts)_
|
|
661
758
|
<!-- commandsstop -->
|
|
662
759
|
|
|
663
760
|
## Versioning
|
package/dist/commands/deploy.js
CHANGED
|
@@ -7,6 +7,8 @@ import { connectionFlags, loadCredentials } from '../lib/flags.js';
|
|
|
7
7
|
import { deployTag } from '../lib/git.js';
|
|
8
8
|
import { imageRefFor } from '../lib/image-ref.js';
|
|
9
9
|
import { readLink } from '../lib/link.js';
|
|
10
|
+
import { warnIfOutdated } from '../lib/outdated.js';
|
|
11
|
+
import { chooseRegistry, localhostRegistryHint } from '../lib/registry-select.js';
|
|
10
12
|
/** How often to poll GET /deployments/:id while a deploy is in progress. */
|
|
11
13
|
const POLL_MS = 1500;
|
|
12
14
|
export default class Deploy extends Command {
|
|
@@ -36,9 +38,13 @@ export default class Deploy extends Command {
|
|
|
36
38
|
}
|
|
37
39
|
throw error;
|
|
38
40
|
}
|
|
41
|
+
await warnIfOutdated((m) => this.warn(m), this.config.version, config);
|
|
39
42
|
const app = await this.getApplication(config, link.applicationId);
|
|
40
43
|
const registry = await this.pickRegistry(config, flags.registry);
|
|
41
44
|
const credentials = await api(config, `/registries/${registry.id}/credentials`);
|
|
45
|
+
const localHint = localhostRegistryHint(registry.url, config.url);
|
|
46
|
+
if (localHint)
|
|
47
|
+
this.warn(localHint);
|
|
42
48
|
const tag = flags.tag ?? deployTag(cwd);
|
|
43
49
|
const imageRef = imageRefFor({ appName: app.appName, projectName: app.project.name, registryUrl: registry.url, tag });
|
|
44
50
|
this.log(`==> Build ${imageRef}`);
|
|
@@ -97,29 +103,18 @@ export default class Deploy extends Command {
|
|
|
97
103
|
}
|
|
98
104
|
async pickRegistry(config, registryId) {
|
|
99
105
|
const registries = await api(config, '/registries');
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
if (registries.length === 0) {
|
|
107
|
-
this.error('No registry in the panel yet.', {
|
|
108
|
-
suggestions: ['Provision a local registry under Infrastructure, or add an external registry.'],
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
const selfHosted = registries.find((r) => r.type === 'self-hosted');
|
|
112
|
-
if (selfHosted)
|
|
113
|
-
return selfHosted;
|
|
114
|
-
if (registries.length === 1)
|
|
115
|
-
return registries[0];
|
|
106
|
+
const choice = chooseRegistry(registries, registryId);
|
|
107
|
+
if (choice.kind === 'found')
|
|
108
|
+
return choice.registry;
|
|
109
|
+
if (choice.kind === 'error')
|
|
110
|
+
this.error(choice.message, { suggestions: choice.suggestions });
|
|
116
111
|
if (!process.stdin.isTTY) {
|
|
117
112
|
this.error('There are several registries and none is self-hosted; cannot pick one automatically.', {
|
|
118
113
|
suggestions: ['Pass --registry <id>.'],
|
|
119
114
|
});
|
|
120
115
|
}
|
|
121
116
|
return select({
|
|
122
|
-
choices: registries.map((r) => ({ name: `${r.name} (${r.url})`, value: r })),
|
|
117
|
+
choices: choice.registries.map((r) => ({ name: `${r.name} (${r.url})`, value: r })),
|
|
123
118
|
message: 'Select a registry',
|
|
124
119
|
});
|
|
125
120
|
}
|
|
@@ -2,6 +2,7 @@ import { Command, Flags } from '@oclif/core';
|
|
|
2
2
|
import { api, ApiError } from '../../lib/api.js';
|
|
3
3
|
import { MissingCredentialsError } from '../../lib/config.js';
|
|
4
4
|
import { connectionFlags, loadCredentials } from '../../lib/flags.js';
|
|
5
|
+
import { warnIfOutdated } from '../../lib/outdated.js';
|
|
5
6
|
/**
|
|
6
7
|
* Post-install alternative to hand-editing docker-compose.domain.yml/.env.dist
|
|
7
8
|
* over SSH (see the aoox-api AGENTS.md "Domains for the panel itself"):
|
|
@@ -32,6 +33,7 @@ export default class DomainSet extends Command {
|
|
|
32
33
|
}
|
|
33
34
|
throw error;
|
|
34
35
|
}
|
|
36
|
+
await warnIfOutdated((m) => this.warn(m), this.config.version, config);
|
|
35
37
|
let result;
|
|
36
38
|
try {
|
|
37
39
|
result = await api(config, '/instance/domain', {
|
package/dist/commands/link.js
CHANGED
|
@@ -4,6 +4,7 @@ import { api, ApiError } from '../lib/api.js';
|
|
|
4
4
|
import { MissingCredentialsError } from '../lib/config.js';
|
|
5
5
|
import { connectionFlags, loadCredentials } from '../lib/flags.js';
|
|
6
6
|
import { writeLink } from '../lib/link.js';
|
|
7
|
+
import { warnIfOutdated } from '../lib/outdated.js';
|
|
7
8
|
export default class Link extends Command {
|
|
8
9
|
static description = 'Link this folder to an application in the panel (used by `aoox deploy`/`aoox logs`)';
|
|
9
10
|
static examples = [
|
|
@@ -38,6 +39,7 @@ export default class Link extends Command {
|
|
|
38
39
|
});
|
|
39
40
|
this.log(`Linked: ${project.name} / ${application.name} (${application.appName})`);
|
|
40
41
|
this.log(`Written to ${path} — safe to commit, contains no secrets.`);
|
|
42
|
+
await warnIfOutdated((m) => this.warn(m), this.config.version, config);
|
|
41
43
|
}
|
|
42
44
|
async pickApplication(config, project, appId) {
|
|
43
45
|
const apps = await api(config, `/applications?projectId=${project.id}`);
|
package/dist/commands/login.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export default class Login extends Command {
|
|
|
7
7
|
url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
};
|
|
9
9
|
run(): Promise<void>;
|
|
10
|
+
private discoverOrFail;
|
|
11
|
+
private promptForDashboard;
|
|
10
12
|
/** Never store a credential that does not work — check it first. */
|
|
11
13
|
private verify;
|
|
12
14
|
}
|
package/dist/commands/login.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { input, password } from '@inquirer/prompts';
|
|
2
2
|
import { Command, ux } from '@oclif/core';
|
|
3
3
|
import { api, ApiError } from '../lib/api.js';
|
|
4
|
-
import {
|
|
4
|
+
import { readConfig, writeConfig } from '../lib/config.js';
|
|
5
|
+
import { discover, DiscoveryError } from '../lib/discovery.js';
|
|
5
6
|
import { connectionFlags } from '../lib/flags.js';
|
|
6
|
-
|
|
7
|
+
import { warnIfOutdated } from '../lib/outdated.js';
|
|
8
|
+
const DEFAULT_URL = 'http://localhost:3000';
|
|
7
9
|
export default class Login extends Command {
|
|
8
|
-
static description = 'Save the
|
|
10
|
+
static description = 'Save the dashboard address and API token for other commands (the API address is discovered automatically)';
|
|
9
11
|
static examples = [
|
|
10
12
|
'<%= config.bin %> <%= command.id %>',
|
|
11
|
-
'<%= config.bin %> <%= command.id %> --url https://
|
|
13
|
+
'<%= config.bin %> <%= command.id %> --url https://dashboard.example.com --token aoox_xxx',
|
|
14
|
+
'<%= config.bin %> <%= command.id %> --url 203.0.113.10:3000 --token aoox_xxx',
|
|
12
15
|
];
|
|
13
16
|
static flags = { ...connectionFlags };
|
|
14
17
|
async run() {
|
|
@@ -20,14 +23,57 @@ export default class Login extends Command {
|
|
|
20
23
|
suggestions: ['Pass --url and --token, or set AOOX_URL and AOOX_TOKEN.'],
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
|
-
const
|
|
26
|
+
const found = flags.url ? await this.discoverOrFail(flags.url) : await this.promptForDashboard(existing?.webUrl);
|
|
27
|
+
for (const note of found.notes)
|
|
28
|
+
this.log(note);
|
|
24
29
|
// Prompted rather than taken as an argument by default: a token on the
|
|
25
30
|
// command line ends up in shell history and in the process list.
|
|
26
31
|
const token = (flags.token ?? (await password({ mask: '*', message: 'API token (aoox_…)' }))).trim();
|
|
27
|
-
const user = await this.verify({ token, url });
|
|
28
|
-
const path = await writeConfig(this.config.configDir, {
|
|
29
|
-
|
|
32
|
+
const user = await this.verify({ token, url: found.apiUrl });
|
|
33
|
+
const path = await writeConfig(this.config.configDir, {
|
|
34
|
+
token,
|
|
35
|
+
url: found.apiUrl,
|
|
36
|
+
...(found.webUrl ? { webUrl: found.webUrl } : {}),
|
|
37
|
+
});
|
|
38
|
+
this.log(`Logged in as ${user.email} (${user.role}) at ${found.webUrl ?? found.apiUrl}`);
|
|
30
39
|
this.log(`Token saved to ${path}`);
|
|
40
|
+
await warnIfOutdated((m) => this.warn(m), this.config.version, { token, url: found.apiUrl }, user.version);
|
|
41
|
+
}
|
|
42
|
+
async discoverOrFail(raw) {
|
|
43
|
+
ux.action.start('Looking for the panel');
|
|
44
|
+
try {
|
|
45
|
+
const found = await discover(raw);
|
|
46
|
+
ux.action.stop('ok');
|
|
47
|
+
return found;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
ux.action.stop('failed');
|
|
51
|
+
if (error instanceof DiscoveryError)
|
|
52
|
+
this.error(error.message);
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async promptForDashboard(previous) {
|
|
57
|
+
this.log('Use the address you open the dashboard with: your panel domain (e.g. https://dashboard.example.com),');
|
|
58
|
+
this.log('or http://<server-IP>:3000 if no panel domain is set yet.');
|
|
59
|
+
// A wrong address is the commonest mistake; explain it and ask again instead of exiting.
|
|
60
|
+
for (;;) {
|
|
61
|
+
// eslint-disable-next-line no-await-in-loop
|
|
62
|
+
const raw = await input({ default: previous ?? DEFAULT_URL, message: 'Dashboard URL' });
|
|
63
|
+
try {
|
|
64
|
+
ux.action.start('Looking for the panel');
|
|
65
|
+
// eslint-disable-next-line no-await-in-loop
|
|
66
|
+
const found = await discover(raw);
|
|
67
|
+
ux.action.stop('ok');
|
|
68
|
+
return found;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
ux.action.stop('failed');
|
|
72
|
+
if (!(error instanceof DiscoveryError))
|
|
73
|
+
throw error;
|
|
74
|
+
this.log(error.message);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
31
77
|
}
|
|
32
78
|
/** Never store a credential that does not work — check it first. */
|
|
33
79
|
async verify(config) {
|
|
@@ -47,6 +93,8 @@ export default class Login extends Command {
|
|
|
47
93
|
],
|
|
48
94
|
});
|
|
49
95
|
}
|
|
96
|
+
if (error instanceof ApiError && error.status === 0)
|
|
97
|
+
this.error(error.message);
|
|
50
98
|
throw error;
|
|
51
99
|
}
|
|
52
100
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RegistryImageCommand } from '../../lib/registry-image-command.js';
|
|
2
|
+
/**
|
|
3
|
+
* Builds ./Dockerfile into a local image named `<registry host>/<name>:<version>`
|
|
4
|
+
* after checking that the version is not already in the registry. Pushing is
|
|
5
|
+
* the separate `aoox registry push`; neither deploys anything.
|
|
6
|
+
*/
|
|
7
|
+
export default class RegistryBuild extends RegistryImageCommand {
|
|
8
|
+
static args: {
|
|
9
|
+
image: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
static description: string;
|
|
12
|
+
static examples: string[];
|
|
13
|
+
static flags: {
|
|
14
|
+
context: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
dockerfile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
registry: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
};
|
|
21
|
+
run(): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { dockerInherit } from '../../lib/docker.js';
|
|
3
|
+
import { RegistryImageCommand, registryImageFlags } from '../../lib/registry-image-command.js';
|
|
4
|
+
/**
|
|
5
|
+
* Builds ./Dockerfile into a local image named `<registry host>/<name>:<version>`
|
|
6
|
+
* after checking that the version is not already in the registry. Pushing is
|
|
7
|
+
* the separate `aoox registry push`; neither deploys anything.
|
|
8
|
+
*/
|
|
9
|
+
export default class RegistryBuild extends RegistryImageCommand {
|
|
10
|
+
static args = {
|
|
11
|
+
image: Args.string({ description: 'Image name and version, e.g. myapp:1.0.0', required: true }),
|
|
12
|
+
};
|
|
13
|
+
static description = 'Build an image from a Dockerfile, named for the aoox registry (refuses a version that already exists there)';
|
|
14
|
+
static examples = [
|
|
15
|
+
'<%= config.bin %> <%= command.id %> myapp:1.0.0',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> team/api:2.1.0 -f docker/Dockerfile --context .',
|
|
17
|
+
'<%= config.bin %> <%= command.id %> myapp:1.0.0 --force',
|
|
18
|
+
];
|
|
19
|
+
static flags = {
|
|
20
|
+
...registryImageFlags,
|
|
21
|
+
context: Flags.string({ default: '.', description: 'Docker build context' }),
|
|
22
|
+
dockerfile: Flags.string({ char: 'f', default: 'Dockerfile', description: 'Path to the Dockerfile' }),
|
|
23
|
+
};
|
|
24
|
+
async run() {
|
|
25
|
+
const { args, flags } = await this.parse(RegistryBuild);
|
|
26
|
+
const image = await this.resolveImage(args.image, flags, 'aoox registry build myapp:1.0.0');
|
|
27
|
+
await this.refuseExisting(image, { force: flags.force, verb: 'overwrite' });
|
|
28
|
+
this.log(`==> Build ${image.fullRef}`);
|
|
29
|
+
await dockerInherit(['build', '-t', image.fullRef, '-f', flags.dockerfile, flags.context], process.cwd());
|
|
30
|
+
this.log(`Built ${image.fullRef}`);
|
|
31
|
+
this.log(`Next: aoox registry push ${image.shortRef}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -2,6 +2,7 @@ import { Command, Flags } from '@oclif/core';
|
|
|
2
2
|
import { api, ApiError } from '../../lib/api.js';
|
|
3
3
|
import { MissingCredentialsError } from '../../lib/config.js';
|
|
4
4
|
import { connectionFlags, loadCredentials } from '../../lib/flags.js';
|
|
5
|
+
import { warnIfOutdated } from '../../lib/outdated.js';
|
|
5
6
|
/**
|
|
6
7
|
* Puts the self-hosted registry behind the built-in proxy on its own domain
|
|
7
8
|
* (`PATCH /registries/:id/domain`) — the CLI equivalent of Settings ->
|
|
@@ -34,6 +35,7 @@ export default class RegistryDomain extends Command {
|
|
|
34
35
|
}
|
|
35
36
|
throw error;
|
|
36
37
|
}
|
|
38
|
+
await warnIfOutdated((m) => this.warn(m), this.config.version, config);
|
|
37
39
|
const registries = await api(config, '/registries');
|
|
38
40
|
const registry = registries.find((r) => r.type === 'self-hosted');
|
|
39
41
|
if (!registry) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RegistryImageCommand } from '../../lib/registry-image-command.js';
|
|
2
|
+
/**
|
|
3
|
+
* Pushes an image that `aoox registry build` (or any `docker build`) already
|
|
4
|
+
* made locally. Never builds and never deploys.
|
|
5
|
+
*/
|
|
6
|
+
export default class RegistryPush extends RegistryImageCommand {
|
|
7
|
+
static args: {
|
|
8
|
+
image: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
9
|
+
};
|
|
10
|
+
static description: string;
|
|
11
|
+
static examples: string[];
|
|
12
|
+
static flags: {
|
|
13
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
registry: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
};
|
|
18
|
+
run(): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { dockerCapture, dockerInherit, dockerLogin } from '../../lib/docker.js';
|
|
3
|
+
import { RegistryImageCommand, registryImageFlags } from '../../lib/registry-image-command.js';
|
|
4
|
+
/**
|
|
5
|
+
* Pushes an image that `aoox registry build` (or any `docker build`) already
|
|
6
|
+
* made locally. Never builds and never deploys.
|
|
7
|
+
*/
|
|
8
|
+
export default class RegistryPush extends RegistryImageCommand {
|
|
9
|
+
static args = {
|
|
10
|
+
image: Args.string({ description: 'Image name and version (short or full), e.g. myapp:1.0.0', required: true }),
|
|
11
|
+
};
|
|
12
|
+
static description = 'Push a local image to the aoox registry (refuses a version that already exists there)';
|
|
13
|
+
static examples = [
|
|
14
|
+
'<%= config.bin %> <%= command.id %> myapp:1.0.0',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> registry.example.com/myapp:1.0.0',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> myapp:1.0.0 --force',
|
|
17
|
+
];
|
|
18
|
+
static flags = { ...registryImageFlags };
|
|
19
|
+
async run() {
|
|
20
|
+
const { args, flags } = await this.parse(RegistryPush);
|
|
21
|
+
const image = await this.resolveImage(args.image, flags, 'aoox registry push myapp:1.0.0');
|
|
22
|
+
const local = await dockerCapture(['image', 'inspect', '--format', '{{.Id}}', image.fullRef]);
|
|
23
|
+
if (!local) {
|
|
24
|
+
this.fail(`No local image ${image.shortRef}.`, `Build it first: aoox registry build ${image.shortRef}`);
|
|
25
|
+
}
|
|
26
|
+
await this.refuseExisting(image, { force: flags.force, verb: 'overwrite' });
|
|
27
|
+
const { password, username } = image.credentials;
|
|
28
|
+
if (username && password) {
|
|
29
|
+
this.log(`==> docker login ${image.host}`);
|
|
30
|
+
await dockerLogin(image.host, username, password, process.cwd());
|
|
31
|
+
}
|
|
32
|
+
this.log(`==> Push ${image.fullRef}`);
|
|
33
|
+
await dockerInherit(['push', image.fullRef], process.cwd());
|
|
34
|
+
this.log(`Pushed ${image.fullRef}`);
|
|
35
|
+
this.log('Use it in the dashboard: New application → Ready-made image');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
/**
|
|
3
|
+
* Checks the panel's own `aoox-api`/`aoox-web` images against the registry
|
|
4
|
+
* (`GET /instance/update`) and, with `--apply`, pulls + restarts
|
|
5
|
+
* (`POST /instance/update/apply`) — the CLI equivalent of Settings ->
|
|
6
|
+
* "Update aoox".
|
|
7
|
+
*/
|
|
8
|
+
export default class UpdatePanel extends Command {
|
|
9
|
+
static description: string;
|
|
10
|
+
static examples: string[];
|
|
11
|
+
static flags: {
|
|
12
|
+
apply: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
private printImage;
|
|
18
|
+
}
|