Building the gateway (from cmd-line)
In order to build the gateway (and its auxiliary libraries) you need to have in your build system installed and configured:
- JDK 1.8+
- Apache Maven (3.0.3+)
The easiest way to check if JDK is already installed (and correctly configured) in your system is to open a console (linux) or a cmd prompt (windows) and type:
javac -version
which - if JDK is correctly configured (i.e. installed + JAVA_HOME env. variable set + JAVA_HOME/bin in the Path ) should print out something like:
javac 1.8.0_121
Unless you see such an output your JDK is not correctly configured. Please install and configure JDK before continuing.
Similarly, for maven, type:
mvn -version
If maven is correctly configured (i.e installed + M2_HOME env. variable set + M2_HOME/bin in the Path) it should result with something like:
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 04:15:2+0200)
Maven home: C:\maven\apache-maven-3.0.3
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8\jre
Unless you see such an output, Apache Maven is not correctly configured. Please refer to downloading and installing Maven before continuing.
OK, so JDK and Maven are there, time to build the gateway. Since ogn-gatway-java depends on ogn-commons-java and ogn-client-java you need to build all three modules in the following order:
All you need to do is:
1. Checkout each of the modules from OGN github
2. For modules 1) and 2) : enter their root folder and type:
mvn install
This will build, test and install artifacts 1) and 2) into maven local repository.
3. Enter root folder of ogn-gateway-java module and type:
mvn package
This will build, test and produce a deployable tar.gz with all the gateway needs inside the target folder. Voila! The gateway is ready for deployment!
building a docker image
Optional
If you have docker installed on your machine and wish to build and register a ogn-gateway-java docker image in your local registry, call:
mvn -P docker clean install
Deploying the gateway (on a linux system)
1. Use SCP/FTP (or whichever tool you like) to copy over the ong-gateway's tar.gz to the host where the gateway is supposed to run.
2. untar the tar.gz (tar -zxf) to the destination location ( e.g. ~/ogn/ogn-gateway )
3. enter the ogn-gateway/conf subfolder and create two files inside: jmxremote.access and jmxremote.passwd. Make sure they have limited access rights! ( chmod 600 ) (won't work otherwise!)
Explanation: these two files contain usernames and credentials for remote access via JMX. Therefore they cannot be part of the deployable tar.gz and need to be created manually (or -even better - kept locally somewhere in the local filesystem and copied over to the ogn-gateway/conf right after untarring the tar.gz )
The content of the files should be following:
jmxremote.access :
ognjmx readonly
ognadm readwrite
jmxremote.passwd :
ognjmx the-password-you-want-to-set-for-this-user
ognadm the-password-you-want-to-set-for-this-user
Remember to "chmod 600" the two files ;-)
Launching the gateway
Prerequirements:
- the gateway needs JRE 1.8+ to be installed on the machine where it is supposed to run
- export OGN_HOME env. variable setting the location of all OGN modules. Preferably put the export it into your .bashrc Note: Unless set the startup script will take the default value i.e. ~/ogn
Start the gateway using the ogn-gateway-sh script you will find inside the gateway's root folder. There are following options:
[ognuser@ognhost ogn-gateway]$ ./ogn-gateway.sh
*****************************************************************************
usage:
./ogn-gateway.sh start|stop|restart|status
*****************************************************************************
The structure of the gateway once deployed
Once unpacked the gateway presents a following structure:
[ognuser@ognhost ogn-gateway]$ ls -1
conf
lib
log
ogn-gateway.sh
plugins
tmp
version.txt
- conf
The configuration folder. It contains the gateway.properties configuration file , logging configuration file (log4j.xml ) + JMX remote access credential files (jmxremote.access, jmxremote.passwd)
- lib
Contains all libraries required by the gateway to work (ogn stuff + 3rd parties)
- log
The folder where the log files are stored
- plugins
The container folder for the OGN gateway's forwarding plugins (e.g plugin for FR24, plugin for live.glidernet.org,…)
- tmp
Tmp folder, e.g. for storring the pid lock file
- version.txt
Contains the gateway's version number as defined in the project's pom.xml, e.g: 1.0.0-SNAPSHOT