From 6817f5b502e38c46a9eaa107e00fc912d521695a Mon Sep 17 00:00:00 2001 From: raag8290 Date: Mon, 9 Apr 2018 16:23:03 +0200 Subject: [PATCH] Add files for build and docker - version.properties - plugin docker - application-docker.properties - docker files - ready Change-Id: Ic6884b2df3d31518b70a5d2b8cd1a2fd94d73a15 Issue-ID: EXTAPI-49 Signed-off-by: romaingimbert --- .maven-dockerignore | 1 + Dockerfile | 4 + docker-compose.yml | 30 ++++++++ pom.xml | 97 ++++++++++++++++++++---- src/main/resources/application-docker.properties | 48 ++++++++++++ version.properties | 13 ++++ 6 files changed, 177 insertions(+), 16 deletions(-) create mode 100644 .maven-dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 src/main/resources/application-docker.properties create mode 100644 version.properties diff --git a/.maven-dockerignore b/.maven-dockerignore new file mode 100644 index 0000000..07fa861 --- /dev/null +++ b/.maven-dockerignore @@ -0,0 +1 @@ +target/docker/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5f43f6b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM openjdk:8-jdk-alpine +ADD target/nbi-rest-services-1.0.0-SNAPSHOT.jar app.jar +ENV JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom -Dspring.profiles.active=docker -jar" +ENTRYPOINT exec java $JAVA_OPTS /app.jar \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e6fbf97 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,30 @@ +version: "3.0" +services: + mongo: + image: mongo + volumes: + - /var/lib/mongo + ports: + - 27017:27017 + command: --smallfiles + + mariadb: + image: mariadb + restart: always + volumes: + - /var/lib/mariadb + environment: + MYSQL_DATABASE: nbi + MYSQL_ROOT_PASSWORD: toto +# APP *************************************************************************************** + nbi: + build: . + image: nbi + ports: + - 8080:8080 + depends_on: + - mariadb + - mongo +volumes: + mariadb: + mongo: diff --git a/pom.xml b/pom.xml index d03e11e..a85cb4c 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,7 @@ + UTF-8 UTF-8 @@ -43,6 +44,13 @@ content/repositories/releases/ content/repositories/staging/ 1.8 + nexus3.onap.org:10001 + nexus3.onap.org:10003 + ${maven.build.timestamp} + yyyyMMdd'T'HHmmss'Z' + + ${project.version}-${timestamp} + ${project.version}-latest @@ -55,28 +63,15 @@ ecomp-snapshots Snapshot Repository - ${nexusproxy}/${snapshotNexusPath} + https://nexus.onap.org/content/repositories/releases/ ecomp-staging Staging Repository - ${nexusproxy}/${stagingNexusPath} + https://nexus.onap.org/content/repositories/staging/ - - - ecomp-releases - Release Repository - ${nexusproxy}/${releaseNexusPath} - - - ecomp-snapshots - Snapshot Repository - ${nexusproxy}/${snapshotNexusPath} - - - Apache2 @@ -133,6 +128,11 @@ mysql mysql-connector-java + + org.mariadb.jdbc + mariadb-java-client + 1.1.7 + @@ -172,7 +172,7 @@ test - + com.h2database @@ -280,4 +280,69 @@ + + + + + + docker + + + + io.fabric8 + docker-maven-plugin + 0.19.1 + + true + 1.23 + ${docker.pull.registry} + ${docker.push.registry} + + + onap/externalapi/nbi + onap/externalapi/nbi + + true + + ${docker.tag} + ${docker.latest.tag} + + ${project.basedir} + + + + + + + clean-images + pre-clean + + remove + + + true + nbi + + + + generate-images + package + + build + + + + push-images + deploy + + push + + + + + + + + + diff --git a/src/main/resources/application-docker.properties b/src/main/resources/application-docker.properties new file mode 100644 index 0000000..01070d4 --- /dev/null +++ b/src/main/resources/application-docker.properties @@ -0,0 +1,48 @@ +# LOGGING +logging.level.org.onap.nbi=INFO + +# ONAP +onap.lcpCloudRegionId=RegionOne +onap.tenantId=31047205ce114b60833b23e400d6a535 +onap.cloudOwner=CloudOwner + +# NBI +nbi.url=http://127.0.0.1:8080/nbi/api/v1 +nbi.callForVNF=false + +# SDC +sdc.host=http://127.0.0.1:8090 +sdc.header.ecompInstanceId=Rene +sdc.header.authorization=Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU= + +# AAI +aai.host=http://127.0.0.1:8090 +aai.header.authorization=Basic QUFJOkFBSQ== +aai.api.id=AAI + +# SO +so.host=http://127.0.0.1:8090 +so.header.authorization= +so.api.id=SO + +# MONGO +spring.data.mongodb.uri=mongodb://mongo:27017/ServiceOrderDB + +# MYSQL +spring.datasource.testWhileIdle=true +spring.datasource.validationQuery=SELECT 1 +spring.datasource.driver-class-name=org.mariadb.jdbc.Driver +spring.datasource.url=jdbc:mariadb://mariadb:3306/nbi +spring.jpa.show-sql=false +spring.datasource.username=root +spring.datasource.password=toto +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy + +# H2 +# spring.datasource.url=jdbc:h2:mem:~/db +# spring.datasource.username=sa +# spring.datasource.password= +# spring.datasource.driver-class-name=org.h2.Driver +# spring.h2.console.enabled=true +# spring.h2.console.path=/h2-console \ No newline at end of file diff --git a/version.properties b/version.properties new file mode 100644 index 0000000..d3e09bb --- /dev/null +++ b/version.properties @@ -0,0 +1,13 @@ +# Versioning variables +# Note that these variables cannot be structured (e.g. : version.release or version.snapshot etc... ) +# because they are used in Jenkins, whose plug-in doesn't support... + +major=1 +minor=2 +patch=1 + +base_version=${major}.${minor}.${patch} + +# Release must be completed with git revision # in Jenkins +release_version=${base_version} +snapshot_version=${base_version}-SNAPSHOT -- 2.16.6