Getting started with Rulette server

Set up your rule system(s)

The first step to using Rulette server is to set up your rule systems. As of now, Rulette server only supports rule systems created via the default mysql-data-provider implementation. So please follow the steps described for rule system set up in the SDK section.

Get Rulette Server

Download

Download the latest Rulette server jar from the Downloads page.

Build Locally​​

  1. Clone the rulette serve Github repository.
  2. Build Rulette server : mvn clean package
  3. This will create an executable jar under the target folder with the name rulette-server-{version}.jar
  4. To run the jar file created via package : java -jar target/rulette-server-{version}.jar --spring.config.location={config-file-directory-path} --spring.config.name={config-file-name}​

Download from Docker Hub

Docker images for Rulette server are published on Docker Hub and can be downloaded by running

docker pull kislayverma/rulette-server:0.0.1

The tag should be the same as the version you want to pull.

Building the Docker image locally

  1. Clone the rulette serve Github repository.
  2. Build Rulette server : mvn clean package
  3. Build Docker image : docker build --build-arg JAR_FILE=target/rulette-server-0.0.1.jar -t rulette-server . You should use the correct jar name generated from the maven build process as the JAR_FILE argument.
  4. Run the docker image : docker run -v /absolute-path-to-local/application.yml:/application.yml  -p 8081:8081  rulette-server

We are passing in a application.yml file located at the given path to the docker image. If you are trying to connect to a local MySQL server, you should use host.docker.internal as the MySQL IP address in the application.yml file.

Configure Rulette Server

Rulette server is built using Spring Boot and uses the application.yml/application.properties file based configuration mechanism used by Spring Boot. A sample configuration file is available in  the repository. You can customize the following properties by writing your own file and passing  it to Rulette server on startup.

  1. server.port : Defines the port on which Rulette server will accept REST requests. Default : 8081
  2. Logging level : This is standard Spring Boot  log level configuration. E.g. to set the root logger level to INFO, you can set:

   Logging:

       Level:

           root: INFO

   3. rulesystems : This configuration is used to load rule systems into Rulette server. This is covered in the next section.

Wire rule systems into Rulette Server

We use the “rulesystems” key of the application.yml file to tell Rulette server where to find the configured rule systems and how to load them for serving API calls. The “rulesystems” key has only one child key, the “dataproviders” key which contains a list of Rulette database configurations. Each of the list elements defines a Provider (equivalent of DataProvider in the SDK world) and its configuration is the equivalent of the Rulette configuration file described in the SDK section. You can think of one Provider as one rule_system table – being able to specify multiple providers means that a single Rulette server instance can load rule systems from multiple different sources.

Rulette server performs the exact same things that we had done ourselves to initialize a rule system object using the data provider implementation. For each element of the dataproviders configurations, it instantiates a MySQL data provider, gets the metadata of all configured rule systems from each of the providers, and instantiates all these rule systems. All of these rule systems can now be accessed over the REST API or the UI.

Back to documentation home