Running with Docker/Compose

If you just want to try out Stream, one way of doing so could be to directly run Stream 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 Stream’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 Stream instance is to let Docker Compose manage the required components :

  • the database,

  • the Stream instance

  • and (optionally) the reverse proxy.

The license and keyset should be correctly encoded for consumption as a YAML environment variable:

  • the \n characters in the license should be removed, for instance by cat stream.lic | tr -d '\n'

  • the " characters in the keyset should be escaped, for instance by cat keyset.json | jq -R

Copy the following docker-compose.yaml file and tweak it to match your needs :

version: "3.1"
services:
  stream:
    image: registry.evertrust.io/stream:2.0.x
    ports:
      - "9443:9443"
    networks:
      - stream
    environment:
      LICENSE: MI...
      APPLICATION_SECRET: tobechanged
      EVENT_SEAL_SECRET: tobechanged
      KEYSET: "{\"primaryKeyId\": \"...\"}"
      HOSTS_ALLOWED.0: .
      MONGODB_URI: mongodb://mongo:27017/stream
    depends_on:
      - mongo
    healthcheck:
      test: [ "CMD", "curl", "-f", "http://localhost:7626/ready" ]
      interval: 10s
      timeout: 60s
      retries: 10
  mongo:
    image: mongo:7
    restart: always
    volumes:
      - database:/data/db
    networks:
      - stream
volumes:
  database: {}
networks:
  stream: {}

You then only need to run the following in the directory where you created the previous file :

$ docker compose up

Stream should quickly become available on https://localhost:9443.

A self-signed certificate will be generated at each reboot of Stream

Vanilla Docker example

Pull the latest Stream image:

$ docker pull registry.evertrust.io/stream:2.0.x

The Stream 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 KEYSET="{\"primaryKeyId\": \"...\"}" -e HOSTS_ALLOWED.0="." -e MONGODB_URI="" -p 9443:9443 \ registry.evertrust.io/stream:2.0.x

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 Stream behaves.

The mounted folder :

  • MUST contain an pekko.conf file configuring the Pekko 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/stream/etc/:rw \
   ...
   registry.evertrust.io/stream:2.0.x

Custom startup scripts

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/stream:2.0.x

Where scriptsPath is a directory containing one or multiple shell scripts that will be sourced before running Stream.