Skip to content

Installing and configuring the Sensor Sim service

The Synthetic Data Generation (SDG) backend runs as a separate Sensor Sim service alongside Foretify Manager. Foretify Manager uses the Sensor Sim service to create and track SDG entities. The services communicate with each other over HTTP.

Prerequisites

Before installing the Sensor Sim service, make sure the following are available:

  • Foretify Manager — A running instance accessible to the Sensor Sim service over HTTP.
  • Postgres database — A dedicated instance or the same instance used by Foretify Manager.
  • Shared storage — An instance accessible by Foretify Manager, the Sensor Sim service, and dispatcher jobs. Supports both S3 and filesystem (NFS).

Run the Sensor Sim service

The Sensor Sim service is distributed as a Docker image. The following example Docker Compose file runs the Sensor Sim API and a dedicated Postgres instance:

version: '3.8'

services:
  psql:
    image: postgres:10-alpine3.16
    container_name: sensorsim-db
    restart: unless-stopped
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U foretellix -d sensorsim"]
      interval: 5s
      timeout: 5s
      retries: 5
    environment:
      - POSTGRES_USER=foretellix
      - POSTGRES_PASSWORD=foretellix
      - POSTGRES_DB=sensorsim
  sensorsim-api:
    image: sensorsim-services:latest
    container_name: sensorsim-api
    restart: unless-stopped
    ports:
      - "8083:8081"
    depends_on:
      psql:
        condition: service_healthy
    volumes:
      - ${CONFIG_ROOT}/sensorsim/config.env:/app/config.env

volumes:
  postgres_data:

This example mounts an external Sensor Sim config file at /app/config.env, overriding the default config file in the image.

Configure the Sensor Sim service

The Sensor Sim service requires a config.env configuration file. Configure the following properties:

Variable Description
PORT Port to listen on for the HTTP service
FMANAGER_URL URL that the service uses to access Foretify Manager
FMANAGER_EXTERNAL_URL User-facing URL where users can access Foretify Manager
JWT_SECRET_KEY Shared secret used for authentication. Must be a 32-byte hex string
JWT_EXPIRY_SECONDS Expiry time for JWT tokens
DATABASE_URL Postgres database URL
SIM_ENVIRONMENTS Comma-separated list of environments to enable, for example: nurec,cosmos

Storage clients

Configure the following storage clients: FRUN, ASSETS, DATASET, RUNS, MAPS. Each client supports either an S3 bucket or a filesystem location. Replace <CLIENT> with each client name:

Variable Description
<CLIENT>_STORAGE_TYPE Storage type — set to s3 or filesystem
<CLIENT>_S3_BUCKET For s3 clients — the target bucket name
<CLIENT>_S3_PREFIX For s3 clients — an optional path prefix in the target bucket
<CLIENT>_FS_BASE_PATH For filesystem clients — the target path

Configure Foretify Manager for Synthetic Data Generation

To enable the Synthetic Data Generation tool in Foretify Manager, update the following settings in the application.properties file:

sensorsim.protocol=http
sensorsim.host=
sensorsim.port=
sensorsim.jwtSecret=
ui-features.sensor-sim.enabled=true

Where protocol, host, and port describe the URL where Foretify Manager can access the Sensor Sim service HTTP API. jwtSecret must match the JWT_SECRET_KEY shared secret configured in the Sensor Sim config.env file.