Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Sv translation
languageen

Mount the Share

The system must have access to the share on acd-store.

Checkout JREST Repository

On acd-store execute the following commands to checkout the repository:

Code Block
su jtel
cd /srv/jtel/shared
git clone https://bitbucket.org/jtelgmbh/jtel-system-java-services.git

Installation - on Linux Server

To install the REST role on a Linux server, proceed as follows on the acd-rest server.

Java

12

17

Install java 12 17 as follows:

Code Block
cd /home/jtel
wget https://cdn.jtel.de/downloads/java/openjdk-12.0.2_linux-x64_bin.tar.gz
tar xvfz openjdk-12.0.2_linux-x64_bin.tar.gz
rm -f openjdk-12.0.2_linux-x64_bin.tar.gz
chown -R jtel:jtel jdk-12.0.2apt-get -y install openjdk-17-jdk

jrest

Install jrest as follows:

Code Block
cd /home/jtel
cp -r /home/jtel/shared/jtel-system-java-services/deploy/jrest jrest
mkdir /home/jtel/jrest/log
chown -R jtel:jtel jrest
cp jrest/systemd/jrest.service /etc/systemd/system
chmod +x /home/jtel/jrest/systemd/jrest
systemctl daemon-reload
systemctl enable jrest.service

Configuration

Edit the configuration file /home/jtel/jrest/config/jtel-jrest.xml and check database access passwords and hosts etc. are correct.

Note: the serverID must be unique on each connector:

Warning

<serverID>2001</serverID>


Edit the startup file /home/jtel/jrest/systemd/jrest and check the java directory is correct (the correct java version).

Edit the logging configuration file /home/jtel/jrest/config/log4j2.xml and make sure it points to the required logging directory.

Firewall

Open the firewall port 8091 as follows:

CentOS:

Code Block
firewall-cmd --zone=public --add-port=8091/tcp --permanent
firewall-cmd --reload


Debian:

Code Block
ufw allow 8091/tcp

Debian for systems with only internal access via eth1:

Code Block
ufw allow in on eth1 to any port 8091 proto tcp

Start Service

Start the service. 

Code Block
systemctl start jrest.service

Installation - on Windows Server

To install the REST role on the windows server, proceed as follows.

Java 12

Download java 12 from here:

https://cdn.jtel.de/downloads/java/openjdk-12.0.2_windows-x64_bin.zip

Unpack this to the following directory:

Code Block
c:\Apps\

This should result in the following directory structure being created:


Code Block
C:\Apps\openjdk-12.0.2_windows-x64_bin\jdk-12.0.2\bin 


Warning

Note, if you do not use the paths specified above, you may have to change the configuration considerably.

Copy Files and Install

On the windows server, execute the following commands in a non-elevated command prompt:

Code Block
c:
md \jrest
xcopy /E \\acd-store\shared\jtel-system-java-services\deploy\jrest C:\jrest

Configuration

Edit the configuration file, and make sure the database access (username and password) is correct:

Code Block
C:\jrest\config\jtel-jrest.xml

Shortcut

Create a shortcut for start-jrest.cmd and put this into shell:startup

Configure Load-Balancer

It is best to send the requests for the REST API to the load balancer. To make this possible, the following needs to be added to the load balancer configuration.

Frontend http / https

Depending on the protocol used, either http or https may be configured. In the relevant front-end the following should be added:

Code Block
# ADD THIS WHERE THE acls are:
        acl rest_req    url_reg ^\/rest\/v1.0

# ADD THIS WHERE THE use_backend directives are:
        use_backend     jtel_rest   if rest_req

# ADD THIS AT THE BOTTOM:

#---------------------------------------------------------------------
# this backend provides access to the REST API
#---------------------------------------------------------------------
backend jtel_rest
        mode            http
        compression     algo gzip
        compression     type text/xml text/html text/plain text/css text/javascript
        balance         leastconn # roundrobin
        stick-table     type ip size 20k
        stick           on src
        server          acd-tel1 acd-tel1:8091 weight 1 cookie jboss1 check inter 1m

Reload Load-Balancer

Reload the load balancer:

Code Block
systemctl reload haproxy

Configure Windows Firewall

In an elevated command prompt on the windows server:

Code Block
netsh advfirewall firewall add rule name="JREST" dir=in action=allow protocol=TCP localport=8091 edge=no

Start REST Server

Start the rest server on the windows machine with the shortcut.

Sv translation
languagefr

Monter le Share

Le système doit avoir accès au share dans acd-store.

Consulter le dépôt JREST

Dans acd-store exécutez les commandes suivantes pour extraire le dépôt :

