Install Java 8, Gradle and Mongo DB.
For linux and OSX, the exact processes are different, but neither is particularly hard.
Mongo DB documentation can be found at: https://docs.mongodb.com/ and https://docs.mongodb.com/manual/
- Java 8 - install this using yum; you may have to use the
'alternatives' tool to set the correct version of Java. E.G.:
- sudo yum install java-1.8.0
- sudo alternatives --config java --> then choose java 1.8.0
- java -version --> to verify
- Gradle - get this from http://gradle.org/gradle-download/. download the code and install unpack/install in a plce like /usr/local. Then set GRADLE_HOME in bashrc (or equiv) to point to /usr/local/gradle- and add $GRADLE_HOME/bin to PATH. Also note that while 'alternatives' is great for most things, you must also set JAVA_HOME as well (and for gradle in particular). I used export JAVA_HOMR=/usr/lib/jvm/java-1.8.0.
- Mongo db - install this using 'yum install mongodb'
- Java 8 - This is already part of the OS
- Gradle - get this from brew and install it using
brew install gradle
You should get gradle 4.x or newer. - Mongo db
brew install mongodb
This code uses Gradle, Spring Boot (1.5.7), and lombok. It's easiest to set up your IDE so that these things are all configured. See the reporter documentation for information on that configuration. For IDEA, only lombok needs to be added; for Eclipse use the Eclipse Marketpalce to add the Spring STS and Gradle Buildship plugins.
To configure the collector web application, you should set up the application.properties (in src/main/resources/) file with the correct data:
mongo.db.name=harvester
mongo.db.server=localhost
server.port=8081
...
and then run the 'bootRun' command in the root project folder
$ gradle bootRun
It is better to run the application in a separate terminal using nohup. To do this:
$ nohup gradle bootRun &
$ press any key if you want to store logs in nohup.out
The application will be started at server.port.
-
For installing Collector on Tomcat server
- clone repo from github
- build using
./gradlew war
- copy war file to tomcat/webapps
- start tomcat
-
For installing Reporter on Tomcat server
- clone repo from github
- create /etc/olfs directory
- copy olfx_example.xml from reporter repo to /etc/olfs directory
- rename olfx_example.xml to olfs.xml - change in olfs.xml - ServerUrl - url of hyrax server - ReporterUrl - url of reporter - logNumber - number of log lines to pull - DefaultPing - time delay between pulls - HyraxLogfilePath - path to servers log file
- build using
./gradlew war
- copy war file to tomcat/webapps
- start tomcat
All API methods:
-
GET /healthcheck - returns a string with the application version
-
GET /harvester/registration? serverUrl=http://xxx & ping=7 & log=100 - Register a new HyraxInstance. Check for that the server responds, check the Reporter path and set up the ping and log-lines parameters. If the Hyrax instance had been already registered, add new record and make all previous records inactive. Returns created db record.
-
GET /harvester/registration? serverUrl=http://xxx & reporterUrl=http://xxx & ping=7 & log=100 - Same as previous call, but configure a custom reporterUrl..
-
GET /harvester/allHyraxInstances - returns a list of all active registered hyrax instances
-
GET /harvester/allHyraxInstances?onlyActive=false - returns a list of all active and inactive registered hyrax instances.
-
GET /harvester/logLines? hyraxInstanceName=http://xxx - returns a list of all the log lines harvestered from a specific Hyrax instance
-
GET /harvester/logLines/string? hyraxInstanceName=http://xxx - returns a string representation of the list of all log lines harvestered from a specific Hyrax instance