<!--
============LICENSE_START=======================================================
- Copyright (C) 2020 Nordix Foundation.
+ Copyright (C) 2020-2021 Nordix Foundation.
Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.gui</groupId>
- <artifactId>gui-common</artifactId>
- <version>${project.version}</version>
- <classifier>resources</classifier>
- <type>zip</type>
- <scope>provided</scope>
- </dependency>
</dependencies>
<build>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
+ <artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
- <id>Copy frontend build to target</id>
- <phase>prepare-package</phase>
+ <id>generate-gui-pdp-monitoring-tar</id>
+ <phase>package</phase>
<goals>
- <goal>copy-resources</goal>
+ <goal>single</goal>
</goals>
<configuration>
- <outputDirectory>${project.build.directory}/classes/webapp</outputDirectory>
- <resources>
- <resource>
- <directory>${webapp.dir}/dist</directory>
- <filtering>false</filtering>
- </resource>
- </resources>
+ <descriptors>
+ <descriptor>src/main/assembly/frontend.xml</descriptor>
+ </descriptors>
+ <finalName>${project.artifactId}-${project.version}</finalName>
</configuration>
</execution>
</executions>
<!--
============LICENSE_START=======================================================
- Copyright (C) 2020 Nordix Foundation.
+ Copyright (C) 2020-2021 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
============LICENSE_END=========================================================
-->
<assembly>
- <id>resources</id>
+ <id>frontend</id>
<formats>
- <format>zip</format>
+ <format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
- <directory>target/classes/webapp</directory>
- <outputDirectory>monitoring</outputDirectory>
+ <directory>${webapp.dir}/dist</directory>
+ <outputDirectory>pdp-monitoring</outputDirectory>
</fileSet>
</fileSets>
-</assembly>
\ No newline at end of file
+</assembly>
public void shutdown() {
if (pdpMonitoringServer != null) {
LOGGER.info(PDP_MONITORING_PREFIX + "{}) shutting down", this);
- pdpMonitoringServer.shutdown(parameters.getPort(), parameters.getDefaultRestPort());
+ pdpMonitoringServer.shutdown(parameters.getPort());
}
shutdownLatch.countDown();
state = ServicesState.STOPPED;
package org.onap.policy.gui.pdp.monitoring;
import lombok.NonNull;
-import org.eclipse.jetty.servlets.CrossOriginFilter;
import org.onap.policy.common.endpoints.http.server.HttpServletServer;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.slf4j.Logger;
// The HTTP server exposing JAX-RS resources defined in this application.
private HttpServletServer jerseyServer;
- // The HTTP server exposing static resources defined in this application.
- private HttpServletServer staticResourceServer;
-
/**
* Starts the HTTP server for the Pdp statistics monitoring on the default base URI and with the
* default REST packages.
* @param parameters The Pdp parameters to use to start the server.
*/
public PdpMonitoringServer(@NonNull final PdpMonitoringServerParameters parameters) {
-
LOGGER.debug("Pdp Monitoring starting . . .");
jerseyServer = HttpServletServerFactoryInstance.getServerFactory().build("PDP Monitoring Rest Server", false,
- parameters.getServerHost(), parameters.getDefaultRestPort(), parameters.getContextPath(), false, true);
+ parameters.getServerHost(), parameters.getPort(), parameters.getContextPath(), false, true);
jerseyServer.addServletPackage(parameters.getDefaultRestPath(), parameters.getRestPackage());
- jerseyServer.addFilterClass(parameters.getDefaultRestPath(), CrossOriginFilter.class.getName());
jerseyServer.start();
- staticResourceServer = HttpServletServerFactoryInstance.getServerFactory().buildStaticResourceServer(
- "PDP Monitoring Html Server", false, parameters.getServerHost(), parameters.getPort(),
- parameters.getContextPath(), true);
- staticResourceServer.addServletResource(null,
- PdpMonitoringServer.class.getClassLoader().getResource("webapp").toExternalForm());
- staticResourceServer.start();
-
LOGGER.debug("Pdp Monitoring started");
}
/**
* Shut down the web server.
*
- * @param htmlPort port number of static resource server
* @param restPort port number of jersey server
*/
- public void shutdown(int htmlPort, int restPort) {
+ public void shutdown(int restPort) {
LOGGER.debug("Pdp Monitoring . . .");
- HttpServletServerFactoryInstance.getServerFactory().destroy(htmlPort);
HttpServletServerFactoryInstance.getServerFactory().destroy(restPort);
LOGGER.debug("Pdp Monitoring shut down");
}
@Getter
@Setter
public class PdpMonitoringServerParameters {
- public static final int DEFAULT_PORT = 18999;
public static final int INFINITY_TIME_TO_LIVE = -1;
// Base URI the HTTP server will listen on
@Min(1024)
@Max(65534)
- private int port = DEFAULT_PORT;
+ private int port = DEFAULT_REST_PORT;
@Min(-1)
private long timeToLive = INFINITY_TIME_TO_LIVE;
public String getDefaultRestPath() {
return "/" + DEFAULT_REST_PATH;
}
-
- public int getDefaultRestPort() {
- return DEFAULT_REST_PORT;
- }
}
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation.
+ * Copyright (C) 2020-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// Configuration used for page layout and charts
const config = {
refresh: 5000,
- restPort: 17999,
engineService: {
parent: "engineService",
tableId: "engineServicesTable",
}
};
-export { config, };
\ No newline at end of file
+export { config, };
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation.
+ * Copyright (C) 2020-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
window.restRootURL = location.protocol
+ "//"
+ window.location.hostname
- + ':' + config.restPort
- + (location.pathname.endsWith("/monitoring/") ? location.pathname.substring(0, location.pathname.indexOf("monitoring/")) : location.pathname)
+ + ':' + window.location.port
+ + window.location.pathname
+ "papservices/monitoring/";
// Initialize tooltip for the charts
initTooltip();
$(document).ready(readyCallback);
// Export for unit testing
-export { readyCallback, servicesCallback };
\ No newline at end of file
+export { readyCallback, servicesCallback };
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
- port: 9000
+ port: 9000,
+ proxy: {
+ "/papservices/monitoring": "http://localhost:17999",
+ }
}
};
<includes>
<include>org.onap.policy.gui:gui-clamp:tar.gz:clamp-build:${project.version}</include>
</includes>
- <outputFileNameMapping>gui-clamp.tar.gz</outputFileNameMapping>
+ <outputFileNameMapping>gui-clamp-html.tar.gz</outputFileNameMapping>
+ </dependencySet>
+ <dependencySet>
+ <includes>
+ <include>org.onap.policy.gui:gui-pdp-monitoring:tar.gz:frontend:${project.version}</include>
+ </includes>
+ <outputFileNameMapping>gui-pdp-monitoring-html.tar.gz</outputFileNameMapping>
</dependencySet>
<dependencySet>
<includes>
<classifier>clamp-build</classifier>
<type>tar.gz</type>
</dependency>
+ <dependency>
+ <groupId>org.onap.policy.gui</groupId>
+ <artifactId>gui-pdp-monitoring</artifactId>
+ <version>${project.version}</version>
+ <classifier>frontend</classifier>
+ <type>tar.gz</type>
+ </dependency>
<dependency>
<groupId>org.onap.policy.gui</groupId>
<artifactId>gui-pdp-monitoring</artifactId>
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/default.conf.template /etc/nginx/templates/default.conf.template
COPY nginx/index.html /usr/share/nginx/html/
-ADD /maven/gui-clamp.tar.gz /usr/share/nginx/html/
+ADD /maven/gui-clamp-html.tar.gz /usr/share/nginx/html/
+ADD /maven/gui-pdp-monitoring-html.tar.gz /usr/share/nginx/html/
RUN rm /etc/nginx/conf.d/default.conf && \
ln -sf /dev/stdout /var/log/nginx/access.log && \
ln -sf /dev/stderr /var/log/nginx/error.log && \
proxy_pass ${CLAMP_REST_URL}/restservices/clds/;
}
- location /apex-editor/ {
- proxy_pass http://localhost:18989/;
- proxy_set_header Host $host;
- proxy_set_header If-Modified-Since $http_if_modified_since;
+ location /pdp-monitoring/papservices/monitoring/ {
+ proxy_pass http://localhost:17999/papservices/monitoring/;
}
- location /pdp-monitoring/ {
- proxy_pass http://localhost:18999/;
+ location /apex-editor/ {
+ proxy_pass http://localhost:18989/;
proxy_set_header Host $host;
proxy_set_header If-Modified-Since $http_if_modified_since;
}
$JAVA_HOME/bin/java -jar "$POLICY_HOME/lib/gui-editor-apex-uber.jar" -p 18989 &
echo "Starting gui-pdp-monitoring"
-$JAVA_HOME/bin/java -jar "$POLICY_HOME/lib/gui-pdp-monitoring-uber.jar" -p 18999 &
+$JAVA_HOME/bin/java -jar "$POLICY_HOME/lib/gui-pdp-monitoring-uber.jar" -p 17999 &
echo "Starting nginx"
envsubst '${CLAMP_REST_URL}' < /etc/nginx/templates/default.conf.template > /etc/nginx/conf.d/default.conf