Configuration

Overview

Configuration files are optional for Baratine. By default, Baratine will listen to port 8085 for HTTP requests. Server configuration is generally only needed for Clustering and for SSL. Pod configuration is generally needed for clustering to assign servers to pods.

Configuration:

  • baratine.cf - server configuration file
  • WEB-INF/baratine.cf - servlet web-app client configuration
  • bfs:///config/pods/my-pod.cf - pod configuration

baratine.cf

The baratine.cf configures seed servers and the default server port.

It can also configure pods, although it’s recommended to use BFS for Pod configuration instead.

Seed Server Configuration

baratine.cf:

cluster {
  server 10.0.0.1 8085;
  server 10.0.0.2 8085;
  server 10.0.0.3 8085;
  server 8085;
}

A Baratine server is started using –conf for the config file:

$ baratine start --conf baratine.cf

SSL Configuration

baratine.cf:

cluster {
  server-default {
    openssl {
      certificate-file "file:keys/my-cert.crt";
      certificate-key-file "file:keys/my-cert.key";
      password "my-password";
    }
  }

  server 10.0.0.1 8085;
  server 10.0.0.2 8085;
  server 10.0.0.3 8085;
  server 8085;
}

Pod Configuration

Pods can be configured by assigning servers to the pod. Because all servers in the “pod” are automatically seed servers, it’s not necessary to add them into the cluster context as well.

baratine.cf:

cluster {
  server 8085;

  pod my-pod type="triad" {
    server 10.0.0.1 8085;
    server 10.0.0.2 8085;
    server 10.0.0.3 8085;
  }
}

WEB-INF/baratine.cf

In a servlet web-app the WEB-INF/baratine.cf configures Baratine as a client when the web-app uses backend Baratine services. The syntax is the same as a server baratine.cf

The default port should be distinct from 8085 when a Baratine server is on the same machine as the servlet engine.

WEB-INF/baratine.cf:

cluster {
  server 10.0.0.1 8085;
  server 10.0.0.2 8085;
  server 10.0.0.3 8085;
  server 8084;
}

bfs:///config/pods

Pod configuration is in BFS, the Baratine Filesystem, because BFS is dynamic and distributed across all servers.

The pod configuration files in /config/pods are sorted by name and then parsed as one long pod file. The reason for the “50-pod.cf” convention is to allow files to specify their order by their name.

A pod configuration to assign servers looks like the following.

/config/pods/00-my-pod.cf:

pod my-pod type="pair" {
  server 10.0.0.1 8085;
  server 10.0.0.2 8085;
}

Pod configuration can be uploaded with the put command.

$ baratine put 00-my-pod.cf /config/pods/00-my-pod.cf

A .bar file can also include configuration in its META-INF directory.

META-INF/baratine/config/pods/00-my-pod.cf:

pod my-pod type="pair" {
  archive "/usr/lib/pods/my-pod.bar";

  server 10.0.0.1 8085;
  server 10.0.0.2 8085;
}

The archive configuration specifies the BFS location of the deployed bar file. By default, it’s placed in /usr/lib/pods.

Configuration Tags

archive

Archive specifies the location in BFS of a deployed .bar or .jar file in a pod. The default location is bfs:///usr/lib/pods/pod-name.bar.

/config/pods/00-my-pod.cf:

pod my-pod {
  archive "/usr/lib/pods/my-pod.bar";
}

cluster

Cluster contains all servers and pods for a Baratine cluster.

baratine.cf:

cluster {
  server 8085;
  server 10.0.0.1 8085;

  pod my-pod type="triad";
}

openssl

Configures a server with an openssl port.

baratine.cf:

cluster {
  server-default {
    openssl {
      certificate-file "file:keys/my-cert.crt";
      certificate-key-file "file:keys/my-cert.key";
      password "my-password";
    }
  }

  server 10.0.0.1 8085;
  server 8085;
}

pod

Pod configures a Pod, which is a virtual cluster where applications are deployed to. Pods a composed of servers, deployed .jar files and static files.

Pods can be configured in the static baratine.cf used for the start command, or in the BFS /config/pods directory for dynamic configuration.

baratine.cf:

cluster {
  server 8085;

  pod my-pod type="pair" {
    server 10.0.0.1 8085;
    server 10.0.0.2 8085;
  }

pod type

The pod type can be one of the following:

  • solo - single active server with backups
  • pair - two active servers splitting addresses
  • triad - three active servers splitting addresses
  • cluster - several active servers splitting addresses

The addresses are split by hashing. In a triad pod, “/auction/12” might go to server 1, “/auction/13” to server 2, and “/auction/14” to server 3.

server

Server configures either a Seed Servers, a pod server assignment, or the default port for a dynamic server.

Servers are either in the cluster for seed servers, or pod for pod assignment.

baratine.cf:

cluster {
  server 10.0.0.1 8085;
  server 8085;
}