Chapter 1

Installation

Planet Express is comprised of 4 main components:

  • a coordinator backend that serves as the API
  • an (optional) coordinator frontend that provides a frontend UI for the API
  • an (optional) validator endpoint to validate job definitions
  • a runner that may be deployed multiple times to multiple systems

Installing the coordinator

After obtaining a license you should have a license key as well as login credentials for the docker registry.

Use the docker credentials to login at the registry:

docker login gitlab.phantomrausch.de:5050

The following quickstart example should get you going quickly. There are two possibilties to deploy using this template.

The first variant (no changes needed) requires a publicly reachable host that has a domain assigned and does automatic TLS setup using LetsEncrypt. The second variant works by setting certificates manually with a custom CA.

​
services:
  traefik:
    image: traefik:v3.3
    restart: unless-stopped
    # so the hosts ipv6 address works without special docker configuration as well
    network_mode: host
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./traefik.toml:/etc/traefik/traefik.toml
      - traefik-certs:/var/traefik_certs
      # additional needed things for ca variant
      # - ./traefik-tls.toml:/etc/traefik/traefik-tls.toml
      # - ./server.crt:/server.crt
      # - ./server.key:/server.key

  coordinator:
    networks:
      - ingress
      - validator
      - db
    image: gitlab.phantomrausch.de:5050/planet-express/planet-express-coordinator/backend:main
    restart: unless-stopped
    environment:
      DATABASE_URL: "postgres://planetexpress:${POSTGRES_PASSWORD}@postgres/planetexpress"
      ADMIN_KEY: admin-wurst
      VALIDATOR_ENDPOINT: "http://validator:3000/validate"
      KEY_FILE: /run/secrets/key_file
      LICENSE_KEY_FILE: /run/secrets/license_key_file
    secrets:
      - key_file
    depends_on:
      - postgres
    labels:
      traefik.enable: "true"
      traefik.http.routers.coordinator-https.entrypoints: websecure
      traefik.http.routers.coordinator-http.entrypoints: web
      # letsencrypt variant
      traefik.http.routers.coordinator-https.rule: Host(`${EXTERNAL_HOSTNAME}`) && PathPrefix(`/api`)
      traefik.http.routers.coordinator-http.rule: Host(`${EXTERNAL_HOSTNAME}`) && PathPrefix(`/api`)
      traefik.http.routers.coordinator-https.tls.certresolver: letsencrypt
      # ca variant
      # traefik.http.routers.coordinator-https.rule: PathPrefix(`/api`)
      # traefik.http.routers.coordinator-http.rule: PathPrefix(`/api`)
      # traefik.http.routers.coordinator-https.tls: true

  frontend:
    networks:
      - ingress
    image: gitlab.phantomrausch.de:5050/planet-express/planet-express-coordinator/frontend:main
    restart: unless-stopped
    depends_on:
      - coordinator
    labels:
      traefik.enable: "true"
      traefik.http.routers.frontend-https.entrypoints: websecure
      traefik.http.routers.frontend-http.entrypoints: web
      # letsencrypt variant
      traefik.http.routers.frontend-https.rule: Host(`${EXTERNAL_HOSTNAME}`)
      traefik.http.routers.frontend-http.rule: Host(`${EXTERNAL_HOSTNAME}`)
      traefik.http.routers.frontend-https.tls.certresolver: letsencrypt
      # ca variant
      # traefik.http.routers.frontend-https.rule: PathPrefix(`/`)
      # traefik.http.routers.frontend-http.rule: PathPrefix(`/`)
      # traefik.http.routers.frontend-https.tls: true

  validator:
    networks:
      - validator
    image: gitlab.phantomrausch.de:5050/planet-express/planet-express-spec-validator
    restart: unless-stopped

  postgres:
    networks:
      - db
    image: postgres:16
    shm_size: 1gb
    restart: unless-stopped
    environment:
      POSTGRES_USER: planetexpress
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - postgres:/var/lib/postgresql/data

networks:
  ingress:
  db:
  validator:

volumes:
  postgres:
  traefik-certs:

secrets:
  key_file:
    file: ./key_file
  license_key_file:
    file: ./license_key_file

Save it to a new directory called “planet_express_coordinator”. There are a few more files required to make this setup work. Save them all in the same directory:

A secure string that encrypts all secrets managed by the coordinator. May - for example - be generated with openssl rand 64 > key_file

​
aSuperSecretKey

The license:

​
MYLICENSEKEY
​
# CHANGE ALL THE VALUES HERE

# this is the external hostname under which the coordinator may be reached
# may be omitted in CA variant
EXTERNAL_HOSTNAME=my-planet-express.example.com
# this is the password for the database
POSTGRES_PASSWORD=aSuperSecretPasswordForPostgres

Letsencrypt variant

​
[providers]
    [providers.docker]
        exposedByDefault = false
        endpoint = "unix:///var/run/docker.sock"
        # if you change the directory name you need to change this as well
        network = "planet_express_coordinator_ingress"

[entryPoints]
    [entryPoints.web]
        address = ":80"
    [entryPoints.web.http]
        [entryPoints.web.http.redirections]
            [entryPoints.web.http.redirections.entrypoint]
            to = "websecure"
            scheme = "https"

    [entryPoints.websecure]
        address = ":443"

