Docker image for Opsani ServoX.
The image includes connectors for Kubernetes, Prometheus, and Vegeta. Additional connectors can be added by inheriting from the image and using Poetry to add connector packages to the assembly (see below).
For other versions see releases on GitHub and the available tags on Docker Hub.
The servo requires an optimizer, an API token, and a config file to run. The image is configured to accept these parameters through a combination of environment variables and mounts.
The API token can be configured through an environment variable or a mount.
When the OPSANI_TOKEN
environment variable is not set, the servo will search
for a token file mounted at /servo/opsani.token
.
Name | Description |
---|---|
OPSANI_OPTIMIZER |
Configures the Opsani optimizer for the servo (required). Format is example.com/app . |
OPSANI_TOKEN |
Configures the Opsani API token for authenticating with the optimizer service (optional). |
Servo connectors support setting values through environment variables for every
attribute of their configuration class. See servo schema
for details.
Path | Description |
---|---|
/servo/servo.yaml |
The servo configuration file (required). |
/servo/opsani.token |
A file containing the Opsani API token for authenticating with the optimizer service (optional). |
To display help:
docker run --rm -i opsani/servox --help
Generating a config file:
docker run --rm -i -v $(pwd):$(pwd) opsani/servox \
generate -f $(pwd)/servo.yaml
Running a servo:
docker run --rm -i -v $(pwd)/servo.yaml:/servo/servo.yaml \
-e OPSANI_OPTIMIZER=example.com/app -e OPSANI_TOKEN=123456 opsani/servox
For full documentation see ServoX on GitHub.
To display help:
kubectl run servo --rm --attach --restart=Never --image="opsani/servox" -- servo --help
Running a servo:
kubectl run servo --rm --attach --restart=Never --image="opsani/servox" -- \
--optimizer example.com/app --token 123456 run
This docker-compose.yaml
file supports the configuration of the Opsani API
token directly from the OPSANI_TOKEN
environment variable or via a file mount
where the source file is configured via the OPSANI_TOKEN_FILE
environment
variable.
version: '3.8'
services:
servo:
image: opsani/servox
restart: always
environment:
- OPSANI_OPTIMIZER=${OPSANI_OPTIMIZER:?Opsani Optimizer must be configured}
- OPSANI_TOKEN=${OPSANI_TOKEN}
volumes:
- type: bind
source: ./servo.yaml
target: /servo/servo.yaml
read_only: true
- type: bind
source: ${OPSANI_TOKEN_FILE:-/dev/null}
target: /servo/opsani.token
read_only: true
Additional connectors can be included into a servo assembly image by using
opsani/servox
as a parent image. The servo image uses the
Poetry package manager for Python and connectors
can be installed through standard package management. The servo uses Python
setuptools entrypoints to auto-discover connectors that are available in the
environment.
FROM opsani/servox
RUN poetry add servo-notifiers
Apache 2.0 - see the LICENSE file for details.