Skip to content

Commit 3ee04c4

Browse files
authored
vpn + zsc object-storage (#288)
1 parent 82ccfd6 commit 3ee04c4

File tree

2 files changed

+284
-270
lines changed

2 files changed

+284
-270
lines changed

apps/docs/content/references/zsc.mdx

Lines changed: 161 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ zsc backup-create <stackName>
6969
```
7070

7171
#### Required parameters
72-
- `stackName`: Name of the stack to backup
72+
- `<stackName>`: Name of the stack to backup
7373

7474
#### Available flags
7575
- `-h, --help`: Help for the backup-create command
@@ -113,128 +113,6 @@ zsc cdn purge example.com "/images/"
113113
:::
114114
---
115115

116-
### object-storage
117-
118-
Manages object storage operations for backups and restores.
119-
120-
```sh
121-
zsc object-storage [command]
122-
```
123-
124-
#### Available flags
125-
- `-h, --help`: Help for the object-storage command
126-
127-
When using `--storage objectstorage`, the command requires the following environment variables to be defined:
128-
129-
* `objectstorage_apiUrl` - API URL of the object storage service
130-
* `objectstorage_accessKeyId` - Access key ID for authentication
131-
* `objectstorage_secretAccessKey` - Secret access key for authentication
132-
* `objectstorage_bucketName` - Name of the bucket to use
133-
134-
These environment variables will be automatically available if the object storage service has `envIsolation: none` configured, or if the entire project has `envIsolation: none` set. Otherwise, you need to explicitly reference these environment variables in your `zerops.yaml` file.
135-
136-
#### Sub-commands
137-
138-
#### Common parameters
139-
All sub-commands share these parameters:
140-
- `--storage`: Name of the object storage service
141-
- `--name`: Name of the backup in storage
142-
- `--silent`, `-s`: Suppresses command output (default: false)
143-
- `--no-fail`: Prevents command failure with exit code 1 (default: false)
144-
145-
**list** - Lists all available backups in the specified storage
146-
```sh
147-
zsc object-storage list --storage <storage-name> --name <backup-name>
148-
```
149-
150-
**backup** - Creates a backup of specified directories to object storage
151-
```sh
152-
zsc object-storage backup <directory1> [<directory2>...] --storage <storage-name> --name <backup-name> [options]
153-
```
154-
Additional options:
155-
- `--truncateCount`: If greater than 0, truncate operation is performed after successful backup, keeping the specified number of most recent backups (default: 0)
156-
157-
**restore** - Restores a backup from object storage
158-
```sh
159-
zsc object-storage restore [<directory>] --storage <storage-name> --name <backup-name> [options]
160-
```
161-
Additional options:
162-
- `--dryRun`: Simulates restore operation without performing actual changes
163-
- `--overwrite`: Allows overwriting existing files during restore
164-
- `--index`: Specifies which backup to restore. Non-negative values count from newest (0 = newest, 1 = second newest), negative values count from oldest (-1 = oldest, -2 = second oldest) (default: 0)
165-
- `--ignore-non-existing`: Prevents command failure if backup doesn't exist
166-
167-
**truncate** - Removes old backups, keeping only the most recent ones
168-
```sh
169-
zsc object-storage truncate --storage <storage-name> --name <backup-name> [options]
170-
```
171-
Additional options:
172-
- `--dryRun`: Simulates truncate operation without performing actual deletions (default: false)
173-
- `--truncateCount`: Number of most recent backups to keep (default: 5)
174-
175-
#### Examples
176-
```sh
177-
# List all backups
178-
zsc object-storage list --storage objectstorage --name daily-backup
179-
180-
# Create a backup with retention
181-
zsc object-storage backup /var/www --storage objectstorage --name web-backup --truncateCount 5
182-
183-
# Restore with dry run preview
184-
zsc object-storage restore --storage objectstorage --name database-backup --dryRun
185-
186-
# Clean up old backups
187-
zsc object-storage truncate --storage objectstorage --name logs-backup --truncateCount 3
188-
```
189-
190-
#### Example usage in `zerops.yaml`
191-
```yaml
192-
zerops:
193-
- setup: app
194-
run:
195-
initCommands:
196-
- "zsc object-storage restore --storage objectstorage --name $ZEROPS_StackName --ignore-non-existing ./data/"
197-
crontab:
198-
- timing: "*/10 * * * *"
199-
command: "zsc object-storage backup --storage objectstorage --name $ZEROPS_StackName --truncateCount 5 ./data/"
200-
allContainers: false
201-
```
202-
203-
---
204-
205-
### shared-storage
206-
207-
Manages shared storage volumes for persistent data storage.
208-
209-
```sh
210-
zsc shared-storage [command]
211-
```
212-
213-
#### Available sub-commands
214-
- `mount`: Mounts the shared storage
215-
- `unmount`: Unmounts the shared storage
216-
- `wait`: Waits for readiness of the storage mount
217-
218-
#### Available flags
219-
- `-h, --help`: Help for the shared-storage command
220-
221-
#### Examples
222-
```sh
223-
# View shared-storage help
224-
zsc shared-storage --help
225-
226-
# Mount a shared storage volume
227-
zsc shared-storage mount <storage-name>
228-
229-
# Unmount a shared storage volume
230-
zsc shared-storage unmount <storage-name>
231-
232-
# Wait for a storage mount to be ready
233-
zsc shared-storage wait <storage-name>
234-
```
235-
236-
---
237-
238116
### crontab
239117

240118
Manages scheduled tasks that are defined in your zerops.yaml configuration.
@@ -312,7 +190,7 @@ zsc install <baseName> [flags]
312190
```
313191

314192
#### Required parameters
315-
- `baseName`: The technology and version to install - see the full list of supported [base environments](/zerops-yaml/base-list).
193+
- `<baseName>`: The technology and version to install - see the full list of supported [base environments](/zerops-yaml/base-list).
316194

317195
#### Available flags
318196
- `--buildBase <string>`: Build base (default "[email protected]")
@@ -386,6 +264,103 @@ zerops:
386264
387265
---
388266
267+
### object-storage
268+
269+
Manages object storage operations for backups and restores.
270+
271+
```sh
272+
zsc object-storage [command]
273+
```
274+
275+
#### Available flags
276+
- `-h, --help`: Help for the object-storage command
277+
278+
When using an object storage service, the command requires the following environment variables to be defined:
279+
280+
* `objectstorage_apiUrl` - API URL of the object storage service
281+
* `objectstorage_accessKeyId` - Access key ID for authentication
282+
* `objectstorage_secretAccessKey` - Secret access key for authentication
283+
* `objectstorage_bucketName` - Name of the bucket to use
284+
285+
These environment variables will be automatically available if the object storage service has `envIsolation: none` configured, or if the entire project has `envIsolation: none` set. Otherwise, you need to explicitly reference these environment variables in your `zerops.yaml` file.
286+
287+
#### Sub-commands
288+
289+
#### Common parameters
290+
All sub-commands share these parameters:
291+
- `--storage <string>`: Name of the object storage service
292+
- `--name <string>`: Name of the backup in storage
293+
- `--silent`, `-s`: Suppresses command output (default: false)
294+
- `--no-fail`: Prevents command failure with exit code 1 (default: false)
295+
296+
**list** - Lists all available backups in the specified storage
297+
```sh
298+
zsc object-storage list --storage <storage-name> --name <backup-name>
299+
```
300+
301+
**backup** - Creates a backup of specified directories to object storage
302+
```sh
303+
zsc object-storage backup <directory1> [<directory2>...] --storage <storage-name> --name <backup-name> [options]
304+
```
305+
Arguments:
306+
- `<directory>`: One or more directories to back up (at least one required)
307+
308+
Additional options:
309+
- `--truncate-count <number>`: Number of most recent backups to keep after successful backup (default: 0)
310+
- `-C, --change-directory <directory>`: Change to directory before operation
311+
312+
**restore** - Restores a backup from object storage to specified or original locations
313+
```sh
314+
zsc object-storage restore <directory> --storage <storage-name> --name <backup-name> [options]
315+
```
316+
Arguments:
317+
- `<directory>`: Directory to restore to. If omitted, files are restored to their original locations
318+
319+
Additional options:
320+
- `--dryRun`: Simulates restore operation without performing actual changes
321+
- `--overwrite`: Allows overwriting existing files during restore
322+
- `--index <number>`: Specifies which backup to restore. Non-negative values count from newest (0 = newest, 1 = second newest), negative values count from oldest (-1 = oldest, -2 = second oldest) (default: 0)
323+
- `--ignore-non-existing`: Prevents command failure if backup does not exist
324+
- `--strip-components <number>`: Strip NUMBER leading components from file names on extraction
325+
326+
**truncate** - Removes old backups, keeping only the most recent ones
327+
```sh
328+
zsc object-storage truncate --storage <storage-name> --name <backup-name> [options]
329+
```
330+
Additional options:
331+
- `--dryRun`: Simulates truncate operation without performing actual deletions (default: false)
332+
- `--truncate-count <number>`: Number of most recent backups to keep (default: 5)
333+
334+
#### Examples
335+
```sh
336+
# List all backups
337+
zsc object-storage list --storage objectstorage --name daily-backup
338+
339+
# Create a backup with retention
340+
zsc object-storage backup /var/www --storage objectstorage --name web-backup --truncate-count 5
341+
342+
# Restore with dry run preview
343+
zsc object-storage restore --storage objectstorage --name database-backup --dryRun
344+
345+
# Clean up old backups
346+
zsc object-storage truncate --storage objectstorage --name logs-backup --truncate-count 3
347+
```
348+
349+
#### Example usage in `zerops.yaml`
350+
```yaml
351+
zerops:
352+
- setup: app
353+
run:
354+
initCommands:
355+
- "zsc object-storage restore --storage objectstorage --name $ZEROPS_StackName --ignore-non-existing ./data/"
356+
crontab:
357+
- timing: "*/10 * * * *"
358+
command: "zsc object-storage backup --storage objectstorage --name $ZEROPS_StackName --truncate-count 5 ./data/"
359+
allContainers: false
360+
```
361+
362+
---
363+
389364
### resources
390365
391366
Displays the current resource scaling configuration for the container.
@@ -461,33 +436,6 @@ The container will scale down automatically if resources are not utilized, or if
461436

462437
---
463438

464-
### test
465-
466-
Run diagnostic tests to verify connectivity and service availability.
467-
468-
```sh
469-
zsc test tcp <host>:<port> [flags]
470-
```
471-
472-
#### Required parameters
473-
- `<host>:<port>`: Host and port to test connectivity to
474-
475-
#### Available flags
476-
- `--timeout <duration>`: Maximum test duration (default: 30s)
477-
- `--dialTimeout <duration>`: Single attempt timeout (default: 2s)
478-
- `-4`: Force IPv4
479-
- `-6`: Force IPv6
480-
- `-h, --help`: Help for the test tcp command
481-
482-
#### Example
483-
```sh
484-
# Test TCP connection to a host
485-
zsc test tcp api.zerops:80
486-
zsc test tcp database:5432 --timeout 1m
487-
```
488-
489-
---
490-
491439
### setSecretEnv
492440

493441
Securely update environment variables containing sensitive information.
@@ -497,8 +445,8 @@ zsc setSecretEnv <key> <content>
497445
```
498446

499447
#### Arguments
500-
- `key`: The name of the environment variable to set
501-
- `content`: The new value for the variable, or `-` to read from stdin
448+
- `<key>`: The name of the environment variable to set
449+
- `<content>`: The new value for the variable, or `-` to read from stdin
502450

503451
#### Available flags
504452
- `-h, --help`: Help for the setSecretEnv command
@@ -521,6 +469,66 @@ Secret environment variables are encrypted at rest and securely distributed to y
521469

522470
---
523471

472+
### shared-storage
473+
474+
Manages shared storage volumes for persistent data storage.
475+
476+
```sh
477+
zsc shared-storage [command]
478+
```
479+
480+
#### Available sub-commands
481+
- `mount`: Mounts the shared storage
482+
- `unmount`: Unmounts the shared storage
483+
- `wait`: Waits for readiness of the storage mount
484+
485+
#### Available flags
486+
- `-h, --help`: Help for the shared-storage command
487+
488+
#### Examples
489+
```sh
490+
# View shared-storage help
491+
zsc shared-storage --help
492+
493+
# Mount a shared storage volume
494+
zsc shared-storage mount <storage-name>
495+
496+
# Unmount a shared storage volume
497+
zsc shared-storage unmount <storage-name>
498+
499+
# Wait for a storage mount to be ready
500+
zsc shared-storage wait <storage-name>
501+
```
502+
503+
---
504+
505+
### test
506+
507+
Run diagnostic tests to verify connectivity and service availability.
508+
509+
```sh
510+
zsc test tcp <host>:<port> [flags]
511+
```
512+
513+
#### Required parameters
514+
- `<host>:<port>`: Host and port to test connectivity to
515+
516+
#### Available flags
517+
- `--timeout <duration>`: Maximum test duration (default: 30s)
518+
- `--dialTimeout <duration>`: Single attempt timeout (default: 2s)
519+
- `-4`: Force IPv4
520+
- `-6`: Force IPv6
521+
- `-h, --help`: Help for the test tcp command
522+
523+
#### Example
524+
```sh
525+
# Test TCP connection to a host
526+
zsc test tcp api.zerops:80
527+
zsc test tcp database:5432 --timeout 1m
528+
```
529+
530+
---
531+
524532
### version
525533

526534
Displays the current version of Zsc CLI.

0 commit comments

Comments
 (0)