Date: | Author: | Version: | Changes: | Completed | Ext. | Int. | Is in Core | Jira Ref. |
---|---|---|---|---|---|---|---|---|
05 April 2016 | tpl | 0.1 | Doc. created | No | x | N/A | ||
14 April 2016 | Anders GranauHøfft | 0.2 | Sections expanded | No | x | N/A | CDRRM-733 | |
11 May 2016 | Emil Ifrim | 0.3 | Database configuration | No | x | N/A | ||
20 March 2017 | Emil Ifrim | 0.4 | Redesign Update | No | x | N/A | ||
01 April 2018 | Emil Ifrim | 0.5 | Redesign Update | No | x | N/A | ||
15 January 2019 | SD | 0.6 | Download pdf-file |
Overview
This is a brief guide on how to install the REST service (rator-rest-api project and rator-rest-api-auth project). A customer rest project involves deploying three artifacts:
...
The customer project can deploy REST as two services (REST Auth and REST Core) or as three services (REST Auth, REST Core and REST Cust).
Two-service deployment: the custom endpoints (usualy developed in it's own standalone customer library project) are packaged together with the core endpoints
- pros: only two services to maintain, documentation can be browsed at the same address for both core and custom endpoints
- cons: in a intensive production setup, where high availability is a must, taking down the endpoints will happen for both(core and custom); also, in case of scalability, this has to be the same for both
Three-service deployment: the custom endpoints (usualy developed in it's own standalone customer library project) are packaged and deployed separately (REST Core has it's own war file, same for REST Cust)
- pros: more scalable and maintainable (e.g if custom endpoints Tomcat needs maintainance, it can be stopped without affecting REST Core service)
- cons: one more service to main and deploy.
Below it's an example with three modules, Baseline project can be used as an example for a two-rest-service deployment
This is a brief guide on how to install the REST service (rator-rest-api project and rator-rest-api-auth project). A customer rest project involves deploying three artifacts:
- authentication project (war) - this is called in order to obtain an authentication token.
- core REST services (war) - this contains core REST services, but in a customer project context(customer project dependencies).
- customer REST services (war) - this contains customer REST services with customer project dependencies.
...
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.cdrator.projects.customer_project</groupId>
<artifactId>customer_project-rest-parent</artifactId>
<version>3.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>customer_project-rest-api-auth</artifactId>
<packaging>war</packaging>
<name>customer_project REST API Auth</name>
<description>customer_project REST API Auth</description>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>customer_project-billing</artifactId> <!-- or rator-billing if there is no customization in the billing layer of the customer project-->
<version>${project.version}</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.apache.bval</groupId>
<artifactId>bval-jsr303</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.cdrator.rest</groupId>
<artifactId>rator-rest-api-auth</artifactId>
<classifier>webapp</classifier>
<type>war</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.cdrator.rest</groupId>
<artifactId>rator-rest-api-auth</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<finalName>customer_project-rest-api-auth</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<outputDirectory>${basedir}/../../../target</outputDirectory>
<excludes>log4j.properties</excludes>
<!-- Exclude JCL and LOG4J since all logging should go through SLF4J.
Note that we're excluding log4j-<version>.jar but keeping log4j-over-slf4j-<version>.jar -->
<packagingExcludes>
WEB-INF/log4j.properties,
WEB-INF/lib/javax.el-api-2.2.4.jar
</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>com.cdrator.maven.plugins</groupId>
<artifactId>rator-maven-renamer-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
|
...
-maven-renamer-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
|
Info | ||
---|---|---|
| ||
Since REST 17.0 (core 11.23), correspinding to Java 21 upgrade, the rator-rest-api-auth artifact has been replaced with rator-authorization-server. |
Install Tomcat 9
A Tomcat must be installed on your environment.
Info |
---|
Make sure to use Apache Tomcat version 7.X.X as version 8 and above does not respect class path order (on which the Rator code relies)Since REST 17.0 (core 11.23), correspinding to Java 21 upgrade, Tomcat 10 or above is needed. |
Installation
Info |
---|
If you are developing from Eclipse, and deploying to a local Tomcat installation, Eclipse automatically handles build and deployment. See fx the Tomcat-section of this guide. |
...
- Retrieve the
rator-rest-api
.war file (either from Jenkins/Nexus, see Resources, or by building the .war yourself, see Build). - Retrieve the
rator-rest-api-auth
.war file (either from Jenkins/Nexus, see Resources, or by building the .war yourself, see Build). - Copy the war files to the Tomcat webapps directory and (re-)start the Tomcat application.
- Retrieve the swagger-ui
dist
folder (either from Github, or from our own repositories, see Resources. Or by building the project yourself, see Build). - Copy the dist folder to the Tomcat
webapps
directory and (re-)start the Tomcat application. You probably want to rename thedist
folder toswagger-ui
.- Nb This can be a different Tomcat installation than in step 2, or the same.
- In your browser, enter the URL "http://<Swagger server and port>/<base-path>/?url=http://<REST server and port>/<base-path>/api/swagger.json".
- You should now see a list of the resources available on the REST server.
In order to access secure resources through swagger-ui, one additional parameter must be configured in the Properties.txt file:
Code Block language sql title oauth2 selfcare client rest.api.accessTokenUri=http://<host>:<port/<auth-app-context>/oauth/token #example: http://10.45.1.81:8081/rator-rest-api-auth/oauth/token
...