unoverse 0.1.79 → 0.1.81

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.
@@ -30,9 +30,16 @@
30
30
  # server's existing compose, so a new env var (e.g. MEMORY_SERVICE_URL) silently never
31
31
  # reached prod even though the image had the code. `.env` (per-server values) is left
32
32
  # untouched — only the canonical compose is refreshed from the repo.
33
+ #
34
+ # THE COMPOSE LIVES IN THE UNIVERSE, NOT NEXT TO THIS PLAYBOOK. `playbook_dir/../..`
35
+ # is the monorepo, where ansible/ and docker-compose.yml are siblings. Installed from
36
+ # npm they are not: the playbook sits in node_modules/unoverse/operator/ansible, and
37
+ # that path resolved to node_modules/unoverse/docker-compose.yml, which does not exist
38
+ # — so every deploy from an installed CLI died here on "Could not find or access". The
39
+ # deploy passes universe_root; the default keeps the monorepo working.
33
40
  - name: "[1/4] Sync docker-compose.yml (config travels with the deploy)"
34
41
  copy:
35
- src: "{{ playbook_dir }}/../../docker-compose.yml"
42
+ src: "{{ universe_root | default(playbook_dir + '/../..') }}/docker-compose.yml"
36
43
  dest: "{{ gravity_dir }}/docker-compose.yml"
37
44
 
38
45
  - name: "[2/4] Pull latest platform images"
@@ -121,7 +121,7 @@
121
121
 
122
122
  - name: "[7/12] Copy docker-compose.yml"
123
123
  copy:
124
- src: "{{ playbook_dir }}/../../docker-compose.yml"
124
+ src: "{{ universe_root | default(playbook_dir + '/../..') }}/docker-compose.yml"
125
125
  dest: "{{ gravity_dir }}/docker-compose.yml"
126
126
  owner: "{{ ansible_user }}"
127
127
  mode: "0644"
@@ -137,7 +137,10 @@
137
137
 
138
138
  - name: "[8/12] Copy .env file"
139
139
  copy:
140
- src: "{{ env_file | default('../../.env.production') }}"
140
+ # Same trap as the compose above: a path relative to the playbook is the monorepo's
141
+ # layout, not an installed CLI's. deploy always passes env_file, so this default is
142
+ # a fallback only — anchored to the universe rather than to node_modules.
143
+ src: "{{ env_file | default(universe_root | default(playbook_dir + '/../..') + '/.env.production') }}"
141
144
  dest: /opt/gravity/.env
142
145
  owner: "{{ ansible_user }}"
143
146
  mode: "0600"
@@ -415,6 +415,21 @@ EOF
415
415
  export ANSIBLE_CONFIG="$ansible_dir/ansible.cfg"
416
416
  local subcommand="${1:-}"
417
417
 
418
+ # A FIRST DEPLOY TO A NEW SERVER IS A PROVISION, NOT AN IMAGE PULL. Bare `deploy` meant
419
+ # only "pull the latest images and restart", which on a freshly built droplet fails on
420
+ # "Destination directory /opt/gravity does not exist" — /opt/gravity being the directory
421
+ # install.yml creates. The remedy was to know that `unoverse deploy init` exists, which
422
+ # is exactly the kind of knowledge this CLI is supposed to remove: deploy owns the whole
423
+ # journey, so it asks the server what it is and picks the right playbook itself.
424
+ if [ -z "$subcommand" ]; then
425
+ if ! ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new -o ConnectTimeout=15 \
426
+ "$deploy_user@$deploy_host" 'test -d /opt/gravity' >/dev/null 2>&1; then
427
+ echo ""
428
+ info "New server. Running the full first-time setup ${DIM}(install, database, verify)${NC}"
429
+ subcommand="init"
430
+ fi
431
+ fi
432
+
418
433
  case "$subcommand" in
419
434
  ""|deploy)
420
435
  # THE deploy: the server takes the latest platform images (pull + restart).
@@ -426,6 +441,7 @@ EOF
426
441
  ansible-playbook \
427
442
  -i "$tmp_inventory" \
428
443
  "$ansible_dir/playbooks/deploy-images.yml" \
444
+ -e "universe_root=$ROOT" \
429
445
  -e "env_file=$env_prod"
430
446
  ;;
431
447
  init|full)
@@ -438,18 +454,21 @@ EOF
438
454
  ansible-playbook \
439
455
  -i "$tmp_inventory" \
440
456
  "$ansible_dir/playbooks/install.yml" \
457
+ -e "universe_root=$ROOT" \
441
458
  -e "env_file=$env_prod" || { rm -f "$tmp_inventory"; fail "install failed — fix and re-run: unoverse deploy init"; exit 1; }
442
459
  echo ""
443
460
  info "[2/3] Database setup..."
444
461
  ansible-playbook \
445
462
  -i "$tmp_inventory" \
446
463
  "$ansible_dir/playbooks/db-setup.yml" \
464
+ -e "universe_root=$ROOT" \
447
465
  -e "env_file=$env_prod" || { rm -f "$tmp_inventory"; fail "db setup failed — fix and re-run: unoverse deploy db"; exit 1; }
448
466
  echo ""
449
467
  info "[3/3] Verifying..."
450
468
  ansible-playbook \
451
469
  -i "$tmp_inventory" \
452
470
  "$ansible_dir/playbooks/test-connectivity.yml" \
471
+ -e "universe_root=$ROOT" \
453
472
  -e "env_file=$env_prod" || { rm -f "$tmp_inventory"; fail "verification failed — inspect and re-run: unoverse deploy test"; exit 1; }
454
473
  echo ""
455
474
  ok "Your universe is up. From now on, deploys are just: unoverse deploy"
@@ -461,6 +480,7 @@ EOF
461
480
  ansible-playbook \
462
481
  -i "$tmp_inventory" \
463
482
  "$ansible_dir/playbooks/db-setup.yml" \
483
+ -e "universe_root=$ROOT" \
464
484
  -e "env_file=$env_prod"
465
485
  ;;
466
486
  test|check)
@@ -469,6 +489,7 @@ EOF
469
489
  ansible-playbook \
470
490
  -i "$tmp_inventory" \
471
491
  "$ansible_dir/playbooks/test-connectivity.yml" \
492
+ -e "universe_root=$ROOT" \
472
493
  -e "env_file=$env_prod"
473
494
  ;;
474
495
  harden)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unoverse",
3
- "version": "0.1.79",
3
+ "version": "0.1.81",
4
4
  "description": "The Unoverse front door — create a Studio project, a universe, or a client app, and launch Studio.",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "type": "module",