TourOptimizer REST Server (JOpt.TourOptimizer)
Deploy and operate JOpt.TourOptimizer as a reactive Spring WebFlux service (OpenAPI/Swagger)
This page documents the server-side of JOpt.TourOptimizer: a reactive Spring WebFlux application that exposes the optimizer via REST + OpenAPI (Swagger UI).
Overview
- Helpful links
- Why WebFlux + reactive is a great fit
- Swagger / OpenAPI
- Run locally and on platforms
- Fire & Forget / Database Mode
- Configuration overview
Helful links:
- Docker image: https://hub.docker.com/r/dnaevolutions/jopt_touroptimizer
- REST-Client documentation: /docs/learn-and-explore/rest/rest_client_touroptimizer
- Sandboxes: /docs/learn-and-explore/feature-guides/jopt-sandboxes
- Fire & Forget/ Database Mode: /docs/learn-and-explore/rest/touroptimizer-faf
Why WebFlux + reactive is a great fit
Optimization services are typically used in bursty, concurrent scenarios (batch planning, interactive UI runs, multiple teams, CI regression). The TourOptimizer REST server uses Spring WebFlux and reactive patterns to:
- keep the HTTP layer non-blocking (avoid thread starvation under load),
- support high concurrency for status/progress polling and long-running runs,
- integrate naturally with reactive event streams coming from the Java core (progress, warnings, errors).
The optimizer itself is compute-heavy, but WebFlux keeps the service layer scalable and responsive in real platform environments.
Swagger / OpenAPI
Swagger Endpoint UI
The Swagger/OpenAPI schema is derived from the snapshot model inside the Java library via annotations. This ensures that:
- the REST contract matches the SDK snapshot definition,
- generated clients stay aligned with the server,
- snapshots remain reproducible across environments.
Run locally (Docker)
docker run -d --rm --name jopt-touroptimizer \
-p 8081:8081 \
-e SPRING_PROFILES_ACTIVE=cors \
dnaevolutions/jopt_touroptimizer:latest
- Swagger UI (typical):
http://localhost:8081/swagger-ui/index.html - OpenAPI JSON (typical):
http://localhost:8081/v3/api-docs
If your REST client runs inside a Docker-based sandbox container, use
http://host.docker.internal:8081instead ofhttp://localhost:8081.
Please also read our containter deployment help:
- JOpt TourOptimizer on Linux
- Docker Installation (Windows)
- JOpt TourOptimizer on Windows Platforms
- JOpt TourOptimizer on Apple Platforms (macOS)
- JOpt TourOptimizer on Kubernetes
- JOpt TourOptimizer – Enterprise Deployment with Terraform
Fire-and-forget mode
This page will describe asynchronous job submission patterns, polling, and optional persistence.
- Fire & Forget/ Database Mode: /docs/learn-and-explore/rest/touroptimizer-faf
Configuration overview
This section lists the configurable properties and groups them into:
- DNA/JOpt keys (product-specific behavior),
- Spring keys (standard Spring Boot / WebFlux / springdoc / actuator).
DNA / JOpt properties
| Property | Default | Purpose / Notes |
|---|---|---|
touroptimizer.debug.active | ${DNA_IS_DEBUG:false} | Enables/disables debug mode |
touroptimizer.elementslimit.active | ${DNA_HAS_ELEMENT_LIMITS:false} | This will basically allow to keep our swagger endpoint open without the danger that any customer will overutilize the endpoint |
touroptimizer.elementslimit.count | ${DNA_ELEMENT_LIMITS_COUNT:100} | Only takes action if touroptimizer.elementslimit.active == true |
touroptimizer.security.database-clean-rate-seconds | ${DNA_DATABASE_CLEAN_SECONDS:7200} | Checking for expired objects in the databse |
touroptimizer.security.database-download-enabled | ${DNA_DATABASE_DOWNLOAD_ACTIVE:true} | Enable/disable auto-clean behaviour |
touroptimizer.security.database-enabled | ${DNA_DATABASE_ACTIVE:true} | Optional mongo / database is enabled/disabled |
touroptimizer.security.default-lic | ${DNA_DEFAULT_LIC:} | Default fallback JSON license |
touroptimizer.security.password | ${DNA_USER:jopt} | Login to swagger endpoint |
touroptimizer.security.plugins-enabled | ${DNA_PLUGINS_ACTIVE:true} | Enable/disable Plugins |
touroptimizer.security.protection-enabled | ${DNA_SECURITY_ENABLED:false} | Password protection enable /disable |
touroptimizer.security.server-url | ${DNA_SERVER_URL:/} | For defining the server url |
touroptimizer.security.user | ${DNA_USER:dna} | Security |
touroptimizer.security.whitelistips | ${DNA_IP_WHITELIST:} | EXAMPLE touroptimizer.security.whitelistips = ${DNA_IP_WHITELIST:127.0.0.1,0:0:0:0:0:0:0:1,192.168.1.1} |
Spring / WebFlux / springdoc properties
| Property | Default | Purpose / Notes |
|---|---|---|
server.compression.enabled | true | Compression settings Enable response compression |
server.compression.mime-types | text/html, text/xml, text/plain, text/css, text/javascript, application/javascript, application/json | The comma-separated list of mime types that should be compressed |
server.compression.min-response-size | 1024 | Compress the response only if the response size is at least 1KB |
server.error.include-message | always | For telling the reason/message |
server.forward-headers-strategy | framework | Since spring-boot 2.2, there is a new property to handle reverse proxy headers: |
server.http2.enabled | true | Enable HTTP/2 support, if the current environment supports it |
server.port | 8081 | Internal server port |
spring.banner.location | classpath:/banner/touroptimizerbanner.txt | springdoc.api-docs.groups.enabled=true Markup Using FIGlet Font BIG for banner |
spring.data.mongodb.database | ${DNA_DATABASE_DB:touroptimizer} | Missing database will be autocreated |
spring.data.mongodb.uri | ${DNA_DATABASE_URI:mongodb://dnauser:dnapwd@localhost:27017/admin} | spring.data.mongodb.uri="mongodb://mongo1:27017,mongo2:27018,mongo3:27019/?replicaSet=rs0" |
spring.http.codecs.max-in-memory-size | 250MB | Spring framework configuration. |
spring.servlet.multipart.enabled | true | MULTIPART (MultipartProperties) Enable multipart uploads |
spring.servlet.multipart.file-size-threshold | 2KB | Threshold after which files are written to disk. |
spring.servlet.multipart.max-file-size | 200MB | Max file size. |
spring.servlet.multipart.max-request-size | 215MB | Max Request Size |
springdoc.api-docs.enabled | true | Tests for custom url |
springdoc.api-docs.path | ${DNA_API_DOCS_PATH:/v3/api-docs} | OpenAPI / Swagger configuration. |
springdoc.api-docs.version | OPENAPI_3_0 | OpenAPI / Swagger configuration. |
springdoc.show-actuator | false | Endpoint reprsentation related |
springdoc.swagger-ui.config-url | ${DNA_UI_CONFIG_URL:/v3/api-docs/swagger-config} | OpenAPI / Swagger configuration. |
springdoc.swagger-ui.disable-swagger-default-url | true | OpenAPI / Swagger configuration. |
springdoc.swagger-ui.urls[0].name | ALL | OpenAPI / Swagger configuration. |
springdoc.swagger-ui.urls[0].url | ${DNA_UI_URL:/v3/api-docs} | OpenAPI / Swagger configuration. |
springdoc.webjars.prefix | ${DNA_WEBJARS_PREFIX:/webjars} | OpenAPI / Swagger configuration. |
springdoc.writer-with-default-pretty-printer | true | OpenAPI / Swagger configuration. |
Container / runtime environment variables
| Variable | Default | Purpose / Notes |
|---|---|---|
SPRING_PROFILES_ACTIVE | (none) | Selects Spring profile(s), e.g. cors to enable browser-friendly CORS settings. |
JAVA_TOOL_OPTIONS | (none) | JVM flags for the container (memory, GC, diagnostics). Recommended for production tuning. |
Spring supports environment-variable mapping for many properties (e.g.,
SERVER_PORTcan overrideserver.port) depending on your deployment conventions.
References
- DockerHub: https://hub.docker.com/r/dnaevolutions/jopt_touroptimizer
- Self-hosting repo: https://github.com/DNA-Evolutions/Docker-REST-TourOptimizer