@studiometa/forge-cli 0.4.8 → 0.5.1
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 +74 -27
- package/dist/cli.js +527 -72
- package/dist/cli.js.map +1 -1
- package/dist/commands/backups/handlers.d.ts.map +1 -1
- package/dist/commands/backups/help.d.ts.map +1 -1
- package/dist/commands/backups/options.d.ts +33 -0
- package/dist/commands/backups/options.d.ts.map +1 -0
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/scheduled-jobs/help.d.ts.map +1 -1
- package/dist/commands/servers/command.d.ts.map +1 -1
- package/dist/commands/servers/handlers.d.ts +4 -0
- package/dist/commands/servers/handlers.d.ts.map +1 -1
- package/dist/commands/servers/help.d.ts.map +1 -1
- package/dist/commands/storage-providers/command.d.ts +2 -0
- package/dist/commands/storage-providers/command.d.ts.map +1 -0
- package/dist/commands/storage-providers/handlers.d.ts +6 -0
- package/dist/commands/storage-providers/handlers.d.ts.map +1 -0
- package/dist/commands/storage-providers/help.d.ts +2 -0
- package/dist/commands/storage-providers/help.d.ts.map +1 -0
- package/dist/commands/storage-providers/index.d.ts +3 -0
- package/dist/commands/storage-providers/index.d.ts.map +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -41,32 +41,33 @@ forge config delete
|
|
|
41
41
|
forge <command> [subcommand] [options]
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
| Command
|
|
45
|
-
|
|
|
46
|
-
| `config`
|
|
47
|
-
| `servers`
|
|
48
|
-
| `sites`
|
|
49
|
-
| `deployments`
|
|
50
|
-
| `databases`
|
|
51
|
-
| `database-users`
|
|
52
|
-
| `daemons`
|
|
53
|
-
| `backups`
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `nginx
|
|
60
|
-
| `
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
| `ssh
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
44
|
+
| Command | Alias | Description |
|
|
45
|
+
| ------------------- | ------- | ---------------------------------------------------- |
|
|
46
|
+
| `config` | | Manage CLI configuration (`set`, `get`, `delete`) |
|
|
47
|
+
| `servers` | `s` | List, get, reboot servers |
|
|
48
|
+
| `sites` | | List, get sites on a server |
|
|
49
|
+
| `deployments` | `d` | List deployments, trigger deploys, deploy script |
|
|
50
|
+
| `databases` | `db` | List, get databases on a server |
|
|
51
|
+
| `database-users` | | List, get, create, delete database users on a server |
|
|
52
|
+
| `daemons` | | List, get, restart daemons on a server |
|
|
53
|
+
| `backups` | | List, get, create, update, delete database backups |
|
|
54
|
+
| `storage-providers` | | List, get, create, delete backup storage providers |
|
|
55
|
+
| `commands` | | List, get, create commands on a server |
|
|
56
|
+
| `scheduled-jobs` | | List, get, create, delete scheduled jobs on a server |
|
|
57
|
+
| `monitors` | | List, get, create, delete monitors on a server |
|
|
58
|
+
| `env` | | Get, update environment variables for a site |
|
|
59
|
+
| `nginx` | | Get, update Nginx configuration for a site |
|
|
60
|
+
| `nginx-templates` | | List, get, create, update, delete Nginx templates |
|
|
61
|
+
| `php` | | PHP versions, config files, limits and OPcache |
|
|
62
|
+
| `certificates` | `certs` | List, get, activate SSL certificates for a site |
|
|
63
|
+
| `firewall-rules` | `fw` | List, get firewall rules on a server |
|
|
64
|
+
| `ssh` | | Open an SSH session to a server |
|
|
65
|
+
| `ssh-keys` | | List, get, sync SSH keys on servers |
|
|
66
|
+
| `security-rules` | | List, get, create, delete security rules for a site |
|
|
67
|
+
| `redirect-rules` | | List, get, create, delete redirect rules for a site |
|
|
68
|
+
| `recipes` | | List, get, run recipes |
|
|
69
|
+
| `user` | | Get the authenticated user's profile |
|
|
70
|
+
| `completion` | | Install shell completion (bash, zsh, fish) |
|
|
70
71
|
|
|
71
72
|
Run `forge <command> --help` for detailed usage of each command.
|
|
72
73
|
|
|
@@ -121,6 +122,8 @@ forge config delete # Delete all stored config
|
|
|
121
122
|
forge servers list # List all servers
|
|
122
123
|
forge servers get <id> # Get server details
|
|
123
124
|
forge servers reboot <id> # Reboot a server
|
|
125
|
+
forge servers create --name <name> --ip-address <ip> [--php-version php84 --database mariadb1011]
|
|
126
|
+
# Create a server (Custom VPS by default)
|
|
124
127
|
```
|
|
125
128
|
|
|
126
129
|
### `sites` — Manage sites
|
|
@@ -264,6 +267,50 @@ forge ssh-keys sync --file - --server <id> --user deploy # Read the keys from
|
|
|
264
267
|
|
|
265
268
|
`sync` makes the SSH keys of a server user (`--user`, default `forge`) match a file in `authorized_keys` format: one `<type> <base64> [comment]` per line, blank lines and `#` comments ignored. A malformed line stops the command with its line number. Each key gets the name `<comment slug>-<first 8 hex chars of the SHA-256 of the key>`. The Forge API does not return public keys, so keys are matched by name, and a changed key gets a new name. The command prints the plan per server (`+` add, `-` remove, `=` unchanged), applies it, then prints the result. It only adds keys, unless you give `--prune`; `--dry-run` changes nothing. Servers run one after the other. When an operation fails, the other operations still run and the command exits non-zero. When an add fails on a server, the removals on that server are skipped, so nobody loses access. `--format json` prints one document, `{ dry_run, servers: [{ id, name, added, removed, unchanged, errors }] }`. With `--dry-run`, `dry_run` is `true` and `added` and `removed` hold the planned changes.
|
|
266
269
|
|
|
270
|
+
### `scheduled-jobs` — Manage scheduled jobs (cron)
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
forge scheduled-jobs list --server <id> # List scheduled jobs
|
|
274
|
+
forge scheduled-jobs get <job_id> --server <id> # Get scheduled job details
|
|
275
|
+
forge scheduled-jobs create --server <id> --command "..." --frequency hourly # Create a job with a preset frequency
|
|
276
|
+
forge scheduled-jobs create --server <id> --command "..." --cron "0 3 * * *" # Create a job with a cron expression
|
|
277
|
+
forge scheduled-jobs delete <job_id> --server <id> # Delete a scheduled job
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
`create` takes `--user` (default `forge`), `--frequency` (`minutely`, `hourly`, `nightly`, `weekly`, `monthly`, `reboot` or `custom`, default `custom`) and `--cron`, which Forge uses only when the frequency is `custom`. Add `--site <id>` to create the job on a site.
|
|
281
|
+
|
|
282
|
+
### `storage-providers` — Manage backup storage providers
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
forge storage-providers list # List storage providers
|
|
286
|
+
forge storage-providers list --provider custom # Only one provider type
|
|
287
|
+
forge storage-providers get <id> # Get storage provider details
|
|
288
|
+
forge storage-providers delete <id> # Delete an unused storage provider
|
|
289
|
+
|
|
290
|
+
# Create a custom S3-compatible provider; the secret key comes from stdin
|
|
291
|
+
printf '%s' "$S3_SECRET_KEY" | forge storage-providers create \
|
|
292
|
+
--name Backups --provider custom \
|
|
293
|
+
--endpoint https://s3.example.com --region eu-west-1 --bucket my-bucket \
|
|
294
|
+
--access-key "$S3_ACCESS_KEY" --secret-key-file - --format json
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
`--provider` is one of `s3`, `spaces`, `hetzner`, `ovh`, `scaleway` or `custom`. The secret key is read only from `--secret-key-file <path>` or `--secret-key-file -` (stdin), so it does not show in the shell history or the process list; one trailing newline is removed. `--assume-role` uses the EC2 instance role instead of keys. Forge never returns the keys. `--format json` prints the created provider with its `id`.
|
|
298
|
+
|
|
299
|
+
### `backups` — Manage database backups
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
forge backups list --server <id> # List backup configurations
|
|
303
|
+
forge backups get <id> --server <id> # Get backup configuration details
|
|
304
|
+
forge backups delete <id> --server <id> # Delete a backup configuration
|
|
305
|
+
|
|
306
|
+
# Back up two databases every day at 02:00 into web-1/, keep 7 backups
|
|
307
|
+
forge backups create --server web-1 --storage-provider Backups \
|
|
308
|
+
--frequency daily --time 02:00 --retention 7 \
|
|
309
|
+
--directory web-1 --databases app,wordpress
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
`--storage-provider` takes a storage provider ID or exact name and `--databases` takes database IDs or exact names, comma separated or repeated. `--frequency` is `hourly`, `daily`, `weekly` (with `--day 0` to `6`, 0 is Sunday) or `custom` (with `--cron`). `--time` is on the hour or half hour. `--retention` defaults to 5. Other options: `--bucket` (defaults to the provider bucket), `--name`, `--notification-email` and `--include-new-databases`. `forge backups update <id>` takes the same options and requires `--retention`.
|
|
313
|
+
|
|
267
314
|
### `recipes` — Manage recipes
|
|
268
315
|
|
|
269
316
|
```bash
|
|
@@ -283,7 +330,7 @@ forge completion bash --print # Print script without installing
|
|
|
283
330
|
|
|
284
331
|
## Audit Logging
|
|
285
332
|
|
|
286
|
-
All write operations (`deploy`, `create`, `delete`, `reboot`, `restart`, `update`, `run`, `activate`) are automatically logged to `~/.config/forge-tools/audit.log`. Override the path with the `FORGE_AUDIT_LOG` environment variable. Sensitive fields (tokens, passwords) are redacted.
|
|
333
|
+
All write operations (`deploy`, `create`, `delete`, `reboot`, `restart`, `update`, `run`, `activate`) are automatically logged to `~/.config/forge-tools/audit.log`. Override the path with the `FORGE_AUDIT_LOG` environment variable. Sensitive fields (tokens, passwords, storage provider keys) are redacted.
|
|
287
334
|
|
|
288
335
|
## Global Options
|
|
289
336
|
|