[certificatesResolvers.letsencrypt.acme]
    # CHANGE THIS
    email = "info@example.com"
    storage = "/var/traefik_certs/acme.json"
    [certificatesResolvers.letsencrypt.acme.httpChallenge]
        entryPoint = "web"

The directory planet_express_coordinator should now contain the following files:

docker-compose.yml
key_file
license_key_file
traefik.toml

Installation on a private host with a custom CA

Please review the commands here carefully. There are many more ways to set up your own CA and you may want to do it completely different.

# assuming you are currently in the planet_express_coordinator directory
cd ..
mkdir ca
(cd ca && openssl req -x509 -new -nodes -key planet-express.key -sha256 -subj "/C=DE/CN=my-planet-express-ca" -days 2048 -out planet-express.crt)
# specify a passphrase

Finally create a certificate and a key using your CA. Please adjust at least your SERVER_IP!

cd planet_express_coordinator
openssl req -new -nodes -newkey rsa:4096 -keyout server.key -addext "subjectAltName = IP:SERVER_IP" -subj "/C=DE/CN=SERVER_IP"  -out server.csr
openssl x509 -req -in server.csr -CA ../ca/planet-express.crt -CAkey ../ca/planet-express.key -CAcreateserial -out server.crt -days 730 -sha256 -copy_extensions copyall

Now create the following files in the planet_express_coordinator directory:

​
[providers]
    [providers.docker]
        exposedByDefault = false
        endpoint = "unix:///var/run/docker.sock"
        # if you changed the directory name you need to change this as well
        network = "planet_express_coordinator_ingress"

    [providers.file]
        filename = "/etc/traefik/traefik-tls.toml"

[entryPoints]
    [entryPoints.web]
        address = ":80"
    [entryPoints.web.http]
        [entryPoints.web.http.redirections]
            [entryPoints.web.http.redirections.entrypoint]
            to = "websecure"
            scheme = "https"

    [entryPoints.websecure]
        address = ":443"
​
[[tls.certificates]]
  certFile = "/server.crt"
  keyFile = "/server.key"

The directory planet_express_coordinator should now contain the following files:

docker-compose.yml
key_file
license_key_file
traefik.toml
traefik-tls.toml
server.csr
server.key
server.crt

Start the setup

Now start the setup:

docker compose up -d

After starting up the docker compose setup it should be reachable via its hostname (Letsencrypt variant) or ip (CA variant).

Installation using the binary distribution

in scope?

Installation of the the runner

Obtain a token for phantomrausch’s docker registry from sales and login to the docker registry:

docker login gitlab.phantomrausch.de:5050

The following quickstart example should get you going quickly. The host you install the runner on may be located behind a secure network but it must be able to reach the coordinator API somehow. This template again has the same two variants like the coordinator setup.

​
services:
  runner:
    image: gitlab.phantomrausch.de:5050/planet-express/planet-express-runner:main
    restart: unless-stopped
    volumes:
      - ./work:/work
      - ./state:/state
      - ./job-instance-logs:/job-instance-logs/
      # ca variant. you need to copy the CA certificate to the host that runs the runner
      # - ../ca/planet-express.crt:/ca.crt
    command:
      - planet-express-runner
      - -s
      - /state
      - run
      - --jobs-log-directory
      - /job-instance-logs/
    user: root
    # ca variant
    # environment:
    #   - NODE_EXTRA_CA_CERTS=/ca.crt

  vector:
    image: timberio/vector:0.39.0-alpine
    command: -c /etc/vector/vector.toml
    volumes:
      - ./vector.toml:/etc/vector/vector.toml:ro
      - ./job-instance-logs:/job-instance-logs/

Save it to a new directory. Additionally you need the following file to make log transport work (be sure to adjust the uri below!):

​
[sources.job-instance-logs]
type = "file"
include = ["/job-instance-logs/**/*.log"]

[transforms.parse-json]
inputs = [ "job-instance-logs" ]
type = "remap"
source = '''
. = parse_json!(.message)
'''

[sinks.coordinator]
type = "http"
inputs = [ "parse-json" ]
# set to coordinator URL!
uri = "https://planet-express-coordinator.example.com/api/v1/logs"
encoding = { codec = "json" }
request.headers."x-api-key" = "admin-wurst"

Before starting the setup you first need to register the new runner with the coordinator.

Using the frontend of the coordinator create a new runner. This will create a new Api Key.

Now execute the following in the directory where you placed the runner setup (Letsencrypt variant):

docker run --rm -it -u root -v $(pwd)/state:/state gitlab.phantomrausch.de:5050/planet-express/planet-express-runner:main planet-express-runner -s /state register

CA Variant. Adjust the path to the CA certificate!

docker run --rm -it -u root -v $(pwd)/state:/state -e NODE_EXTRA_CA_CERTS=/ca.crt -v $(pwd)/../ca/planet-express.crt:/ca.crt gitlab.phantomrausch.de:5050/planet-express/planet-express-runner:main planet-express-runner -s /state register

Follow the on screen instructions.

After you registered the runner start the docker setup:

docker compose up -d