@nocobase/app-installer 0.1.0-beta.3 → 0.1.0-beta.4
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 +81 -99
- package/dist/cli.js +6 -9
- package/dist/cli.js.map +1 -1
- package/dist/commands/install.js +29 -93
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/rollback.js +8 -11
- package/dist/commands/rollback.js.map +1 -1
- package/dist/commands/status.js +4 -27
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/upgrade.js +53 -213
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/lib/ecosystem.js +1 -5
- package/dist/lib/ecosystem.js.map +1 -1
- package/dist/lib/layout.js +0 -13
- package/dist/lib/layout.js.map +1 -1
- package/dist/lib/prechecks.js +1 -38
- package/dist/lib/prechecks.js.map +1 -1
- package/dist/lib/registry.js +0 -50
- package/dist/lib/registry.js.map +1 -1
- package/dist/lib/release.js +6 -161
- package/dist/lib/release.js.map +1 -1
- package/dist/lib/source.js +4 -60
- package/dist/lib/source.js.map +1 -1
- package/dist/lib/state.js +12 -1
- package/dist/lib/state.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
# @nocobase/app-installer
|
|
2
2
|
|
|
3
|
-
Installs, upgrades and rolls back a NocoBase 3 application on a server, and runs it under pm2. It
|
|
3
|
+
Installs, upgrades and rolls back a NocoBase 3 application on a server, and runs it under pm2. It installs a deployment archive you build in the application project with `pnpm build --tar`: the server unpacks it and runs it, and needs neither the sources nor pnpm.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- **The published Hub template**, `--template hub`, for a Hub whose source you do not change. The installer generates the Hub from `@nocobase/app-template-hub`, builds it on the server and keeps only the deployment archive. A Hub you customise is an application project: create it with `pnpm create @nocobase/app hub --template=hub` and deploy its archive like any other.
|
|
5
|
+
Each installation lives in a directory of its own, with its own port and pm2 process, so one server can run several. Docker remains the other way to run an application.
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
Earlier versions could also build the published Hub template on the server (`--template hub`). That source is gone: an installation recorded as built from a template is refused with `STATE_UNSUPPORTED`, and stays manageable with the app-installer version that installed it.
|
|
9
8
|
|
|
10
9
|
## Requirements
|
|
11
10
|
|
|
12
11
|
- Linux or macOS. On Windows, use WSL: switching releases relies on symbolic links and atomic renames.
|
|
13
|
-
- Node.js 24 or later.
|
|
12
|
+
- Node.js 24 or later.
|
|
14
13
|
- pm2 4.3 or later, installed globally (`npm install -g pm2`), to start the application. A copy fetched through `npx` does not work, because `pm2 startup` writes a boot service that names pm2's own path.
|
|
15
14
|
|
|
16
15
|
NocoBase 3 packages are published to the public npm registry. The commands below use `--yes` to skip npx's own install prompt. `--registry` or `NOCOBASE_REGISTRY` selects a private registry when needed; the installer records that registry in `installer.json`, so later commands for an existing installation keep using its original source.
|
|
17
16
|
|
|
18
|
-
`--template` builds the Hub on the machine it runs on, which takes several minutes; give `install` and `upgrade` a timeout to match when a script or an agent runs them.
|
|
19
|
-
|
|
20
17
|
## Building an archive
|
|
21
18
|
|
|
22
19
|
In the application project, build for the server rather than for the machine you build on, and copy the archive over:
|
|
@@ -32,77 +29,70 @@ scp storage/exports/dist.tar.gz user@server:/tmp/crm.tar.gz
|
|
|
32
29
|
|
|
33
30
|
```bash
|
|
34
31
|
npx --yes @nocobase/app-installer install /srv/nocobase/crm --archive /tmp/crm.tar.gz --origin https://apps.example.com
|
|
35
|
-
npx --yes @nocobase/app-installer install /srv/nocobase/hub --template hub --origin https://apps.example.com
|
|
36
32
|
```
|
|
37
33
|
|
|
38
|
-
The target must be new or empty. Before writing anything, the command also checks that the port is free — naming a free one when it is not — that no pm2 process already uses the name (`pm2 start` on a taken name would restart that process with this installation's configuration rather than start a new one), and that every variable named by `--set-from-env` is set. It then unpacks the archive
|
|
34
|
+
The target must be new or empty. Before writing anything, the command also checks that the port is free — naming a free one when it is not — that no pm2 process already uses the name (`pm2 start` on a taken name would restart that process with this installation's configuration rather than start a new one), and that every variable named by `--set-from-env` is set. It then unpacks the archive into a release directory; writes the configuration; applies the database migrations; and starts the application with pm2, waiting until its health check answers or pm2 reports the process as crashed. Anything it wrote is removed again if it fails before the application is switched on, so running it again starts clean.
|
|
39
35
|
|
|
40
36
|
Ctrl-C (or SIGTERM) stops the step that is running and lets that cleanup happen; a second one exits at once.
|
|
41
37
|
|
|
42
|
-
| Flag | Default | Purpose
|
|
43
|
-
| ------------------ | ---------------------------- |
|
|
44
|
-
| `--dir` | | The target, as the other commands name it; the same as the directory argument.
|
|
45
|
-
| `--archive` | | The deployment archive to install, by local path.
|
|
46
|
-
| `--
|
|
47
|
-
| `--
|
|
48
|
-
| `--
|
|
49
|
-
| `--
|
|
50
|
-
| `--
|
|
51
|
-
| `--set`
|
|
52
|
-
| `--
|
|
53
|
-
| `--
|
|
54
|
-
| `--
|
|
55
|
-
| `--
|
|
56
|
-
| `--
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
A PostgreSQL Hub, with the password taken from the environment:
|
|
38
|
+
| Flag | Default | Purpose |
|
|
39
|
+
| ------------------ | ---------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
40
|
+
| `--dir` | | The target, as the other commands name it; the same as the directory argument. |
|
|
41
|
+
| `--archive` | | The deployment archive to install, by local path. Required. |
|
|
42
|
+
| `--origin` | `http://HOST:PORT` | Public origin without the base path. Set it before exposing the application. |
|
|
43
|
+
| `--base-path` | the server's, `/main` | Where the application is mounted, such as `/crm`, or `/` for the origin root. Written to `app.env`. |
|
|
44
|
+
| `--host`, `--port` | `127.0.0.1`, `13000` | Where the application listens. Keep the loopback default behind a reverse proxy; give each installation its own port. |
|
|
45
|
+
| `--dialect` | `sqlite` | Database. Anything else needs `--set`; the archive must carry `@nocobase/db-<dialect>`. |
|
|
46
|
+
| `--set` | | `key=value` passed to `nocobase config set`, repeatable. Values are YAML scalars. |
|
|
47
|
+
| `--set-from-env` | | `key=VARIABLE` read from the environment, repeatable. Use it for passwords. |
|
|
48
|
+
| `--registry` | `https://registry.npmjs.org` | Registry the suggested installer commands use; `NOCOBASE_REGISTRY` also sets it. |
|
|
49
|
+
| `--name` | `nocobase-<directory name>` | pm2 process name. |
|
|
50
|
+
| `--no-start` | | Install without starting; the result names the command that starts it. |
|
|
51
|
+
| `--health-timeout` | `180` | Seconds to wait for the health check. |
|
|
52
|
+
| `--json` | | Print one JSON result on stdout. Progress always goes to stderr. |
|
|
53
|
+
|
|
54
|
+
A PostgreSQL installation, with the password taken from the environment:
|
|
61
55
|
|
|
62
56
|
```bash
|
|
63
|
-
|
|
64
|
-
--
|
|
57
|
+
CRM_DB_PASSWORD=... npx --yes @nocobase/app-installer install /srv/nocobase/crm \
|
|
58
|
+
--archive /tmp/crm.tar.gz --origin https://apps.example.com --dialect postgres \
|
|
65
59
|
--set database.connections.main.host=db.internal \
|
|
66
|
-
--set database.connections.main.username=
|
|
67
|
-
--set-from-env database.connections.main.password=
|
|
60
|
+
--set database.connections.main.username=crm \
|
|
61
|
+
--set-from-env database.connections.main.password=CRM_DB_PASSWORD
|
|
68
62
|
```
|
|
69
63
|
|
|
70
64
|
`--set` values are read as YAML scalars by `nocobase config set`: `0123` becomes the number `123` and `no` becomes `false`, so quote text that looks like either, as in `--set 'key="0123"'`. Values are masked in the installer's own output, but a secret passed with `--set` is still visible to other users in the process list while the command runs; pass secrets with `--set-from-env`.
|
|
71
65
|
|
|
72
|
-
Afterwards, run `pm2 startup` once and execute the command it prints so pm2 restarts the application after a reboot, and proxy the origin to the application's port with `location
|
|
66
|
+
Afterwards, run `pm2 startup` once and execute the command it prints so pm2 restarts the application after a reboot, and proxy the origin to the application's port with `location /`. Several installations behind one origin are told apart by their base paths. The first sign-in comes from `users.initialAdmin` in `config.yml`. The result's `initialAdmin` names that account's username and email, and `defaultPassword` says whether its password is still the one `config.example.yml` ships (`admin123`), to be changed after signing in; the password itself is never printed.
|
|
73
67
|
|
|
74
68
|
## Upgrade
|
|
75
69
|
|
|
76
70
|
```bash
|
|
77
71
|
npx --yes @nocobase/app-installer upgrade --dir /srv/nocobase/crm --archive /tmp/crm.tar.gz
|
|
78
|
-
npx --yes @nocobase/app-installer upgrade --dir /srv/nocobase/hub
|
|
79
72
|
```
|
|
80
73
|
|
|
81
|
-
An upgrade
|
|
74
|
+
An upgrade moves to the archive given with `--archive`, which must hold the same application (its package name owns the migration history) and not an older version; an archive from before relocatable builds must also have been built for the path `app.env` mounts.
|
|
82
75
|
|
|
83
76
|
Every build is a release of its own, named by its version and UTC build time, as in `0.3.0_20260927T005500Z`, so deploying a project without bumping its version is still an upgrade. An archive already on disk is reused, and the one already running changes nothing.
|
|
84
77
|
|
|
85
|
-
Everything that takes time happens while the current release keeps serving: the new release is unpacked
|
|
78
|
+
Everything that takes time happens while the current release keeps serving: the new release is unpacked beside it, then checked with its own CLI — `config check`, and `db apply --dry-run` to count the pending migrations. Only then does the downtime start: the application is stopped, its SQLite databases, `config.yml` and `app.env` are copied to `backups/<time>_<from>_to_<to>/`, `current` is switched, the migrations are applied, and the new release is started and must pass its health check.
|
|
86
79
|
|
|
87
80
|
If migrating or starting the new release fails, the upgrade rolls itself back: `current` returns to the previous release, the databases are restored from the backup when the new release may have migrated them, and the previous release is started again. The command then exits with code `3`. If the previous release does not come back either, it exits with `4`, keeps the new release on disk, and leaves the operation pending, so `rollback` finishes the job once the cause is fixed.
|
|
88
81
|
|
|
89
82
|
A version older than the running one is refused: the older release knows nothing of the newer migrations. Going back is what `rollback` is for. The pm2 process named in `installer.json` must belong to this installation, and once the application is stopped its port must be free, so the health check cannot be answered by anything but the new release.
|
|
90
83
|
|
|
91
|
-
| Flag | Default
|
|
92
|
-
| ------------------ |
|
|
93
|
-
| `--archive` |
|
|
94
|
-
| `--
|
|
95
|
-
| `--
|
|
96
|
-
| `--
|
|
97
|
-
| `--
|
|
98
|
-
| `--
|
|
99
|
-
| `--health-timeout` | `180` | Seconds to wait for the new release's health check. |
|
|
100
|
-
| `--yes` | | Proceed without the confirmation prompt; required with `--json` or without a terminal. |
|
|
101
|
-
| `--json` | | Print one JSON result on stdout. |
|
|
84
|
+
| Flag | Default | Purpose |
|
|
85
|
+
| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------- |
|
|
86
|
+
| `--archive` | | The new archive, by local path. Required. |
|
|
87
|
+
| `--backup-done` | | Required when `config.yml` names a database the installer cannot back up — any but SQLite: back it up yourself. |
|
|
88
|
+
| `--keep` | `3` | Releases to keep on disk (at least 2). The new release and the one upgraded from are always kept. |
|
|
89
|
+
| `--health-timeout` | `180` | Seconds to wait for the new release's health check. |
|
|
90
|
+
| `--yes` | | Proceed without the confirmation prompt; required with `--json` or without a terminal. |
|
|
91
|
+
| `--json` | | Print one JSON result on stdout. |
|
|
102
92
|
|
|
103
|
-
The backup covers what rolling back needs: every SQLite database `config.yml` declares, with its journals, and the configuration. It is not a replacement for regular backups of `storage/`, whose uploaded files it leaves out, and backups are not pruned: remove old ones from `backups/` yourself.
|
|
93
|
+
The backup covers what rolling back needs: every SQLite database `config.yml` declares, with its journals, and the configuration. It is not a replacement for regular backups of `storage/`, whose uploaded files it leaves out, and backups are not pruned: remove old ones from `backups/` yourself.
|
|
104
94
|
|
|
105
|
-
When the machine's Node major changes, a release's native modules no longer load, and `status` says so.
|
|
95
|
+
When the machine's Node major changes, a release's native modules no longer load, and `status` says so. Build the archive again with the new `--node-version` and upgrade to it: the new build is a release of its own, switched to through the same steps and the same backup as any upgrade. The release it replaces stays on disk but cannot be rolled back to, since it was built for another Node.
|
|
106
96
|
|
|
107
97
|
## Rollback
|
|
108
98
|
|
|
@@ -122,7 +112,7 @@ If an upgrade or rollback is interrupted while the application is down, `install
|
|
|
122
112
|
npx --yes @nocobase/app-installer status --dir /srv/nocobase/crm
|
|
123
113
|
```
|
|
124
114
|
|
|
125
|
-
Reports the application, its source, the running release with its version and build time, its `endpoints` — the public URL and origin, and the host and port it listens on — whether it answers its health check, the pm2 process, the releases on disk and their size, and whether the machine's Node major still matches the one the release was built for.
|
|
115
|
+
Reports the application, its source, the running release with its version and build time, its `endpoints` — the public URL and origin, and the host and port it listens on — whether it answers its health check, the pm2 process, the releases on disk and their size, and whether the machine's Node major still matches the one the release was built for. It changes nothing, and does not start the pm2 daemon when it is not running.
|
|
126
116
|
|
|
127
117
|
## Changing the origin or port
|
|
128
118
|
|
|
@@ -147,7 +137,7 @@ pm2 restart nocobase-crm
|
|
|
147
137
|
├── releases/<version>_<time>/app/ dist/ and config.example.yml from the deployment archive
|
|
148
138
|
├── current -> releases/<version>_<time>/app
|
|
149
139
|
├── backups/ databases and configuration copied before each upgrade
|
|
150
|
-
└── installer.json what the installer knows: application, base path,
|
|
140
|
+
└── installer.json what the installer knows: application, base path, source, releases, history
|
|
151
141
|
```
|
|
152
142
|
|
|
153
143
|
`APP_CONFIG_FILE` and `APP_STORAGE_DIR` in `app.env` are absolute. A built server treats the directory above `dist/` as its deployment root and would otherwise keep its configuration and data inside the release directory; a release too old to read `APP_STORAGE_DIR` does exactly that, and the installer refuses it.
|
|
@@ -168,51 +158,43 @@ pm2 runs `node launcher.mjs` (`interpreter: 'none'`), and on every start `launch
|
|
|
168
158
|
|
|
169
159
|
Under `--json`, a failure prints `ok: false` and `status: "failure"` with `error.code`, a message, `error.suggestions` and, where there is any, `error.details`: the same envelope as the application CLI's `pnpm nocobase … --json`. A suggestion's `run`, where it has one, is `{ command, args }`, an executable and its arguments to run as given, without a shell; a step that takes two commands is two suggestions. Codes are stable; branch on them rather than on the message.
|
|
170
160
|
|
|
171
|
-
| Code | Exit
|
|
172
|
-
| ----------------------- |
|
|
173
|
-
| `INVALID_USAGE` | `2`
|
|
174
|
-
| `NODE_UNSUPPORTED` | `2`
|
|
175
|
-
| `PLATFORM_UNSUPPORTED` | `2`
|
|
176
|
-
| `
|
|
177
|
-
| `
|
|
178
|
-
| `
|
|
179
|
-
| `
|
|
180
|
-
| `
|
|
181
|
-
| `
|
|
182
|
-
| `
|
|
183
|
-
| `
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
| `
|
|
190
|
-
| `
|
|
191
|
-
| `
|
|
192
|
-
| `
|
|
193
|
-
| `
|
|
194
|
-
| `
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
201
|
-
| `
|
|
202
|
-
| `
|
|
203
|
-
| `
|
|
204
|
-
| `
|
|
205
|
-
| `
|
|
206
|
-
| `
|
|
207
|
-
| `
|
|
208
|
-
| `
|
|
209
|
-
| `
|
|
210
|
-
| `
|
|
211
|
-
| `APP_CLI_FAILED` | `1` | The release's own CLI printed no result. A failure it does report keeps its own code instead, such as `CONFIG_INVALID` from `config check`. |
|
|
212
|
-
| `START_FAILED` | `1` | The application is installed but did not pass its health check; `details.log` holds the end of its error log. Fix the cause and start it with the suggested command. |
|
|
213
|
-
| `UPGRADE_ABORTED` | `1` | The upgrade stopped before switching releases and the previous release is running again; exit `4` when it did not come back. |
|
|
214
|
-
| `ROLLBACK_ABORTED` | `1` | Stopping the application failed; nothing was restored or switched. |
|
|
215
|
-
| `INTERRUPTED` | `1` | Ctrl-C or SIGTERM stopped the running step before the application was touched. An install removes what it wrote unless the application was already switched on; an upgrade removes the release it was building. Once an upgrade or rollback has stopped the application, it reports its own code instead. |
|
|
216
|
-
| `UNEXPECTED` | `1` | An error the installer does not recognise. The message is all there is; report it. |
|
|
217
|
-
| `UPGRADE_ROLLED_BACK` | `3` | The new release failed after the switch; the previous one runs again, on the restored databases when the new one may have migrated them. |
|
|
218
|
-
| `ROLLBACK_FAILED` | `4` | The application is down. Follow the suggestions: read the log, fix the cause, and run `rollback` again, which retries the restore. |
|
|
161
|
+
| Code | Exit | Meaning and what to do |
|
|
162
|
+
| ----------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
163
|
+
| `INVALID_USAGE` | `2` | An unknown command or flag, a malformed `--set`, an `--origin` with a path, no install directory, no `--archive`, or an `--archive` URL. Fix the command line. |
|
|
164
|
+
| `NODE_UNSUPPORTED` | `2` | Node.js is older than 24. Install Node.js 24 or later. |
|
|
165
|
+
| `PLATFORM_UNSUPPORTED` | `2` | Windows. Run the installer inside WSL. |
|
|
166
|
+
| `PM2_MISSING` | `2` | pm2 is not on PATH. Install it globally, or install with `--no-start`. |
|
|
167
|
+
| `PM2_UNSUPPORTED` | `2` | pm2 is older than 4.3, which does not read `ecosystem.config.cjs`, or `pm2 --version` printed no version. Update it globally, then run `pm2 update`. |
|
|
168
|
+
| `PM2_NAME_IN_USE` | `2` | Another process owns the pm2 name. Choose another with `--name` when installing; for an installation, stop or rename that process. |
|
|
169
|
+
| `PORT_IN_USE` | `2` | Something already listens on the host and port. When installing, `details.freePort` and the suggestion name a free port; otherwise stop what holds it. |
|
|
170
|
+
| `ENV_MISSING` | `2` | A variable named by `--set-from-env` is not set. |
|
|
171
|
+
| `TARGET_NOT_EMPTY` | `2` | The install target holds files, or is a file. Install into a new or empty directory; an installation is managed with the other commands. |
|
|
172
|
+
| `NOT_INSTALLED` | `2` | The directory holds no `installer.json`. Run from the installation root, or name it with `--dir`. |
|
|
173
|
+
| `STATE_UNSUPPORTED` | `2` | `installer.json` was written by a newer app-installer, or records an installation built from a published template, which only the app-installer that installed it manages. |
|
|
174
|
+
| `LOCKED` | `2` | Another app-installer is working on this installation. Wait for it to finish. |
|
|
175
|
+
| `ARCHIVE_NOT_FOUND` | `2` | `--archive` names no file. |
|
|
176
|
+
| `ARCHIVE_INVALID` | `2` | The archive holds no `dist/package.json`: it is not one `pnpm build --tar` wrote. |
|
|
177
|
+
| `CONFIG_UNREADABLE` | `2` | `config.yml` could not be read as YAML, so the databases an upgrade would have to back up are unknown. Fix the file; nothing was changed. |
|
|
178
|
+
| `ARCHIVE_TOO_OLD` | `2` | The archive records neither that it is relocatable nor its base path, or not its build time. Upgrade `@nocobase/app-cli` in the project and build it again. |
|
|
179
|
+
| `DRIVER_MISSING` | `2` | The archive lacks `@nocobase/db-<dialect>` for the chosen dialect. Add it to the project and build again. |
|
|
180
|
+
| `APP_MISMATCH` | `2` | The archive holds another application than the one installed. Install it into a directory of its own. |
|
|
181
|
+
| `BASE_PATH_MISMATCH` | `2` | A release from before relocatable builds was built for another path than `--base-path` or `app.env` names. Build it again with a current `@nocobase/app-cli`, which runs at any path. |
|
|
182
|
+
| `CONFIRMATION_REQUIRED` | `2` | `upgrade` or `rollback` needs consent, and `--json` or the lack of a terminal leaves no prompt to ask on. `details.notes` says what the operation does; pass `--yes` once that is accepted. |
|
|
183
|
+
| `CANCELLED` | `2` | The confirmation prompt was declined. Nothing changed. |
|
|
184
|
+
| `OPERATION_INTERRUPTED` | `2` | An earlier upgrade or rollback stopped while the application was down. Run `rollback` to recover before anything else. |
|
|
185
|
+
| `DOWNGRADE` | `2` | The target is an older version than the running one. Use `rollback --to`. |
|
|
186
|
+
| `BACKUP_REQUIRED` | `2` | `config.yml` names a database the installer cannot back up. Back it up, then pass `--backup-done`. |
|
|
187
|
+
| `NOTHING_TO_ROLL_BACK` | `2` | No upgrade led to the current release. Name a release on disk with `--to`. |
|
|
188
|
+
| `RELEASE_MISSING` | `2` | The release to return to is not on disk; `status` lists those that are. |
|
|
189
|
+
| `NODE_MISMATCH` | `2` | The release was built for another Node major, so its native modules would not load; the suggestions say how to get one that does. |
|
|
190
|
+
| `BUILD_TARGET_MISMATCH` | `2` | The archive was built for another platform or Node major than this machine; the suggestion names the build command that fits. |
|
|
191
|
+
| `UNPACK_FAILED` | `1` | Unpacking the deployment archive failed. |
|
|
192
|
+
| `STORAGE_IN_RELEASE` | `1` | The release wrote its data inside its own directory: its `@nocobase/app-server` predates `APP_STORAGE_DIR`. Upgrade it in the project and build again; an upgrade rolls back on it. |
|
|
193
|
+
| `APP_CLI_FAILED` | `1` | The release's own CLI printed no result. A failure it does report keeps its own code instead, such as `CONFIG_INVALID` from `config check`. |
|
|
194
|
+
| `START_FAILED` | `1` | The application is installed but did not pass its health check; `details.log` holds the end of its error log. Fix the cause and start it with the suggested command. |
|
|
195
|
+
| `UPGRADE_ABORTED` | `1` | The upgrade stopped before switching releases and the previous release is running again; exit `4` when it did not come back. |
|
|
196
|
+
| `ROLLBACK_ABORTED` | `1` | Stopping the application failed; nothing was restored or switched. |
|
|
197
|
+
| `INTERRUPTED` | `1` | Ctrl-C or SIGTERM stopped the running step before the application was touched. An install removes what it wrote unless the application was already switched on; an upgrade removes the release it was unpacking. Once an upgrade or rollback has stopped the application, it reports its own code instead. |
|
|
198
|
+
| `UNEXPECTED` | `1` | An error the installer does not recognise. The message is all there is; report it. |
|
|
199
|
+
| `UPGRADE_ROLLED_BACK` | `3` | The new release failed after the switch; the previous one runs again, on the restored databases when the new one may have migrated them. |
|
|
200
|
+
| `ROLLBACK_FAILED` | `4` | The application is down. Follow the suggestions: read the log, fix the cause, and run `rollback` again, which retries the restore. |
|
package/dist/cli.js
CHANGED
|
@@ -22,14 +22,14 @@ function describeFlags(flags) {
|
|
|
22
22
|
/** Every usage line and example is a command that runs as-is, the same way error suggestions are. */
|
|
23
23
|
export function formatHelp() {
|
|
24
24
|
return [
|
|
25
|
-
'Install and manage a NocoBase 3 application on a server, from a deployment archive
|
|
25
|
+
'Install and manage a NocoBase 3 application on a server, from a deployment archive.',
|
|
26
26
|
'',
|
|
27
27
|
'USAGE',
|
|
28
28
|
` $ ${installerCommand('COMMAND [FLAGS]')}`,
|
|
29
29
|
'',
|
|
30
30
|
'COMMANDS',
|
|
31
|
-
' install DIRECTORY Install into DIRECTORY (or --dir DIRECTORY) from --archive
|
|
32
|
-
' upgrade Upgrade the installation in --dir, the current directory by default
|
|
31
|
+
' install DIRECTORY Install into DIRECTORY (or --dir DIRECTORY) from --archive, and start it with pm2.',
|
|
32
|
+
' upgrade Upgrade the installation in --dir, the current directory by default, to a new --archive.',
|
|
33
33
|
' rollback Return to the release the last upgrade came from, or to --to.',
|
|
34
34
|
' status Report the release, endpoints, health, pm2 process and releases on disk.',
|
|
35
35
|
'',
|
|
@@ -48,17 +48,14 @@ export function formatHelp() {
|
|
|
48
48
|
'EXAMPLES',
|
|
49
49
|
` $ ${installerCommand('install /srv/nocobase/crm --archive /tmp/crm.tar.gz --origin https://apps.example.com')}`,
|
|
50
50
|
` $ ${installerCommand('upgrade --dir /srv/nocobase/crm --archive /tmp/crm.tar.gz --yes')}`,
|
|
51
|
-
` $ ${installerCommand('install /srv/nocobase/
|
|
52
|
-
` $ ${installerCommand('install /srv/nocobase/hub --template hub --dialect postgres --set database.connections.main.host=db.internal --set-from-env database.connections.main.password=HUB_DB_PASSWORD')}`,
|
|
53
|
-
` $ ${installerCommand('upgrade --dir /srv/nocobase/hub --yes')}`,
|
|
51
|
+
` $ ${installerCommand('install /srv/nocobase/crm --archive /tmp/crm.tar.gz --dialect postgres --set database.connections.main.host=db.internal --set-from-env database.connections.main.password=CRM_DB_PASSWORD')}`,
|
|
54
52
|
` $ ${installerCommand('rollback --dir /srv/nocobase/crm')}`,
|
|
55
53
|
` $ ${installerCommand('status --dir /srv/nocobase/crm --json')}`,
|
|
56
54
|
'',
|
|
57
55
|
'NOTES',
|
|
58
|
-
` Requires Node.js 24+ and, to start the application, pm2 ${MINIMUM_PM2_VERSION}+ installed globally
|
|
56
|
+
` Requires Node.js 24+ and, to start the application, pm2 ${MINIMUM_PM2_VERSION}+ installed globally.`,
|
|
59
57
|
' Build an archive in the application project with pnpm build --target <platform> --node-version <major> --tar, matching this machine.',
|
|
60
|
-
'
|
|
61
|
-
' --template builds the Hub on this machine and takes several minutes.',
|
|
58
|
+
' Suggested installer commands use https://registry.npmjs.org by default; override with --registry or NOCOBASE_REGISTRY.',
|
|
62
59
|
' To change the origin or port, edit app.env in the installation root, then run pm2 restart with the process name.',
|
|
63
60
|
].join('\n');
|
|
64
61
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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