Awesome
Frontrunner
Frontrunner is a daemon which triggers a reconfiguration of HAProxy, when an application is modified on Marathon.
It uses node-zookeeper-client to connect to the ZooKeeper cluster used by Marathon and detect changes.
Requirements
* node.js 0.10+
Installation
git clone https://github.com/Wizcorp/frontrunner.git
To install dependencies, run the following command in the created directory:
npm install --production
If you don't plan to use yaml config files, you can use the following:
npm install --production --no-optional
Configuration
Frontrunner use node-config to manage its configuration files. You can write your configuration files in JavaScript, JSON or YAML.
A default configuration file is provided. It shouldn't be edited.
It contains the following options:
zookeeper.connectionString
: Comma separated host:port pairs, each represents a ZooKeeper server.marathon
: Marathon configuration.url
: Marathon API url used to get the tasks.retryDelay
: Delay between two attemps to get the tasks from the Marathon API, if the first request fails.
activeProxy
: The name of the proxy to use.proxy
: Configuration objects for the supported proxies. Each object is as follows:templatePath
: Path to the proxy config generator.configFile
: Path to the proxy config file.reloadCommand
: Command to run to reload the proxy.reloadDelay
: The minimal time interval between two reload.
To override some values, you have to create a new file with your environment name.
# config/production.yml
zookeeper:
connectionString: "192.168.1.1:2181,192.168.1.2:2181,192.168.1.3:2181"
marathon:
url: "http://192.168.1.1:8080"
proxy:
haproxy:
templatePath: "haproxy_custom.cfg"
reloadCommand: "service haproxy reload"
Usage
To run Frontrunner in the production environment and use the config file, you've just created, run the following:
NODE_ENV=production npm start