diff options
-rw-r--r-- | .maven-dockerignore | 1 | ||||
-rw-r--r-- | Dockerfile | 4 | ||||
-rw-r--r-- | docker-compose.yml | 30 | ||||
-rw-r--r-- | pom.xml | 97 | ||||
-rw-r--r-- | src/main/resources/application-docker.properties | 48 | ||||
-rw-r--r-- | version.properties | 13 |
6 files changed, 177 insertions, 16 deletions
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: @@ -35,6 +35,7 @@ <relativePath /> <!-- lookup parent from repository --> </parent> + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> @@ -43,6 +44,13 @@ <releaseNexusPath>content/repositories/releases/</releaseNexusPath> <stagingNexusPath>content/repositories/staging/</stagingNexusPath> <java.version>1.8</java.version> + <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry> + <docker.push.registry>nexus3.onap.org:10003</docker.push.registry> + <timestamp>${maven.build.timestamp}</timestamp> + <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> + <!--docker --> + <docker.tag>${project.version}-${timestamp}</docker.tag> + <docker.latest.tag>${project.version}-latest</docker.latest.tag> </properties> <repositories> @@ -55,28 +63,15 @@ <repository> <id>ecomp-snapshots</id> <name>Snapshot Repository</name> - <url>${nexusproxy}/${snapshotNexusPath}</url> + <url>https://nexus.onap.org/content/repositories/releases/</url> </repository> <repository> <id>ecomp-staging</id> <name>Staging Repository</name> - <url>${nexusproxy}/${stagingNexusPath}</url> + <url>https://nexus.onap.org/content/repositories/staging/</url> </repository> </repositories> - <distributionManagement> - <repository> - <id>ecomp-releases</id> - <name>Release Repository</name> - <url>${nexusproxy}/${releaseNexusPath}</url> - </repository> - <snapshotRepository> - <id>ecomp-snapshots</id> - <name>Snapshot Repository</name> - <url>${nexusproxy}/${snapshotNexusPath}</url> - </snapshotRepository> - </distributionManagement> - <licenses> <license> <name>Apache2</name> @@ -133,6 +128,11 @@ <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> + <dependency> + <groupId>org.mariadb.jdbc</groupId> + <artifactId>mariadb-java-client</artifactId> + <version>1.1.7</version> + </dependency> <!-- swagger --> @@ -172,7 +172,7 @@ <scope>test</scope> </dependency> - <!-- test h2 --> + <!-- test h2 --> <dependency> <groupId>com.h2database</groupId> @@ -280,4 +280,69 @@ </plugin> </plugins> </build> + + + + <profiles> + <profile> + <id>docker</id> + <build> + <plugins> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>0.19.1</version> + <configuration> + <verbose>true</verbose> + <apiVersion>1.23</apiVersion> + <pullRegistry>${docker.pull.registry}</pullRegistry> + <pushRegistry>${docker.push.registry}</pushRegistry> + <images> + <image> + <name>onap/externalapi/nbi</name> + <alias>onap/externalapi/nbi</alias> + <build> + <cleanup>true</cleanup> + <tags> + <tag>${docker.tag}</tag> + <tag>${docker.latest.tag}</tag> + </tags> + <dockerFileDir>${project.basedir}</dockerFileDir> + </build> + </image> + </images> + </configuration> + <executions> + <execution> + <id>clean-images</id> + <phase>pre-clean</phase> + <goals> + <goal>remove</goal> + </goals> + <configuration> + <removeAll>true</removeAll> + <image>nbi</image> + </configuration> + </execution> + <execution> + <id>generate-images</id> + <phase>package</phase> + <goals> + <goal>build</goal> + </goals> + </execution> + <execution> + <id>push-images</id> + <phase>deploy</phase> + <goals> + <goal>push</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + </project> 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 |