@fanf fanf released this Feb 13, 2017 · 34 commits to branches/rudder/4.1 since this release

Assets 4

Rudder data sources plugin for Rudder 4.1~beta3 and up

This is a release for Rudder 4.1~beta3 and up of the Rudder data sources plugin.

This plugin allows to automatically fetch external information from third party REST API and use them as node properties. Fetching data can be done periodically and/or on triggers (node accepted, policy generation started).

Documentation

Documentation on data sources can be find here: http://www.rudder-project.org/doc-4.1/node-properties-data-sources.html#node-properties-data-sources

Build

To build that package, you need a working installation of maven (version 3.3.x) and JDK 8 or up.

First, clone the repository and build the plugin:

git clone https://github.com/Normation/rudder-plugin-datasources.git
cd rudder-plugin-datasources
git checkout 4.1-0.2
mvn clean package
.......
  [INFO] Building jar: /home/fanf/java/workspaces/rudder-project/rudder-plugin-datasources/target/datasources-4.1-0.2-plugin-with-own-dependencies.jar

To proceed to installation, you will need that jar and file "src/main/resources/datasource-schema.sql".

Installation

Install the plugin by copying the jar in /opt/rudder/share/rudder-plugins/ on your Rudder root server and the file datasource-schema.sql, then execute:

# Copy the plugin in Rudder plugin directory
scp or whatever datasources-4.1-0.2-plugin-with-own-dependencies.jar into /opt/rudder/share/rudder-plugins/

# create table for Rudder data sources plugin:
# note that if you installed Rudder 4.1~alpha or 4.1~beta1, or a previous version
# of the plugin, you can skip that step (which would fail with a "table exists" error)
psql -U rudder -h localhost -d rudder -f /path/to/datasource-schema.sql

# declare plugin use 
#note: 
# - the plugin must be in /opt/rudder/share/rudder-plugins/
# - the command parameter is the file name without ".jar"
/opt/rudder/bin/rudder-plugin register datasources-4.1-0.2-plugin-with-own-dependencies
Rudder plugin handling utility.
INFO: Plugin found in /opt/rudder/share/rudder-plugins.
INFO: Registering plugin datasources-4.1-0.2-plugin-with-own-dependencies...

# then restart Rudder:
/etc/init.d/rudder-jetty restart

If everything is OK, you will see in Rudder log (/var/log/rudder/webapp/YYYY_MM_DD.stderrout.log) the following INFO line:

[2017-02-01 09:35:21] INFO  application - Initializing plugin 'data sources' [com.normation.plugins.datasources.DataSourcesPluginDef]
[2017-02-01 09:35:21] INFO  application.plugin - loading 'datasources' plugin

You should also see in Rudder administration screen, in the plugin list, data sources plugin and a new menu entry "Data sources".