Docker Technologies Integration

 

Installation of DHuS from source distribution using Docker (DHuS v. 1.0)

Short guide for downloading the DHuS source distribution, compiling the application, install and execute it, using the Docker and Docker-compose S/W.

1.Prerequisites

The following are the prerequisites for the Unix system where the DHuS will be installed:

• Connection to Internet;

• Docker and docker-compose S/W already installed. Please refer to the official Docker documentation at https://docs.docker.com/ for the Docker and Docker-Compose installation requisites and installation instructions for the different Operating Systems.

•Creation of user and group “dhus” with UID 10125 and GID 10125. If a user/group dhus is already existing on the host with different UID/GID, another name can be used. The user must be also added to the group docker (created as part of the docker s/w installation).

2. Installation and execution

Using the dhus account (or the other name assigned to UID 10125):

STEP1:In a directory of your choice, create the working directory for the application Docker_Dhus:

mkdir /home/dhus/Docker_Dhus

cd /home/dhus/Docker_Dhus

The rest of commands below must be run from inside the Docker_Dhus directory:

STEP 2:In the directory Docker_Dhus, extract the content of the file Docker_Dhus_files_for_source_code-1.0.tar :

tar xvf Docker_Dhus_files_for_source_code.tar

STEP 3:Download the Docker Dhus build environment from the Docker Hub and build the local image:

docker-compose build

STEP 4:Clone the DHuS source distribution from the github:

docker-compose run dhus clone

STEP 5:From the cloned DHuS source distribution build the application:

docker-compose run dhus build

STEP 6:Install the builded DHuS:

docker-compose run dhus install

STEP 7:Start the installed DHuS:

docker-compose run --service-ports dhus execute &

The server will be accessible at: http://localhost:8081

Note: In case the local port 8081 is being used by another application on the host, modify the docker-compose.yml file distributed with the tar:

From: “8081:8081”

To: “<your chosen port>: 8081”

Start the DHuS again.

3. DHuS stop

To stop the DHuS properly, execute the stop.sh script internally to the container:

STEP 1: Verify the name of the running docker container executing the DHuS:

docker ps -a

STEP 2: Stop the DHuS:

docker exec <container ID> /usr/shared/DHUS/stop.sh

Example:

$ docker ps -a:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
 89060bd12a31   dockerdhus_dhus        "make execute"          3 minutes ago         Up 3 minutes             0.0.0.0:8081->8081/tcp       dockerdhus_dhus_run_6 
 127d7b2b81f3   dockerdhus_dhus           "make execute"         7 minutes ago        Exited (0) 5 minutes ago                                           dockerdhus_dhus_run_5
3325e95b078f dockerdhus_dhus          "make execute"         41 minutes ago               Exited (0) 7 minutes ago                                           dockerdhus_dhus_run_4

$ docker exec 89060bd12a31/usr/shared/DHUS/stop.sh

4. DHuS Customization

When started the first time, the DHuS runs with some defaults value and parameters in the following configuration files:

• Dhus.xml

- Parameter varFolder set to "/usr/shared/DHUS/local_dhus"

-Parameter workingDir set to “/usr/shared/DHUS/local_dhus/working_dir”

-Parameter executor_enabled set to “true

-Section dataStore commented out

-Default for all the rest

Note: the /usr/shared directory is relative to the Docker image built previously, and it is mapped to the /home/dhus/Docker_Dhus directory created during the installation phase.

• Log4j2.xml

-log file name set to “/usr/shared/DHUS/local_dhus/logs/dhus.log”, with file rotation every day saved to <filename-yyyy-MM-dd> 

-Default for all the rest

Note: the /usr/shared directory is relative to the Docker image built previously, and it is mapped to the /home/dhus/Docker_Dhus directory created during the installation phase.

• start.sh

-Memory parameters set to -Xms2g and -Xmx2g, instead of -Xms12g and -Xmx12g

-Default for all the rest

• Server.xml

-Default for all

If a customization is required, modify the basic configuration files in the /home/Dhus/Docker_Dhus directory as needed, following the instructions in the “DHuS Administration Manual” available at: http://sentineldatahub.github.io/DataHubSystem/documents/DHuS%20Administration%20Manual.pdf

To change the configuration:

• Verify the ID of the running docker container executing the DHuS and stop it:

docker ps -a

docker exec <container ID>/usr/shared/DHUS/stop.sh

cd /home/dhus/Docker_Dhus

• Customize the configuration files as needed

• Install the changed configuration files:

docker-compose run dhus reconfig

• Restart the DHuS with the new configuration:

docker-compose run --service-ports dhus execute &

5. DHuS Development

When building and installing the DHuS application in the Installation chapter the DHuS is built with the provided source code. If you want to develop the application with your own changes, please perform the following steps:

• Verify the ID of the running docker container executing the DHuS and stop it:

docker ps -a

docker exec <container ID> /usr/shared/DHUS/stop.sh

•Go to the Source code directory:

cd /home/dhus/Docker_Dhus/dhus-distribution/Sources

•In one or more of the source code subdirectories, modify the code as desired:

•When finished to change the source code, rebuild the package(s) just modified:

docker-compose run dhus rebuild_<dir_of_the_package_modified>

Eg:

docker-compose run dhus rebuild_dhus-core

• Rebuild the complete distribution and reinstall it:

docker-compose run dhus rebuild

docker-compose run dhus reinstall

• Restart the modified DHuS:

docker-compose run --service-ports dhus execute &

Note: The local maven repository is located in the /home/dhus/Docker_Dhus/.m2 directory