Process Config¶
This config resides in /etc/lithos/processes/NAME.yaml
(by default).
Where NAME
is the name of a sandbox.
It mainly contains three things:
image
the process is run fromconfig
file name inside the image that specifies command-line and other process execution parameters- number
instances
of the process to run
For example:
django:
image: django.v3.5.7
config: /config/worker_process.yaml
instances: 3
redis:
image: redix.v1
config: /config/redis.yaml
instances: 1
This will start three python django
worker processes and one redis.
There is also a way to create ad-hoc commands. For example:
manage:
kind: Command
image: django.v3.5.7
config: /config/manage_py.yaml
This will allow to start a manage.py
command with:
$ lithos_cmd SANDBOX_NAME manage syncdb
This runs command in the same sandbox like the worker process itself but
the command is actually attached to current shell. The commands may be freely
mixed with Daemon
items (which is default kind
) in same config. The
only limitation is that names must not be duplicated
The Command
is occasionally useful, but should be used with care. To start
a command you need root privileges on host system, so it’s only useful for
SysOp tasks or may be for cron tasks but not for normal operation of
application.
Options¶
-
instances
¶ Number of instances to run
-
image
¶ Identifier of the image to run container from
-
config
¶ Configuration file name (absolute name in container) to run
-
ip-addresses
¶ A list of ip addresses if
bridged-network
is enforced in sandbox. Note the number of items in this list must matchinstances
value.
-
variables
¶ A mapping of variable: value for variables that can be used in process config.
-
extra-secrets-namespaces
¶ Additional secrets namespaces allowed for this specific project. In addition to
secrets-namespaces
. See Encrypted Variables for more info.
Variables¶
You can also add variables for specific config:
For example:
django:
image: django.v3.5.7
config: /config/worker_process.yaml
variables:
tcp_port: 10001
instances: 3
Only variables that are declared in container config can be substituted. Extra variables are ignored. If there is a declared variable but it’s not present in process config, it doesn’t pass configuration check.