Using Zerops Setup Control (zsc)
Zerops Setup Control (zsc) is a command-line utility automatically installed in all Zerops containers enabling developers to manage and control container environments directly from within both runtime and build contexts.
Zerops Setup Control provides essential capabilities for container management, including resource scaling, technology installation, and environment configuration.
Zerops Setup Control commands can be executed in two ways:
- Manual execution:
- From the web terminal interface in Zerops GUI
- Using SSH connections to your containers
- Automated execution:
- As part of your
zerops.yaml
configuration file
- As part of your
Usage​
Commands​
help​
This command lists available commands and flags on a command by placing help
, -h
or --help
flag after the command.
completion​
Generate the autocompletion script for zsc for the specified shell.
Available sub-commands​
bash
: Generate the autocompletion script for bashfish
: Generate the autocompletion script for fishpowershell
: Generate the autocompletion script for powershellzsh
: Generate the autocompletion script for zsh
Available flags​
-h, --help
: Help for the completion command
backup-create​
Creates a backup of any specified stack in your project.
Required parameters​
stackName
: Name of the stack to backup
Available flags​
-h, --help
: Help for the backup-create command
Example​
shared-storage​
Manages shared storage volumes for persistent data storage.
Available sub-commands​
mount
: Mounts the shared storageunmount
: Unmounts the shared storagewait
: Waits for readiness of the storage mount
Available flags​
-h, --help
: Help for the shared-storage command
Examples​
crontab​
Manages scheduled tasks that are defined in your zerops.yaml configuration.
Available sub-commands​
list
: List all crontabs defined in zerops.yamlrun
: Execute crontab command defined in zerops.yaml
Available flags​
-h, --help
: Help for the crontab command
execOnce​
Execute a command exactly once across all containers in a service, preventing duplicate execution in high-availability setups.
Required parameters​
<key>
: A unique identifier for the execution--
: Standard separator indicating the end of options and beginning of the command<command> [args...]
: The actual command to execute and its arguments
Available flags​
-r, --retryUntilSuccessful
: Retry command until it succeeds-v, --verbose
: Verbose output-h, --help
: Help for the execOnce command
Behavior​
- On success: All containers proceed with their tasks
- On failure: All containers report the command as failed
- With --retryUntilSuccessful: The command is retried on a different container until it succeeds
Examples​
This command is ideal for database migrations, initialization scripts, and other operations that should only run once in clustered environments.
fail-me​
Deliberately fails the current container for testing purposes.
Available flags​
-h, --help
: Help for the fail-me command
install​
Run install commands for the specified base technology in your runtime container.
Required parameters​
baseName
: The technology and version to install - see the full list of supported base environments.
Available flags​
--buildBase <string>
: Build base (default "php@8.4")--buildOs <string>
: Build os (default "alpine")-m, --mode <string>
: Mode (default "RUNTIME")--runBase <string>
: Run base (default "php-nginx@8.4")--runOs <string>
: Run os (default "alpine")-h, --help
: Help for the install command
Examples​
Example usage in zerops.yaml
​
noop​
Keep a container alive indefinitely with a non-terminating process.
Available flags​
-s, --silent
: Disables output to StdOut-h, --help
: Help for the noop command
Examples​
The noop
command is especially useful for:
- Debugging build failures by keeping containers alive for investigation
- Supporting applications that run as background daemons
- Keeping service containers active when your app doesn't have a foreground process
- As a start command in zerops.yaml for services that don't have a natural blocking command
Usage in zerops.yaml​
resources​
Displays the current resource scaling configuration for the container.
Available flags​
-h, --help
: Help for the resources command
Example output​
Related commands​
zsc scale
: Dynamically adjust resource allocations
scale​
Dynamically adjust CPU or memory resources for the current container for a specified duration.
Required parameters​
cpu|ram
: Resource type to scale (either CPU cores or RAM)<value> <duration>
orauto
: Scale value and duration, or "auto" to disable custom scaling
Available flags​
-h, --help
: Help for the scale command
Supported values​
- For RAM: Value must be suffixed by a unit (KiB, MiB, GiB); number may be a float.
- For CPU: Value must not be suffixed; number must be an integer.
- "auto": Disables any custom scaling set via this command and must be used without the duration parameter.
- "min" and "max": Set the container to its CURRENT min and max values.
- Numeric values can be prefixed with "+" for relative scaling, adding the requested value to currently used resources.
- Duration must be suffixed by a unit (s = seconds, m = minutes, h = hours, d = days) and cannot be less than 10 minutes.
Examples​
- Resource adjustments take effect within approximately 10 seconds
- The container cannot be scaled above or below its max/min resources set in the vertical autoscaling configuration
- If you scale to a value that exceeds the maximum set limit (e.g., 10GB RAM when max is 5GB), the container will only receive the maximum allowed resources
- If service limits are changed while custom scaling is active, the container will automatically adjust to the new boundaries
- If the service auto-scaling configuration is updated, you must call the scale command again to apply custom scaling
If there are insufficient resources on the current server, the container might be moved to another node with available resources, which will reset the scale duration. The container will scale down automatically if resources are not utilized, or if the scale command duration expires.
test​
Run diagnostic tests to verify connectivity and service availability.
Required parameters​
<host>:<port>
: Host and port to test connectivity to
Available flags​
--timeout <duration>
: Maximum test duration (default: 30s)--dialTimeout <duration>
: Single attempt timeout (default: 2s)-4
: Force IPv4-6
: Force IPv6-h, --help
: Help for the test tcp command
Example​
setSecretEnv​
Securely update environment variables containing sensitive information.
Arguments​
key
: The name of the environment variable to setcontent
: The new value for the variable, or-
to read from stdin
Available flags​
-h, --help
: Help for the setSecretEnv command
Examples​
Secret environment variables are encrypted at rest and securely distributed to your containers. Use this command for storing sensitive configuration like API keys, tokens, and passwords.
version​
Displays the current version of Zsc CLI.
Available flags​
-h, --help
: Help for the version command