Running with Docker/Compose
If you just want to try out Horizon, one way of doing so could be to directly run Horizon from Docker. For resiliency reasons, this is obviously not recommended for production usage.
We provide a Docker image that’s entirely configurable through environment variables. All Docker examples require that you login to our Docker repository beforehand :
$ docker login registry.evertrust.io
If you’re looking to try out Horizon’s features, take a look at the EVERTRUST Playground. It is a Docker Compose project bundled with demo values to get you started swiftly. |
Docker Compose example
The simplest way to spin up an Horizon instance is to let Docker Compose manage the required components :
-
the database,
-
the Horizon instance
-
and (optionally) the reverse proxy.
Copy the following docker-compose.yaml
file and tweak it to match your needs :
version: "3.1"
services:
horizon:
image: registry.evertrust.io/horizon:2.5.x
ports:
- "9000:9000"
networks:
- horizon
environment:
LICENSE: MI...
APPLICATION_SECRET: tobechanged
EVENT_SEAL_SECRET: tobechanged
VAULT_TYPE: ssv
VAULT_MASTER_PASSWORD: tobechanged
HOSTS_ALLOWED.0: .
MONGODB_URI: mongodb://mongo:27017/horizon
depends_on:
- mongo
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8558/ready" ]
interval: 10s
timeout: 60s
retries: 10
mongo:
image: mongo:5
restart: always
volumes:
- database:/data/db
networks:
- horizon
volumes:
database: {}
networks:
horizon: {}
You then only need to run the following in the directory where you created the previous file :
$ docker compose up
Horizon should quickly become available on http://localhost:9000
.
Vanilla Docker example
Pull the latest Horizon image:
$ docker pull registry.evertrust.io/horizon:2.5.x
The Horizon Docker image ships with sensible configuration defaults. Most can be configured by injecting environment variables when running the container, like so:
$ docker run \ -e LICENSE="MI…" -e APPLICATION_SECRET="tobechanged" -e EVENT_SEAL_SECRET="tobechanged" -e VAULT_TYPE="ssv" -e VAULT_MASTER_PASSWORD="tobechanged" -e HOSTS_ALLOWED.0="." -e MONGODB_URI="" -p [port]:9000 \ registry.evertrust.io/horizon:2.5.x
Environment variables
General configuration
Variable | Type | Description | Default |
---|---|---|---|
LICENSE |
|
A valid Horizon license string, base64-encoded. Can be used if |
|
LICENSE_PATH |
|
Path where an Horizon license file is mounted inside the container. Can be used if the license is not passed directly through |
|
APPLICATION_SECRET |
|
Application secret used by Horizon |
|
MONGODB_URI |
|
A valid MongoDB URI. See mongo_uri_config. |
|
HOSTS_ALLOWED |
|
Array of hosts. Append the array index after a dot (the nth allowed host variable name would be HOSTS_ALLOWED.n). |
Your license usually contains newline characters, that you must replace by '\n' when setting it through the environment. |
Configure the secrets vault
Variable | Type | Description | Default |
---|---|---|---|
VAULT_TYPE |
|
Vault backend. |
|
VAULT_MASTER_PASSWORD |
|
When using an |
|
VAULT_MODULE_PATH |
|
Used to connect to an HSM. |
|
VAULT_SLOT_ID |
|
Used to connect to an HSM. |
|
VAULT_PIN |
|
Used to connect to an HSM. |
|
VAULT_LABEL |
|
Used to connect to an HSM. |
|
VAULT_ALLOW_MASTER_KEY_GEN |
|
Allow key generation on PKCS#11 devices when no existing is found. |
Configuring HTTPS
In production, it is strongly recommended to ensure all requests go through a layer of encryption. Configuring TLS for Horizon will allow your reverse proxy to request Horizon data using TLS.
If all settings are left empty, Horizon will generate a self-signed certificate upon startup and still expose its HTTPS endpoint on |
Variable | Type | Description | Default |
---|---|---|---|
HTTP_PORT |
|
Port of the HTTP server |
|
HTTPS_PORT |
|
Port of the HTTPS server |
|
HTTPS_KEYSTORE_PATH |
|
Location where the keystore containing a server certificate is located. |
|
HTTPS_KEYSTORE_PASSWORD |
|
Password for the given keystore, if required by the keystore type |
|
HTTPS_KEYSTORE_TYPE |
|
Format in which the keystore is. Can be either |
|
HTTPS_KEYSTORE_ALGORITHM |
|
The key store algorithm |
Platform default algorithm |
Mailer configuration
Variable | Type | Description | Default |
---|---|---|---|
SMTP_HOST |
|
SMTP host |
|
SMTP_PORT |
|
SMTP port |
|
SMTP_SSL |
|
Whether SSL should be used |
|
SMTP_TLS |
|
Whether TLS should be used |
|
SMTP_USER |
|
SMTP user |
|
SMTP_PASSWORD |
|
SMTP password |
Events configuration
Variable | Type | Description | Default |
---|---|---|---|
EVENT_CHAINSIGN |
|
Whether to sign events to verify their integrity |
|
EVENT_TTL |
|
Event time to live in database |
|
EVENT_DISCOVERY_TTL |
|
Discovery events time to live. Can be shorter in case a large number of discovery events are logged. |
Advanced parameters
Variable | Type | Description | Default |
---|---|---|---|
AKKA_ACTOR_SYSTEM |
|
Name of the actor system used by Akka. Useful if you need to run multiple instances of Horizon in the same Kubernetes namespace. |
|
SESSION_MAXAGE |
|
Log in session duration. |
|
HTTP_CERTIFICATE_HEADER |
|
Header name in which the client certificate should be sent when using mTLS. |
Injecting extra configuration
The Docker image comes with a simple enough configuration to get started and test the software. However, it doesn’t include any way to cluster the software with other instances or to edit other specific configurations. If you need to do so, you can mount custom configuration files, giving you full control over how Horizon behaves.
The mounted folder :
-
MUST contain an
akka.conf
file configuring the Akka cluster. See the reference config to get an idea over what’s configurable. -
CAN contain a
application.conf
file containing any extra config options unrelated to clustering.
A typical Docker command would then be :
$ docker run \ -v [configurationPath]:/opt/horizon/etc/:rw \ ... registry.evertrust.io/horizon:2.5.x
Custom startup scripts
Feature available starting from version 2.5.5 |
Sometimes, you’ll want to run scripts each time the container starts up in order to configure files in the container or set environment variables.
To do so, you’ll need to mount shell scripts into the /docker-entrypoint.d/
directory in the container :
$ docker run \ -v [scriptsPath]:/docker-entrypoint.d/ \ ... registry.evertrust.io/horizon:2.5.x
Where scriptsPath
is a directory containing one or multiple shell scripts that will be sourced before running Horizon.