Date: | Author: | Version: | Changes: | Completed | Ext. | Int. | Is in Core | Jira Ref. |
---|---|---|---|---|---|---|---|---|
0.1 | Doc. created | Yes/No | x |
| N/A |
| ||
14/04-2016 | Anders Granau Hø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 |
...
This section is about how to modify the customer project's pom so as to include the selfcare-rest-api
in the build.
Note
Info | ||
---|---|---|
| ||
The name of the projects in the examples can be changed according to the customer setup. The examples are presented mainly for the structure of the projects. |
You will need to create a new pom and put it in a subfolder of your customer project. Follow these steps:
...
Example project structure:
Info | ||
---|---|---|
| ||
The pom files below are presented just as examples and should be used accordingly. |
Core REST-api pom example
...
- Retrieve the
rator-selfcare-rest-api
.war file (either from Jenkins/Nexus, see Resources, or by building the .war yourself, see Build). - Copy the war file 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.
...
- Check out the source code (See the
Resources
paragraph above.) npm install
gulp
- You should see the distribution under the dist folder. Open
./dist/index.html
to launch Swagger UI in a browser
...
<?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.telecom26</groupId> <artifactId>telecom26-rest-parent</artifactId> <version>3.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>telecom26-rest-api-cust</artifactId> <packaging>war</packaging> <name>telecom26 REST API (Customized Services)</name> <description>telecom26 REST API (Customized Services)</description> <dependencies> <dependency> <groupId>${project.groupId}</groupId> <artifactId>telecom26-billing</artifactId> <version>${project.version}</version> <scope>runtime</scope> <exclusions> <exclusion> <groupId>javax.ws.rs</groupId> <artifactId>jsr311-api</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>telecom26-rest-api</artifactId> <version>${project.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>com.cdrator.integration.rating</groupId> <artifactId>rator-rating-ch-Telecom26TAP</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>com.cdrator.integration.rating</groupId> <artifactId>rator-rating-ch-telecom26ggsn</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>com.cdrator.core</groupId> <artifactId>rator-component-library</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>com.cdrator.actions</groupId> <artifactId>${com.cdrator.action-pack.artifact_id}</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>com.cdrator</groupId> <artifactId>rator-selfcare-rest-api</artifactId> <classifier>webapp</classifier> <type>war</type> <scope>runtime</scope> </dependency> <dependency> <groupId>com.cdrator</groupId> <artifactId>rator-selfcare-rest-api</artifactId> <classifier>only-library</classifier> <scope>runtime</scope> </dependency> </dependencies> <build> <finalName>telecom26-rest-api-cust</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> <profiles> <profile> <id>default</id> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> <profile> <id>docker</id> <properties> <docker-registry-uri>localhost:5000</docker-registry-uri> </properties> <build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <id>docker-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <outputDirectory>${project.build.directory}</outputDirectory> </configuration> </execution> </executions> </plugin> <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>0.4.13</version> <executions> <execution> <id>build-image</id> <phase>package</phase> <goals> <goal>build</goal> </goals> <configuration> <baseImage>docker.cdrator.com/cdrator-tomcat:3.2</baseImage> <imageName>${project.artifactId}:${project.parent.parent.artifactId}-${project.version}</imageName> <serverId>cdrator-docker-hub</serverId> <registryUrl>https://docker.cdrator.com/v2</registryUrl> <resources> <resource> <targetPath>/usr/local/tomcat/apps</targetPath> <directory>${project.parent.parent.build.directory}/</directory> <includes> <include>telecom26-rest-api-cust.war</include> </includes> </resource> <resource> <targetPath>/etc/confd/conf.d</targetPath> <directory>${project.build.directory}/telecom26-rest-api-cust/config/conf.d/telecom26-rest-api-cust/</directory> <includes> <include>*.toml</include> </includes> </resource> <resource> <targetPath>/etc/confd/templates</targetPath> <directory>${project.build.directory}/telecom26-rest-api-cust/config/templates/telecom26-rest-api-cust/</directory> <includes> <include>*.tmpl</include> </includes> </resource> <resource> <targetPath>/usr/local/tomcat/bin</targetPath> <directory>${project.build.directory}/telecom26-rest-api-cust/config/bin/</directory> <includes> <include>*.sh</include> </includes> </resource> </resources> <cmd>["sh", "/usr/local/tomcat/bin/startwebapp.sh"]</cmd> <noCache>true</noCache> </configuration> </execution> <!-- Tag image as version --> <execution> <id>tag-tested-image-versioned</id> <phase>pre-integration-test</phase> <goals> <goal>tag</goal> </goals> <configuration> <image>${project.artifactId}:${project.parent.parent.artifactId}-${project.version}</image> <newName>${docker-registry-uri}/${project.artifactId}:${project.parent.parent.artifactId}-${project.version}</newName> <forceTags>true</forceTags> </configuration> </execution> <execution> <id>push-tested-image-versioned</id> <phase>pre-integration-test</phase> <goals> <goal>push</goal> </goals> <configuration> <serverId>${docker-hub}</serverId> <registryUrl>${docker-hub-url}</registryUrl> <imageName>${docker-registry-uri}/${project.artifactId}:${project.parent.parent.artifactId}-${project.version}</imageName> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile> <profile> <id>ci</id> <properties> <docker-registry-uri>localhost:5000</docker-registry-uri> </properties> <build> <plugins> <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>0.4.13</version> <executions> <!-- Tag image as latest --> <execution> <id>tag-latest-image</id> <phase>pre-integration-test</phase> <goals> <goal>tag</goal> </goals> <configuration> <image>${project.artifactId}:${project.parent.parent.artifactId}-${project.version}</image> <newName>${docker-registry-uri}/${project.artifactId}:${project.parent.parent.artifactId}-${project.version}</newName> </configuration> </execution> <!-- And push the latest image to ensure that we test on the newest code --> <execution> <id>push-latest-image</id> <phase>pre-integration-test</phase> <goals> <goal>push</goal> </goals> <configuration> <serverId>cdrator-docker-hub</serverId> <registryUrl>https://docker.cdrator.com/v2</registryUrl> <imageName>${docker-registry-uri}/${project.artifactId}:${project.parent.parent.artifactId}-${project.version}</imageName> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile> <profile> <id>external-test</id> <properties> <docker-registry-uri>zh4devratoras1.private.sec</docker-registry-uri> <docker-hub>t26-docker-hub</docker-hub> <docker-hub-url>https://zh4devratoras1.private.sec/v2</docker-hub-url> </properties> </profile> </profiles> </project>