Code Block
su jtel cd /srv/jtel/shared git clone https://bitbucket.org/jtelgmbh/jtel-system-java-services.git

Installation - sur un serveur Linux

Pour installer le rôle REST sur un serveur Linux, procédez comme suit sur le serveur acd-rest .

Java 12

Installez java 12 comme suit :

Code Block
cd /home/jtel wget https://cdn.jtel.de/downloads/java/openjdk-12.0.2_linux-x64_bin.tar.gz tar xvfz openjdk-12.0.2_linux-x64_bin.tar.gz rm -f openjdk-12.0.2_linux-x64_bin.tar.gz chown -R jtel:jtel jdk-12.0.2

jrest

Installez jrest comme suit :

Code Block
cd /home/jtel cp -r /home/jtel/shared/jtel-system-java-services/deploy/jrest jrest mkdir /home/jtel/jrest/log chown -R jtel:jtel jrest cp jrest/systemd/jrest.service /etc/systemd/system chmod +x /home/jtel/jrest/systemd/jrest systemctl daemon-reload systemctl enable jrest.service

Configuration

Modifiez le fichier de configuration /home/jtel/jrest/config/jtel-jrest.xml et vérifiez que les mots de passe d'accès à la base de données et les hôtes, etc. sont corrects.

Note : le serverID doit être unique sur chaque connecteur :

Warning

<serverID>2001</serverID>


Modifiez le fichier de démarrage /etc/init.d/jrest  et vérifiez que le répertoire java est correct (la bonne version java).

Modifier le fichier de configuration de l'enregistrement /home/jtel/jrest/config/log4j2.xml et assurez-vous qu'il pointe vers le répertoire d'enregistrement requis.

Pare-feu

Ouvrez le port 8091 du pare-feu comme suit :

CentOS:

Code Block
firewall-cmd --zone=public --add-port=8091/tcp --permanent firewall-cmd --reload


Debian:

Code Block
ufw allow 8091/tcp

Démarrer le service

Démarrez le service. 

Code Block
systemctl start jrest.service

Installation - sur Windows Server

Pour installer le rôle REST sur le serveur Windows, procédez comme suit.

Java 12

Télécharger java 12 ici:

https://cdn.jtel.de/downloads/java/openjdk-12.0.2_windows-x64_bin.zip

Décompressez le tout dans le répertoire suivant :

Code Block
c:\Apps\

Cela devrait aboutir à la création de la structure de répertoire suivante :


Code Block
C:\Apps\openjdk-12.0.2_windows-x64_bin\jdk-12.0.2\bin 


Warning

Notez que si vous n'utilisez pas les chemins spécifiés ci-dessus, vous devrez peut-être modifier considérablement la configuration.

Copier les fichiers and Installer

Sur le serveur Windows, exécutez les commandes suivantes dans une invite de commande non levée :

Code Block
c: md \JRest xcopy /E \\acd-store\shared\jtel-system-java-services\deploy\jrest C:\JRest

Configuration

Edit the configuration file, and make sure the database access (username and password) est correcte :

Code Block
C:\JRest\config\jtel-jrest.xml

Raccourci

Créer un raccourci pour start-jrest.cmd et mettre cela dans shell:startup

Configurer l'équilibreur de charge

Il est préférable d'envoyer les demandes de l'API REST à l'équilibreur de charge. Pour cela, il faut ajouter les éléments suivants à la configuration de l'équilibreur de charge.

Frontend http / https

Selon le protocole utilisé, il est possible de configurer soit http soit https. Dans le front-end correspondant, il convient d'ajouter ce qui suit :

Code Block
# ADD THIS WHERE THE acls are: acl rest_req url_reg ^\/rest\/v1.0 # ADD THIS WHERE THE use_backend directives are: use_backend jtel_rest if rest_req # ADD THIS AT THE BOTTOM: #--------------------------------------------------------------------- # this backend provides access to the REST API #--------------------------------------------------------------------- backend jtel_rest mode http compression algo gzip compression type text/xml text/html text/plain text/css text/javascript balance leastconn # roundrobin stick-table type ip size 20k stick on src server acd-tel1 acd-tel1:8091 weight 1 cookie jboss1 check inter 1m

Recharger l'équilibreur de charge

Rechargez l'équilibreur de charge :

Code Block
systemctl reload haproxy

Configurer le pare-feu Windows

Dans une invite de commande élevée sur le serveur Windows :

Code Block
netsh advfirewall firewall add rule name="JREST" dir=in action=allow protocol=TCP localport=8091 edge=no

Démarrer le serveur REST

Démarrez le serveur de repos sur la machine Windows avec le raccourci.