aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemigiusz Janeczek <remigiusz.janeczek@nokia.com>2020-03-10 15:58:01 +0100
committerRemigiusz Janeczek <remigiusz.janeczek@nokia.com>2020-03-11 10:05:03 +0100
commit0482d32cf88a4281e0339cede868ff271f945731 (patch)
treeb82ba71a7a2614b0512772113f34560e7301f368
parent50ec01532a2c3816d964bf6b1b870968536a6fd7 (diff)
Add docker-compose with certservice-client container succesful run
Fix client default request url to match default url from helm deployment of certservice-api Issue-ID: AAF-996 Signed-off-by: Remigiusz Janeczek <remigiusz.janeczek@nokia.com> Change-Id: Icfaf1043b6d6583cdf663a45dabd7b46d407dd2f
-rw-r--r--.gitignore1
-rw-r--r--certServiceClient/client_docker.env14
-rw-r--r--certServiceClient/docker-compose.yml59
-rw-r--r--certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/model/ClientConfiguration.java2
-rw-r--r--certServiceClient/src/test/java/org/onap/aaf/certservice/client/configuration/model/ClientConfigurationFactoryTest.java3
5 files changed, 77 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 95756028..35cc9b4e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@ target/
!**/src/main/**
!**/src/test/**
**/var
+certServiceClient/certs_volume
### STS ###
.apt_generated
diff --git a/certServiceClient/client_docker.env b/certServiceClient/client_docker.env
new file mode 100644
index 00000000..f2697173
--- /dev/null
+++ b/certServiceClient/client_docker.env
@@ -0,0 +1,14 @@
+#Client envs
+REQUEST_URL=http://certservice:8080/v1/certificate/
+REQUEST_TIMEOUT=1000
+OUTPUT_PATH=/var/certs
+CA_NAME=RA
+#Csr config envs
+COMMON_NAME=onap.org
+ORGANIZATION=Linux-Foundation
+ORGANIZATION_UNIT=ONAP
+LOCATION=San-Francisco
+STATE=California
+COUNTRY=US
+SANS=example.org
+
diff --git a/certServiceClient/docker-compose.yml b/certServiceClient/docker-compose.yml
new file mode 100644
index 00000000..b0c65be9
--- /dev/null
+++ b/certServiceClient/docker-compose.yml
@@ -0,0 +1,59 @@
+version: "2.1"
+
+services:
+ ejbca:
+ image: primekey/ejbca-ce:6.15.2.5
+ hostname: cahostname
+ container_name: aafcert-ejbca
+ ports:
+ - "80:8080"
+ - "443:8443"
+ volumes:
+ - ../certService/src/main/resources/scripts/:/opt/primekey/scripts
+ command: bash -c "
+ ./scripts/ejbca-configuration.sh &
+ /opt/primekey/bin/start.sh
+ "
+ healthcheck:
+ test: ["CMD-SHELL", "curl -kI https://localhost:8443/ejbca/publicweb/healthcheck/ejbcahealth"]
+ interval: 20s
+ timeout: 3s
+ retries: 9
+ networks:
+ - certservice
+
+ certservice:
+ image: onap/org.onap.aaf.certservice.aaf-certservice-api:latest
+ volumes:
+ - ../certService/helm/aaf-cert-service/resources/cmpServers.json:/etc/onap/aaf/certservice/cmpServers.json
+ container_name: aafcert-service
+ ports:
+ - "8080:8080"
+ depends_on:
+ ejbca:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD-SHELL", "curl -f http://localhost:8080/actuator/health"]
+ interval: 10s
+ timeout: 3s
+ retries: 9
+ networks:
+ - certservice
+
+ certservice-client:
+ image: onap/org.onap.aaf.certservice.aaf-certservice-client:latest
+ container_name: aafcert-client
+ env_file:
+ - ./client_docker.env
+ user: root #Run as root to avoid volume permission issues
+ volumes:
+ - ./certs_volume/:/var/certs
+ depends_on:
+ certservice:
+ condition: service_healthy
+ networks:
+ - certservice
+
+networks:
+ certservice:
+ driver: bridge
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/model/ClientConfiguration.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/model/ClientConfiguration.java
index 58d3f6b1..d1c1c685 100644
--- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/model/ClientConfiguration.java
+++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/model/ClientConfiguration.java
@@ -23,7 +23,7 @@ package org.onap.aaf.certservice.client.configuration.model;
public class ClientConfiguration implements ConfigurationModel {
private static final Integer DEFAULT_TIMEOUT_MS = 30000;
- private static final String DEFAULT_REQUEST_URL = "http://cert-service:8080/v1/certificate/";
+ private static final String DEFAULT_REQUEST_URL = "http://aaf-cert-service-service:8080/v1/certificate/";
private String urlToCertService;
private Integer requestTimeout;
diff --git a/certServiceClient/src/test/java/org/onap/aaf/certservice/client/configuration/model/ClientConfigurationFactoryTest.java b/certServiceClient/src/test/java/org/onap/aaf/certservice/client/configuration/model/ClientConfigurationFactoryTest.java
index 2c875c24..c936ef52 100644
--- a/certServiceClient/src/test/java/org/onap/aaf/certservice/client/configuration/model/ClientConfigurationFactoryTest.java
+++ b/certServiceClient/src/test/java/org/onap/aaf/certservice/client/configuration/model/ClientConfigurationFactoryTest.java
@@ -39,6 +39,7 @@ public class ClientConfigurationFactoryTest {
private final String TIME_OUT_VALID = "30000";
private final String OUTPUT_PATH_VALID = "/opt/app/osaaf";
private final String URL_TO_CERT_SERVICE_VALID = "http://cert-service:8080/v1/certificate/";
+ private final String URL_TO_CERT_SERVICE_DEFAULT = "http://aaf-cert-service-service:8080/v1/certificate/";
private final String CA_NAME_INVALID = "caaaftest2#$";
private final String OUTPUT_PATH_INVALID = "/opt//app/osaaf";
@@ -75,7 +76,7 @@ public class ClientConfigurationFactoryTest {
assertThat(configuration.getCaName()).isEqualTo(CA_NAME_VALID);
assertThat(configuration.getRequestTimeout()).isEqualTo(Integer.valueOf(TIME_OUT_VALID));
assertThat(configuration.getCertsOutputPath()).isEqualTo(OUTPUT_PATH_VALID);
- assertThat(configuration.getUrlToCertService()).isEqualTo(URL_TO_CERT_SERVICE_VALID);
+ assertThat(configuration.getUrlToCertService()).isEqualTo(URL_TO_CERT_SERVICE_DEFAULT);
}
@Test