Skip to main content
Skip to main content
🚧 Work in Progress

Using Zerops Setup Control(Zsc)

Zerops Setup Control(Zsc) is a cli tool / helper installed to all containers, runtime and build, which allows some direct modifications, like triggering scaling from inside the container, adding new technologies, making sure that commands (like migration) run only once (even when staring some high available setup with 3 containers)

Info

Zsc is automatically installed in all containers and is available both in runtime and build environments.

Command Overview​

zsc --help
Zerops SetupControl CLI

Usage:
zsc [command]

Available Commands:
action Perform specific predefined actions within the container
backup-create creates a new backup of the specified stack
backup-current Create a new backup of the current stack
completion Generate the autocompletion script for the specified shell
connectSharedStorage Connect shared storage to the container
crontab Perform crontab actions defined in zerops.yml
execOnce Execute a command once for the provided key
fail-me Fail current container
help Help about any command
install Run install commands for the specified base
noop Infinitely blocking command that does nothing
scale Scale container CPU or memory instantly*
setSecretEnv Set an secret environment variable in the current stack context
test Run various tests
version application version

Flags:
-h, --help help for zsc

Use "zsc [command] --help" for more information about a command.

Available Commands​

backup-create and backup-current​

The backup-create command lets you create a backup of any specified stack in your project, while backup-current command creates a backup of the stack you're currently working in.

# Create backup of a specified stack
zsc backup-create

# Create backup of the current stack you're working in
zsc backup-current
Info

Backups include all the data and configurations of the stack at the time of backup creation. These can be used for recovery or creating duplicate environments.

connectSharedStorage​

This command lets you connect a shared storage volume to your service for persistent data storage.

zsc connectSharedStorage

crontab​

This command lets you manage scheduled tasks that are defined in your zerops.yml configuration.

zsc crontab

execOnce​

Info

This command is particularly useful in high-availability setups to ensure commands (like database migrations) run only once, even when starting multiple containers.

This command lets you execute a command exactly once across all containers in a service. Useful for database migrations in high-availability setups.

zsc execOnce "db-migration" "php artisan migrate"

fail-me​

This command lets you deliberately fail the current container for testing purposes.

zsc fail-me

install​

You can install additional base technologies in your runtime container that weren't specified in the initial configuration.

Info

The install command allows you to add technologies that weren't specified in the initial base configuration.

Example usage in zerops.yml:

zerops:
- setup: nodejsapp
build:
os: ubuntu
base:
- nodejs@22
- python@3.7
run:
os: ubuntu
base: nodejs@22
prepareCommands:
- zsc install python@3.7

noop​

An infinitely blocking command that does nothing and keeps the container alive so that it doesn't end because of an error. The command runs indefinitely until it receives a SIGTERM signal.

Info

The noop command is particularly useful for debugging build failures by keeping the container alive for investigation.

zsc noop [--silent]

The --silent flag suppresses any output from the command.

scale​

This command dynamically adjusts CPU or memory resources for the current container.

Caution

If there aren't enough resources available on the current node, using scale may trigger a container move to another node. This will reset the scale duration.

# Scale CPU
zsc scale cpu auto # Reset to automatic scaling
zsc scale cpu 5 1h # Scale to 5 CPU cores for 1 hour
zsc scale cpu +2 30m # Add 2 CPU cores for 30 minutes

# Scale Memory
zsc scale memory auto # Reset to automatic scaling
zsc scale memory 5GB 1h # Scale to 5GB RAM for 1 hour
zsc scale memory +2.5GB 600s # Add 2.5GB RAM for 600 seconds
Info
  • Scaling takes effect within ~10 seconds
  • Duration must be at least 10 minutes
  • Supported values: "auto", "min", "max", or numeric values
  • RAM values require units (KiB, MiB, GiB)
  • CPU values must be integers without units
  • Use "+" prefix for relative scaling

test tcp​

This command verifies TCP connectivity to a specified host and port.

zsc test tcp <host>:<port> [--timeout <duration>] [--dialTimeout <duration>] [-4] [-6]
  • <host>: Server address to connect to
  • <port>: Port number to connect to
  • --timeout <duration>: Maximum test duration (default: 30s)
  • --dialTimeout <duration>: Single attempt timeout (default: 2s)
  • -4: Force IPv4
  • -6: Force IPv6

Example:

zsc test tcp database:5432 --timeout 1m

setSecretEnv​

This command sets a secret environment variable in the current stack context.

zsc setSecretEnv [key] [content] [flags]

Examples:

# Direct value
zsc setSecretEnv SECRET_KEY "new_value"

# From stdin
echo "new_value" | zsc setSecretEnv SECRET_KEY -

version​

This command displays the current version of Zsc CLI.

zsc version