unoverse 0.1.95 → 0.1.97
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/operator/lib/common.sh +14 -1
- package/operator/lib/deploy.sh +24 -7
- package/operator/lib/help.sh +7 -2
- package/package.json +1 -1
package/operator/lib/common.sh
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Shared colors, helpers, and constants
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
# THE VERSION IS THE CLI'S, READ FROM IT. This was the literal "1.0.0", hardcoded when the
|
|
5
|
+
# operator was a script in a repo and never touched again — so `unoverse help` announced
|
|
6
|
+
# v1.0.0 while the published CLI was on 0.1.95, and the one number a developer uses to say
|
|
7
|
+
# which version they are running was wrong by two hundred releases.
|
|
8
|
+
#
|
|
9
|
+
# THE MONOREPO PATH IS TRIED FIRST, and the order matters. Two levels up from scripts/lib
|
|
10
|
+
# is the PLATFORM's package.json, which is genuinely 1.0.0 — so looking there first found a
|
|
11
|
+
# real version that was not this CLI's, and reported it confidently. packages/cli exists
|
|
12
|
+
# only in the monorepo; published, that path misses and the package's own is two levels up.
|
|
13
|
+
GRAVITY_VERSION=$(
|
|
14
|
+
node -p "require('$GRAVITY_LIB/../../packages/cli/package.json').version" 2>/dev/null \
|
|
15
|
+
|| node -p "require('$GRAVITY_LIB/../../package.json').version" 2>/dev/null \
|
|
16
|
+
|| echo "unknown"
|
|
17
|
+
)
|
|
5
18
|
DOCR_REGISTRY="registry.digitalocean.com"
|
|
6
19
|
|
|
7
20
|
# Colors
|
package/operator/lib/deploy.sh
CHANGED
|
@@ -541,13 +541,30 @@ cmd_deploy() {
|
|
|
541
541
|
# ── ONE FLOW ────────────────────────────────────────────────────────────────
|
|
542
542
|
# Which ground, is it configured, plan it, apply it, ship it. In that order, every
|
|
543
543
|
# time, whether this is the first deploy or the fiftieth.
|
|
544
|
-
# A
|
|
545
|
-
#
|
|
546
|
-
#
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
544
|
+
# NAMING A GROUND THAT DOES NOT EXIST YET MEANS BUILD IT THERE. `unoverse deploy aws` on a
|
|
545
|
+
# universe with only a DigitalOcean ground used to answer "No aws ground here. Run
|
|
546
|
+
# unoverse deploy aws to create one" — the command just typed, refusing itself. Those
|
|
547
|
+
# words already say where this should go, so the only thing left to do is set it up.
|
|
548
|
+
#
|
|
549
|
+
# A named ground with no tfvars falls through to the create flow below and skips the
|
|
550
|
+
# "which cloud?" question, because it has been answered. An UNNAMED deploy still goes
|
|
551
|
+
# through _pick_ground, which refuses to guess between two configured grounds.
|
|
552
|
+
local cloud="" rc
|
|
553
|
+
case "${GROUND_ARG:-}" in
|
|
554
|
+
do|digitalocean) cloud="digitalocean" ;;
|
|
555
|
+
aws|amazon) cloud="aws" ;;
|
|
556
|
+
esac
|
|
557
|
+
|
|
558
|
+
if [ -n "$cloud" ]; then
|
|
559
|
+
# Named. Configured already? Then use it; otherwise create it below.
|
|
560
|
+
[ -f "$ROOT/infra/$cloud/terraform.tfvars" ] || { cmd_ground "$([ "$cloud" = "aws" ] && echo aws || echo do)" || {
|
|
561
|
+
echo ""
|
|
562
|
+
info "Once that is sorted, run ${BOLD}unoverse deploy $cloud${NC} again. It picks up right here."
|
|
563
|
+
echo ""
|
|
564
|
+
exit 1
|
|
565
|
+
}; }
|
|
566
|
+
elif [ -f "$ROOT/infra/digitalocean/terraform.tfvars" ] || [ -f "$ROOT/infra/aws/terraform.tfvars" ]; then
|
|
567
|
+
cloud=$(SELF_CMD="unoverse deploy" _pick_ground "") || exit 1
|
|
551
568
|
fi
|
|
552
569
|
|
|
553
570
|
if [ -z "$cloud" ]; then
|
package/operator/lib/help.sh
CHANGED
|
@@ -25,8 +25,13 @@ cmd_help() {
|
|
|
25
25
|
# THE ARGUMENT IS ON THE LINE, not in a footnote. It read as a special case for people
|
|
26
26
|
# with two clouds; it is simply how the command is shaped. A cloud is optional when only
|
|
27
27
|
# one ground exists and required when two do.
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
# SHOW THE COMMAND, not a description of it. "aws or digitalocean" told a reader the
|
|
29
|
+
# clouds exist without telling them what to type, so the shape of the command still had
|
|
30
|
+
# to be guessed. Print the line they will actually run.
|
|
31
|
+
echo -e " ${GREEN}deploy${NC} Ship it to a server ${DIM}(first run asks which cloud)${NC}"
|
|
32
|
+
echo -e " ${DIM}unoverse deploy aws · unoverse deploy digitalocean${NC}"
|
|
33
|
+
echo -e " ${GREEN}destroy${NC} Take it down ${DIM}(shows what goes, and what stays)${NC}"
|
|
34
|
+
echo -e " ${DIM}unoverse destroy aws · unoverse destroy digitalocean${NC}"
|
|
30
35
|
echo -e " ${GREEN}db-allow${NC} Let this machine reach the database ${DIM}(run it when you change network)${NC}"
|
|
31
36
|
echo ""
|
|
32
37
|
# Owner-only lane. Printed ONLY when publish.sh is present, so a starter kit never
|
package/package.json
CHANGED