Navigate to Docker Hub, to find the latest available build. Assuming docker is already installed, use the following the command to pull the image
docker pull sroyc/rest-exchange
Rest exchange uses a properties file which must be supplied externally, in order it to boot. Let us first go through all possible settings.
| Property Name | Purpose | Is Mandatory | Possible Values |
| server.port | The port to listen to | N | Any valid port (integer), default 8080 |
| db.postgres.host | Hostname of postgresql | Y | IPV4/localhost |
| db.postgres.port | Port of postgresql | Y | integer |
| db.postgres.username | Username of the postgresql database | Y | string |
| db.postgres.password | Passowrd of the postgresql database | Y | integer |
| db.postgres.database | Database name or instance name | Y | rest-exchnage |
| spring.http.codecs.max-in-memory-size | Max memory size for buffering streaming bytes | N | 20MB default |
| rex.security.master-key | The encryption key for the application | Y | See details |
| rex.groovy.sandbox-enabled | Limit groovy function execution with safety net. | N | default to true |
| rex.execution.heartbeat-interval-minutes | Check every ‘x’ minutes for any stale execution | N | Integer, default 7 |
| rex.execution.stale-threshold-minutes | Max minutes before marking the execution as stale. No heartbeat for this long and another node may take the execution over. | N | Integer, default 15 |
| rex.execution.tracking-enabled | Enable or disable workflow execution tracking | N | boolean, default true |
| rex.scheduler.poll-interval-ms | Execute the poller for all scheduled workflow. This property decides granularity of how accurate the scheduler needs to be. Unit in milliseconds. Default value of 60,000 milliseconds means it can't be accurate to seconds and only accurate to minutes. | N | long, default 60000 |
The properties leading with db.postgres.* are all mandatory and must be provided during the startup.
The property spring.http.codecs.max-in-memory-size controls the maximum amount of memory that can be used to buffer the streaming bytes. This is expecially handy when your downstream processors are slower than the upstream and you need to buffer. The application does not support large data, as it persists the data in between two api calls. Read further to know more.
The property rex.security.master-key is the encryption key and is a required field. This value will be used by the application to encrypt and decrypt sensitive information in database RW. Use the scripts (/generate-master-key.ps1 or /generate-master-key.sh) to generate a random key for your instance.
The property rex.groovy.sandbox-enabled is to limit groovy scripts execution. Enforces an allow-list (via groovy-sandbox) on workflow functions, blocking file/network I/O, process execution, env/system access, and reflection. By defualt it is enabled, disable it when the environment and user is fully trustable.
The property rex.execution.* controls execution tracking/crash-resume leases and applied to every execution manual (On Demand) or scheduled.
heartbeat-interval-minutes → Polling interval to identifying stale processes.
stale-threshold-minutes → Minutes elapsed since last heartbeat to mark it as stale
tracking-enabled → Enable or disable execution tracking.
The property rex.scheduler.* provides certain minimal configuration around how the scheduling work within the system.
poll-interval-ms → drives both the due-schedule check and the stale-execution reclaim scan, and is therefore also the trigger granularity. A schedule fires within one tick after its target time.
pool.size → Number of threads that can be allocated for scheduling work.Default value is 2.
Prerequisite : The PostgreSql database is up and running with the database instance created.
The docker image requires certain basic configuration to boot. Consider the following settings where a minimal setup has been configured :
spring.application.name=RestX
server.port=9191
# server admin
rex.admin.username=restx
rex.admin.password=restx
#Database Configuration
db.postgres.host=host.docker.internal
db.postgres.port=5432
db.postgres.username=postgres
db.postgres.password=postgres
db.postgres.database=rexdb
spring.http.codecs.max-in-memory-size=20MB
# AES Encryption master key
rex.security.master-key=5KvIbiSNcL0Hq4ggc0tRmndyj7nsm3U2plIIlT7R4+A=
This is a base configuration that is required to start the application. We can directly call docker run as follows with the above
docker run -d --name rest-exchange --network rex-net -p 9191:9191 \
-e REX_CONFIG_LOCATION=<path to the property> \
-e LOG_PATH=<path where log files will be created>
sroyc/rest-exchange:latest
Or we can use the following docker compose
services:
rest-exchange:
image: sroyc/rest-exchange:latest
container_name: rex-1.0.0-beta.1
ports:
- "9191:9191"
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ./config:/app/config
- ./logs:/app/logs
environment:
REX_CONFIG_LOCATION: file:/app/config/rest-exchange.properties
LOG_PATH: /app/logs
As your docker instance boots up, you can hit the rest exchange URL, in our case it is http://localhost:9191/. The license page will appear.
Rest-Exchange is a commercial product and hence required license to activate. Navigate to SROYC Portal E-Commerce site, and you can get your license for the specific version. The licenses are based on major version of the product and same license key will not work with a different major version.
Enter the license key and you are all set.