From 91dc86a82dd6f224462ce6476cc54267a31f667e Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Thu, 29 Aug 2019 20:03:32 +0300 Subject: [PATCH 01/27] Ignore volume --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7b1ad1ba..6aa11b3c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ #pattern for excluding generated proto files from git **/api/messages/ -**/api/events/ \ No newline at end of file +**/api/events/ +artifactory/volume/ \ No newline at end of file From af0b83a15d89571b44d57536cccc2d0baf3d76bc Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sun, 1 Sep 2019 12:59:51 +0300 Subject: [PATCH 02/27] Initial draft for API deployment --- api-deployer/Dockerfile | 9 +++ api-deployer/api-deployer.sh | 29 ++++++++++ artifactory/Dockerfile | 6 ++ artifactory/entrypoint.sh | 5 ++ docker-compose-storage.yml | 19 ++++++ docker-compose.yml | 2 +- laundry-management-service/build.gradle | 53 +++++++++++++++++ .../laundrymanagement-api/build.gradle | 57 +++++++++++++++++- .../laundrymanagement-app/build.gradle | 24 ++++---- order-management-service/build.gradle | 22 +++++++ .../ordermanagement-api/build.gradle | 58 ++++++++++++++----- .../ordermanagement-app/build.gradle | 7 +-- taskcoordinator/build.gradle | 21 +++++++ .../taskcoordinator-api/build.gradle | 42 +++++++++++++- .../taskcoordinator-app/build.gradle | 10 ++-- 15 files changed, 323 insertions(+), 41 deletions(-) create mode 100644 api-deployer/Dockerfile create mode 100644 api-deployer/api-deployer.sh create mode 100644 artifactory/Dockerfile create mode 100644 artifactory/entrypoint.sh create mode 100644 docker-compose-storage.yml diff --git a/api-deployer/Dockerfile b/api-deployer/Dockerfile new file mode 100644 index 00000000..942c0bca --- /dev/null +++ b/api-deployer/Dockerfile @@ -0,0 +1,9 @@ +FROM gradle:5.4.1 + +COPY ./api-deployer.sh /api-deployer.sh + +RUN apt-get update && apt-get install -y vim + +VOLUME [ "/project" ] + +WORKDIR /project diff --git a/api-deployer/api-deployer.sh b/api-deployer/api-deployer.sh new file mode 100644 index 00000000..229ba0c4 --- /dev/null +++ b/api-deployer/api-deployer.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -e +set -x + +API_PROJECTS=" + laundry-management-service/laundrymanagement-api + order-management-service/ordermanagement-api + taskcoordinator/taskcoordinator-api +" + +WORKDIR="${PWD}" +TMPDIR="$(mktemp -d)" + +echo "Copy project into ${TMPDIR}..." 1>&2 +cp -r "${WORKDIR}/." "${TMPDIR}" + +cd "${TMPDIR}" + +for project in ${API_PROJECTS}; do + cd "${project}" + gradle build + gradle artifactoryPublish + cd "${TMPDIR}" +done + +cd "${WORKDIR}" + +rm -rf "${TMPDIR}" \ No newline at end of file diff --git a/artifactory/Dockerfile b/artifactory/Dockerfile new file mode 100644 index 00000000..cf4ff12b --- /dev/null +++ b/artifactory/Dockerfile @@ -0,0 +1,6 @@ +FROM docker.bintray.io/jfrog/artifactory-oss + +COPY ./entrypoint.sh /entrypoint.sh +# RUN chmod a+x /entrypoint.sh + +ENTRYPOINT [ "/bin/bash", "/entrypoint.sh" ] \ No newline at end of file diff --git a/artifactory/entrypoint.sh b/artifactory/entrypoint.sh new file mode 100644 index 00000000..c478bc9c --- /dev/null +++ b/artifactory/entrypoint.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +# XXX: Fix up permissions on volume in Windows(Hyper-V) +chown -R artifact:artifact /var/opt/jfrog/artifactory + +exec /entrypoint-artifactory.sh \ No newline at end of file diff --git a/docker-compose-storage.yml b/docker-compose-storage.yml new file mode 100644 index 00000000..9c68f395 --- /dev/null +++ b/docker-compose-storage.yml @@ -0,0 +1,19 @@ +version: "3" + +services: + artifactory: + build: ./artifactory + # Login user: admin, password: password + image: artifactory-oss + # entrypoint: /bin/bash -c 'while true; do sleep 1; done' + ports: + - "8081:8081" + volumes: + - "./artifactory/volume:/var/opt/jfrog/artifactory" + api-deployer: + build: ./api-deployer + image: api-deployer + #tty: true + working_dir: "/project" + volumes: + - ".:/project" diff --git a/docker-compose.yml b/docker-compose.yml index 3b19d1ed..9c76ad9a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,7 +27,7 @@ services: ports: - "9411:9411" eureka: - image: eureka-server + image: springcloud/eureka ports: - "8761:8761" postgres: diff --git a/laundry-management-service/build.gradle b/laundry-management-service/build.gradle index e69de29b..10aaca7c 100644 --- a/laundry-management-service/build.gradle +++ b/laundry-management-service/build.gradle @@ -0,0 +1,53 @@ +/*buildscript { +/* repositories { + //mavenCentral() + maven { + url "http://artifactory:8081/artifactory/repo" // The Artifactory (preferably virtual) repository to resolve from + credentials { // Optional resolver credentials (leave out to use anonymous resolution) + username = "admin" // Artifactory user name + password = "password" // Password or API Key + } + } + } + +}*/ + +plugins { + id 'java' + id "com.jfrog.artifactory" version "4.9.8" + id 'maven-publish' +} + +allprojects { + repositories { + //mavenCentral() + maven { + url "http://artifactory:8081/artifactory/repo" // The Artifactory (preferably virtual) repository to resolve from + credentials { // Optional resolver credentials (leave out to use anonymous resolution) + username = "admin" // Artifactory user name + password = "password" // Password or API Key + } + } + } + apply plugin: "java" + dependencies { + //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory + implementation "org.jfrog.buildinfo:build-info-extractor-gradle:4+" + } + artifactoryPublish.skip = true + /* + publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } + }*/ + // apply plugin: "com.jfrog.artifactory" +} + +configure(subprojects.findAll { it.name =~ /.*-api/ }) { + artifactoryPublish.skip = false + apply plugin: "maven-publish" + apply plugin: "com.jfrog.artifactory" +} \ No newline at end of file diff --git a/laundry-management-service/laundrymanagement-api/build.gradle b/laundry-management-service/laundrymanagement-api/build.gradle index 731f8842..60dec96e 100644 --- a/laundry-management-service/laundrymanagement-api/build.gradle +++ b/laundry-management-service/laundrymanagement-api/build.gradle @@ -1,10 +1,19 @@ plugins { - id 'java' +/* id 'java' */ id 'com.google.protobuf' version '0.8.8' +/* id "com.jfrog.artifactory" version "4.9.8" */ } repositories { - mavenCentral() + maven { + url "http://artifactory:8081/artifactory/repo" // The Artifactory (preferably virtual) repository to resolve from + credentials { // Optional resolver credentials (leave out to use anonymous resolution) + username = "admin" // Artifactory user name + password = "password" // Password or API Key + } + } + + // mavenCentral() } group = 'com.microservices.laundrymanagement' @@ -38,4 +47,48 @@ uploadArchives { repositories { mavenLocal() } +} + +/* publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } +} +*/ +publishing { + publications { + mavenJava(MavenPublication) { + artifactId "${project.name}" + groupId = group + version = project.version + from components.java + } + } +} + +artifactory { + contextUrl = "http://artifactory:8081/artifactory" //The base Artifactory URL if not overridden by the publisher/resolver + publish { + repository { + repoKey = 'artifacts' + username = "admin" + password = "password" + maven = true + } + defaults { + publications('mavenJava') + publishArtifacts = true + } + } + resolve { + repository { + repoKey = 'repo' + username = "admin" + password = "password" + maven = true + + } + } } \ No newline at end of file diff --git a/laundry-management-service/laundrymanagement-app/build.gradle b/laundry-management-service/laundrymanagement-app/build.gradle index 8bbf99c7..7f769e7a 100644 --- a/laundry-management-service/laundrymanagement-app/build.gradle +++ b/laundry-management-service/laundrymanagement-app/build.gradle @@ -1,17 +1,18 @@ -buildscript { +// buildscript { // these repositories and dependencies are used by Gradle itself - repositories { - mavenCentral() - } - dependencies { - classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE' - } -} +// } +// +//dependencies { +// classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE' +//} -apply plugin: 'java' +plugins { + id "org.springframework.boot" version "2.1.4.RELEASE" +} apply plugin: 'idea' -apply plugin: 'org.springframework.boot' +// apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' +/* apply plugin: "com.jfrog.artifactory" */ bootJar { baseName = 'laundry-management-service-app' @@ -22,10 +23,11 @@ bootJar { sourceCompatibility = 1.8 // these repositories are used in project -repositories { +/* repositories { mavenCentral() mavenLocal() } +*/ dependencyManagement { imports { diff --git a/order-management-service/build.gradle b/order-management-service/build.gradle index e69de29b..f292f591 100644 --- a/order-management-service/build.gradle +++ b/order-management-service/build.gradle @@ -0,0 +1,22 @@ +plugins { + id 'java' + id "org.springframework.boot" version "2.1.4.RELEASE" +} + +allprojects { + repositories { + //mavenCentral() + maven { + url "http://artifactory:8081/artifactory/repo" // The Artifactory (preferably virtual) repository to resolve from + credentials { // Optional resolver credentials (leave out to use anonymous resolution) + username = "admin" // Artifactory user name + password = "password" // Password or API Key + } + } + } + apply plugin: "java" + dependencies { + //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory + implementation "org.jfrog.buildinfo:build-info-extractor-gradle:4+" + } +} diff --git a/order-management-service/ordermanagement-api/build.gradle b/order-management-service/ordermanagement-api/build.gradle index 46b8893e..ad6df205 100644 --- a/order-management-service/ordermanagement-api/build.gradle +++ b/order-management-service/ordermanagement-api/build.gradle @@ -1,20 +1,14 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE") - classpath("com.google.protobuf:protobuf-gradle-plugin:0.8.8") - } +plugins { + id 'java' + id 'com.google.protobuf' version '0.8.8' + id "com.jfrog.artifactory" version "4.9.8" + id "io.spring.dependency-management" + id 'maven-publish' } -apply plugin: 'java' -apply plugin: 'com.google.protobuf' -apply plugin: 'io.spring.dependency-management' - -repositories { +/*repositories { mavenCentral() -} +}*/ group = 'com.microservices.ordermanagement' version = apiVersion @@ -58,4 +52,40 @@ uploadArchives { repositories { mavenLocal() } +} + +publishing { + publications { + mavenJava(MavenPublication) { + artifactId "${project.name}" + groupId = group + version = project.version + from components.java + } + } +} + +artifactory { + contextUrl = "http://artifactory:8081/artifactory" //The base Artifactory URL if not overridden by the publisher/resolver + publish { + repository { + repoKey = 'artifacts' + username = "admin" + password = "password" + maven = true + } + defaults { + publications('mavenJava') + publishArtifacts = true + } + } + resolve { + repository { + repoKey = 'repo' + username = "admin" + password = "password" + maven = true + + } + } } \ No newline at end of file diff --git a/order-management-service/ordermanagement-app/build.gradle b/order-management-service/ordermanagement-app/build.gradle index 8116fa80..31d939ae 100644 --- a/order-management-service/ordermanagement-app/build.gradle +++ b/order-management-service/ordermanagement-app/build.gradle @@ -1,10 +1,7 @@ buildscript { - repositories { + /*repositories { mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE") - } + }*/ } apply plugin: 'java' diff --git a/taskcoordinator/build.gradle b/taskcoordinator/build.gradle index 8b137891..f292f591 100644 --- a/taskcoordinator/build.gradle +++ b/taskcoordinator/build.gradle @@ -1 +1,22 @@ +plugins { + id 'java' + id "org.springframework.boot" version "2.1.4.RELEASE" +} +allprojects { + repositories { + //mavenCentral() + maven { + url "http://artifactory:8081/artifactory/repo" // The Artifactory (preferably virtual) repository to resolve from + credentials { // Optional resolver credentials (leave out to use anonymous resolution) + username = "admin" // Artifactory user name + password = "password" // Password or API Key + } + } + } + apply plugin: "java" + dependencies { + //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory + implementation "org.jfrog.buildinfo:build-info-extractor-gradle:4+" + } +} diff --git a/taskcoordinator/taskcoordinator-api/build.gradle b/taskcoordinator/taskcoordinator-api/build.gradle index 926b3cdb..e484992b 100644 --- a/taskcoordinator/taskcoordinator-api/build.gradle +++ b/taskcoordinator/taskcoordinator-api/build.gradle @@ -1,11 +1,13 @@ plugins { id 'java' id 'com.google.protobuf' version '0.8.8' + id "com.jfrog.artifactory" version "4.9.8" + id 'maven-publish' } -repositories { +/*repositories { mavenCentral() -} +}*/ group = 'com.microservices.taskcoordinator' version = apiVersion @@ -38,4 +40,40 @@ uploadArchives { repositories { mavenLocal() } +} + +publishing { + publications { + mavenJava(MavenPublication) { + artifactId "${project.name}" + groupId = group + version = project.version + from components.java + } + } +} + +artifactory { + contextUrl = "http://artifactory:8081/artifactory" //The base Artifactory URL if not overridden by the publisher/resolver + publish { + repository { + repoKey = 'artifacts' + username = "admin" + password = "password" + maven = true + } + defaults { + publications('mavenJava') + publishArtifacts = true + } + } + resolve { + repository { + repoKey = 'repo' + username = "admin" + password = "password" + maven = true + + } + } } \ No newline at end of file diff --git a/taskcoordinator/taskcoordinator-app/build.gradle b/taskcoordinator/taskcoordinator-app/build.gradle index 35688864..67758094 100644 --- a/taskcoordinator/taskcoordinator-app/build.gradle +++ b/taskcoordinator/taskcoordinator-app/build.gradle @@ -1,10 +1,8 @@ buildscript { + /* repositories { mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE") - } + }*/ } apply plugin: 'java' @@ -20,10 +18,10 @@ bootJar { sourceCompatibility = 1.8 -repositories { +/*repositories { mavenCentral() mavenLocal() -} +}*/ dependencyManagement { imports { From ca2d75a9b1a22894482b8414ccb0081d6cf4d3ad Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Tue, 10 Sep 2019 22:26:38 +0300 Subject: [PATCH 03/27] Improvement draft --- accounting-service/Dockerfile | 20 ++++++++- .../accounting-app/build.gradle | 12 +++-- accounting-service/build.gradle | 22 +++++++++ api-deployer/api-deployer.sh | 1 + docker-compose-services.yml | 28 +++++++++--- laundry-management-service/Dockerfile | 19 +++++++- laundry-management-service/build.gradle | 6 +-- order-management-service/Dockerfile | 19 +++++++- order-management-service/build.gradle | 6 +-- tariff-management-service/Dockerfile | 19 +++++++- tariff-management-service/build.gradle | 23 ++++++++++ .../tariffmanagement-api/build.gradle | 45 ++++++++++++++++--- .../tariffmanagement-app/build.gradle | 8 ++-- 13 files changed, 201 insertions(+), 27 deletions(-) diff --git a/accounting-service/Dockerfile b/accounting-service/Dockerfile index 2b805da1..6011d042 100644 --- a/accounting-service/Dockerfile +++ b/accounting-service/Dockerfile @@ -1,4 +1,22 @@ +FROM gradle:5.4.1 AS builder + +ARG ARTIFACTORY_URL +ARG ARTIFACTORY_USER +ARG ARTIFACTORY_PASSWORD + +ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryUser=${ARTIFACTORY_USER} +# Enforce more security +ENV ORG_GRADLE_PROJECT_artifactoryPassword=${ARTIFACTORY_PASSWORD} + +WORKDIR /project + +COPY . /project + +RUN gradle :accounting-app:build + FROM openjdk:8-jre-alpine -COPY ./accounting-app/build/libs/accounting-service-app-0.1-SNAPSHOT.jar /accounting-service-app-0.1-SNAPSHOT.jar +COPY --from=builder /project/accounting-app/build/libs/accounting-service-app-0.1-SNAPSHOT.jar /accounting-service-app-0.1-SNAPSHOT.jar + EXPOSE 8093 ENTRYPOINT ["java", "-jar", "accounting-service-app-0.1-SNAPSHOT.jar", "--spring.profiles.active=docker"] diff --git a/accounting-service/accounting-app/build.gradle b/accounting-service/accounting-app/build.gradle index 2f7045d5..36df899e 100644 --- a/accounting-service/accounting-app/build.gradle +++ b/accounting-service/accounting-app/build.gradle @@ -1,13 +1,18 @@ -buildscript { +/*buildscript { repositories { mavenCentral() } + dependencies { classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE' } } +*/ -apply plugin: 'java' +/*plugins { + id "org.springframework.boot" version "2.1.4.RELEASE" +}*/ +//apply plugin: 'java' apply plugin: 'idea' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' @@ -20,10 +25,11 @@ bootJar { sourceCompatibility = 1.8 -repositories { +/*repositories { mavenLocal() mavenCentral() } +*/ dependencies { compile "com.microservices.accounting.api:accounting-api:${accountingApiVersion}" diff --git a/accounting-service/build.gradle b/accounting-service/build.gradle index e69de29b..cd44a4e1 100644 --- a/accounting-service/build.gradle +++ b/accounting-service/build.gradle @@ -0,0 +1,22 @@ +plugins { + id 'java' + id "org.springframework.boot" version "2.1.4.RELEASE" +} + +allprojects { + repositories { + //mavenCentral() + maven { + url "${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from + credentials { // Optional resolver credentials (leave out to use anonymous resolution) + username = "${artifactoryUser}" // Artifactory user name + password = "${artifactoryPassword}" // Password or API Key + } + } + } + apply plugin: "java" + dependencies { + //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory + implementation "org.jfrog.buildinfo:build-info-extractor-gradle:4+" + } +} diff --git a/api-deployer/api-deployer.sh b/api-deployer/api-deployer.sh index 229ba0c4..3b34ba4b 100644 --- a/api-deployer/api-deployer.sh +++ b/api-deployer/api-deployer.sh @@ -7,6 +7,7 @@ API_PROJECTS=" laundry-management-service/laundrymanagement-api order-management-service/ordermanagement-api taskcoordinator/taskcoordinator-api + tariff-management-service/api " WORKDIR="${PWD}" diff --git a/docker-compose-services.yml b/docker-compose-services.yml index 2424bdee..875140d5 100644 --- a/docker-compose-services.yml +++ b/docker-compose-services.yml @@ -1,19 +1,37 @@ -version: '3' +version: '3.4' + +x-artifactory-args: &artifactory-args + ARTIFACTORY_URL: http://172.24.0.1:8081/artifactory/repo + ARTIFACTORY_USER: "admin" + ARTIFACTORY_PASSWORD: "password" + services: accounting: - build: ./accounting-service + build: + context: ./accounting-service + args: + <<: *artifactory-args ports: - "8093:8093" laundry-management: - build: ./laundry-management-service + build: + context: ./laundry-management-service + args: + <<: *artifactory-args ports: - "8089:8089" order-management: - build: ./order-management-service + build: + context: ./order-management-service + args: + <<: *artifactory-args ports: - "8091:8091" tariff-management: - build: ./tariff-management-service + build: + context: ./tariff-management-service + args: + <<: *artifactory-args ports: - "8092:8092" taskcoordinator: diff --git a/laundry-management-service/Dockerfile b/laundry-management-service/Dockerfile index ca1368ce..ea6b5b70 100644 --- a/laundry-management-service/Dockerfile +++ b/laundry-management-service/Dockerfile @@ -1,4 +1,21 @@ +FROM gradle:5.4.1 AS builder + +ARG ARTIFACTORY_URL +ARG ARTIFACTORY_USER +ARG ARTIFACTORY_PASSWORD + +ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryUser=${ARTIFACTORY_USER} +# Enforce more security +ENV ORG_GRADLE_PROJECT_artifactoryPassword=${ARTIFACTORY_PASSWORD} + +WORKDIR /project + +COPY . /project + +RUN gradle :laundrymanagement-app:build + FROM openjdk:8-jre-alpine -COPY ./laundrymanagement-app/build/libs/laundry-management-service-app-0.1-SNAPSHOT.jar /laundry-management-service-app-0.1-SNAPSHOT.jar +COPY --from=builder /project/laundrymanagement-app/build/libs/laundry-management-service-app-0.1-SNAPSHOT.jar /laundry-management-service-app-0.1-SNAPSHOT.jar EXPOSE 8089 ENTRYPOINT ["java", "-jar", "laundry-management-service-app-0.1-SNAPSHOT.jar", "--spring.profiles.active=docker"] diff --git a/laundry-management-service/build.gradle b/laundry-management-service/build.gradle index 10aaca7c..3b4187da 100644 --- a/laundry-management-service/build.gradle +++ b/laundry-management-service/build.gradle @@ -22,10 +22,10 @@ allprojects { repositories { //mavenCentral() maven { - url "http://artifactory:8081/artifactory/repo" // The Artifactory (preferably virtual) repository to resolve from + url "${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) - username = "admin" // Artifactory user name - password = "password" // Password or API Key + username = "${artifactoryUser}" // Artifactory user name + password = "${artifactoryPassword}" // Password or API Key } } } diff --git a/order-management-service/Dockerfile b/order-management-service/Dockerfile index 4d1db769..be9224e5 100644 --- a/order-management-service/Dockerfile +++ b/order-management-service/Dockerfile @@ -1,4 +1,21 @@ +FROM gradle:5.4.1 AS builder + +ARG ARTIFACTORY_URL +ARG ARTIFACTORY_USER +ARG ARTIFACTORY_PASSWORD + +ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryUser=${ARTIFACTORY_USER} +# Enforce more security +ENV ORG_GRADLE_PROJECT_artifactoryPassword=${ARTIFACTORY_PASSWORD} + +WORKDIR /project + +COPY . /project + +RUN gradle :ordermanagement-app:build + FROM openjdk:8-jre-alpine -COPY ./ordermanagement-app/build/libs/order-management-service-app-0.1-SNAPSHOT.jar /order-management-service-app-0.1-SNAPSHOT.jar +COPY --from=builder /project/ordermanagement-app/build/libs/order-management-service-app-0.1-SNAPSHOT.jar /order-management-service-app-0.1-SNAPSHOT.jar EXPOSE 8091 ENTRYPOINT ["java", "-jar", "order-management-service-app-0.1-SNAPSHOT.jar", "--spring.profiles.active=docker"] diff --git a/order-management-service/build.gradle b/order-management-service/build.gradle index f292f591..cd44a4e1 100644 --- a/order-management-service/build.gradle +++ b/order-management-service/build.gradle @@ -7,10 +7,10 @@ allprojects { repositories { //mavenCentral() maven { - url "http://artifactory:8081/artifactory/repo" // The Artifactory (preferably virtual) repository to resolve from + url "${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) - username = "admin" // Artifactory user name - password = "password" // Password or API Key + username = "${artifactoryUser}" // Artifactory user name + password = "${artifactoryPassword}" // Password or API Key } } } diff --git a/tariff-management-service/Dockerfile b/tariff-management-service/Dockerfile index c8c98f3d..349d359b 100644 --- a/tariff-management-service/Dockerfile +++ b/tariff-management-service/Dockerfile @@ -1,4 +1,21 @@ +FROM gradle:5.4.1 AS builder + +ARG ARTIFACTORY_URL +ARG ARTIFACTORY_USER +ARG ARTIFACTORY_PASSWORD + +ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryUser=${ARTIFACTORY_USER} +# Enforce more security +ENV ORG_GRADLE_PROJECT_artifactoryPassword=${ARTIFACTORY_PASSWORD} + +WORKDIR /project + +COPY . /project + +RUN gradle :tariffmanagement-app:build + FROM openjdk:8-jre-alpine -COPY ./tariffmanagement-app/build/libs/tariff-management-service-app-0.1-SNAPSHOT.jar /tariff-management-service-app-0.1-SNAPSHOT.jar +COPY --from=builder /project/tariffmanagement-app/build/libs/tariff-management-service-app-0.1-SNAPSHOT.jar /tariff-management-service-app-0.1-SNAPSHOT.jar EXPOSE 8092 ENTRYPOINT ["java", "-jar", "tariff-management-service-app-0.1-SNAPSHOT.jar", "--spring.profiles.active=docker"] diff --git a/tariff-management-service/build.gradle b/tariff-management-service/build.gradle index e69de29b..1e3ae5c5 100644 --- a/tariff-management-service/build.gradle +++ b/tariff-management-service/build.gradle @@ -0,0 +1,23 @@ +plugins { + id 'java' + id "org.springframework.boot" version "2.1.4.RELEASE" +} + +allprojects { + repositories { + //mavenCentral() + maven { + url "${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from + credentials { // Optional resolver credentials (leave out to use anonymous resolution) + username = "${artifactoryUser}" // Artifactory user name + password = "${artifactoryPassword}" // Password or API Key + } + } + } + apply plugin: "java" + dependencies { + //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory + implementation "org.jfrog.buildinfo:build-info-extractor-gradle:4+" + } +} + diff --git a/tariff-management-service/tariffmanagement-api/build.gradle b/tariff-management-service/tariffmanagement-api/build.gradle index fa8809c5..afeb1431 100644 --- a/tariff-management-service/tariffmanagement-api/build.gradle +++ b/tariff-management-service/tariffmanagement-api/build.gradle @@ -1,24 +1,23 @@ -buildscript { +/*buildscript { repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE") } -} +}*/ -apply plugin: 'java' apply plugin: 'idea' apply plugin: 'io.spring.dependency-management' group 'com.microservices.tariffmanagement' version = apiVersion -repositories { +/*repositories { mavenLocal() mavenCentral() -} +}*/ dependencies { compile 'org.springframework.cloud:spring-cloud-openfeign-core' @@ -37,3 +36,39 @@ uploadArchives { mavenLocal() } } + +publishing { + publications { + mavenJava(MavenPublication) { + artifactId "${project.name}" + groupId = group + version = project.version + from components.java + } + } +} + +artifactory { + contextUrl = "http://artifactory:8081/artifactory" //The base Artifactory URL if not overridden by the publisher/resolver + publish { + repository { + repoKey = 'artifacts' + username = "admin" + password = "password" + maven = true + } + defaults { + publications('mavenJava') + publishArtifacts = true + } + } + resolve { + repository { + repoKey = 'repo' + username = "admin" + password = "password" + maven = true + + } + } +} diff --git a/tariff-management-service/tariffmanagement-app/build.gradle b/tariff-management-service/tariffmanagement-app/build.gradle index befd5abc..06fcbec3 100644 --- a/tariff-management-service/tariffmanagement-app/build.gradle +++ b/tariff-management-service/tariffmanagement-app/build.gradle @@ -1,13 +1,12 @@ -buildscript { +/*buildscript { repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE") } -} +}*/ -apply plugin: 'java' apply plugin: 'idea' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' @@ -20,10 +19,11 @@ bootJar { sourceCompatibility = 1.8 -repositories { +/*repositories { mavenLocal() mavenCentral() } +*/ dependencyManagement { imports { From 253ee690e56106fdb755002b54a0b8e531217b8f Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Tue, 10 Sep 2019 22:27:15 +0300 Subject: [PATCH 04/27] Extend git ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6aa11b3c..d8f804cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.gradle */.gradle */build/ */!gradle/wrapper/gradle-wrapper.jar From d2d21fba67929a38a84b5df0abaf6dcc0730edda Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Fri, 4 Oct 2019 18:06:57 +0300 Subject: [PATCH 05/27] Save up current changes --- .../accounting-api/build.gradle | 53 +++++++++++++++--- docker-compose-services.yml | 10 +++- docker-compose.yml | 2 +- laundry-management-service/build.gradle | 33 +---------- .../laundrymanagement-api/build.gradle | 16 +----- .../laundrymanagement-app/build.gradle | 5 +- .../ordermanagement-app/build.gradle | 6 +- .../tariffmanagement-api/build.gradle | 9 ++- taskcoordinator/build.gradle | 8 +-- user-management-service/Dockerfile | 21 ++++++- user-management-service/build.gradle | 22 ++++++++ .../usermanagement-api/build.gradle | 56 ++++++++++++++++--- .../usermanagement-app/build.gradle | 12 ++-- 13 files changed, 166 insertions(+), 87 deletions(-) diff --git a/accounting-service/accounting-api/build.gradle b/accounting-service/accounting-api/build.gradle index 74a948d6..c7c4df75 100644 --- a/accounting-service/accounting-api/build.gradle +++ b/accounting-service/accounting-api/build.gradle @@ -1,16 +1,19 @@ -buildscript { +/*buildscript { repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE") } -} +}*/ -apply plugin: 'java' -apply plugin: 'idea' -apply plugin: 'io.spring.dependency-management' +plugins { + id "com.jfrog.artifactory" version "4.9.8" + id 'maven-publish' + id 'idea' + id 'io.spring.dependency-management' +} group 'com.microservices.accounting.api' version = apiVersion @@ -19,10 +22,10 @@ jar { archiveBaseName = "accounting-api" } -repositories { +/*repositories { mavenLocal() mavenCentral() -} +}*/ dependencies { compile 'org.springframework.cloud:spring-cloud-openfeign-core' @@ -42,3 +45,39 @@ uploadArchives { mavenLocal() } } + +publishing { + publications { + mavenJava(MavenPublication) { + artifactId "${project.name}" + groupId = group + version = project.version + from components.java + } + } +} + +artifactory { + contextUrl = "http://artifactory:8081/artifactory" //The base Artifactory URL if not overridden by the publisher/resolver + publish { + repository { + repoKey = 'artifacts' + username = "admin" + password = "password" + maven = true + } + defaults { + publications('mavenJava') + publishArtifacts = true + } + } + resolve { + repository { + repoKey = 'repo' + username = "admin" + password = "password" + maven = true + + } + } +} \ No newline at end of file diff --git a/docker-compose-services.yml b/docker-compose-services.yml index 875140d5..8dfa800c 100644 --- a/docker-compose-services.yml +++ b/docker-compose-services.yml @@ -35,10 +35,16 @@ services: ports: - "8092:8092" taskcoordinator: - build: ./taskcoordinator + build: + context: ./taskcoordinator + args: + <<: *artifactory-args ports: - "8095:8095" user-management: - build: ./user-management-service + build: + context: ./user-management-service + args: + <<: *artifactory-args ports: - "8094:8094" \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 9c76ad9a..43d0ea32 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '2' +version: '3.4' services: zookeeper: image: wurstmeister/zookeeper diff --git a/laundry-management-service/build.gradle b/laundry-management-service/build.gradle index 3b4187da..cd44a4e1 100644 --- a/laundry-management-service/build.gradle +++ b/laundry-management-service/build.gradle @@ -1,21 +1,6 @@ -/*buildscript { -/* repositories { - //mavenCentral() - maven { - url "http://artifactory:8081/artifactory/repo" // The Artifactory (preferably virtual) repository to resolve from - credentials { // Optional resolver credentials (leave out to use anonymous resolution) - username = "admin" // Artifactory user name - password = "password" // Password or API Key - } - } - } - -}*/ - plugins { id 'java' - id "com.jfrog.artifactory" version "4.9.8" - id 'maven-publish' + id "org.springframework.boot" version "2.1.4.RELEASE" } allprojects { @@ -34,20 +19,4 @@ allprojects { //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory implementation "org.jfrog.buildinfo:build-info-extractor-gradle:4+" } - artifactoryPublish.skip = true - /* - publishing { - publications { - mavenJava(MavenPublication) { - from components.java - } - } - }*/ - // apply plugin: "com.jfrog.artifactory" } - -configure(subprojects.findAll { it.name =~ /.*-api/ }) { - artifactoryPublish.skip = false - apply plugin: "maven-publish" - apply plugin: "com.jfrog.artifactory" -} \ No newline at end of file diff --git a/laundry-management-service/laundrymanagement-api/build.gradle b/laundry-management-service/laundrymanagement-api/build.gradle index 60dec96e..8946ddb9 100644 --- a/laundry-management-service/laundrymanagement-api/build.gradle +++ b/laundry-management-service/laundrymanagement-api/build.gradle @@ -1,19 +1,7 @@ plugins { -/* id 'java' */ id 'com.google.protobuf' version '0.8.8' -/* id "com.jfrog.artifactory" version "4.9.8" */ -} - -repositories { - maven { - url "http://artifactory:8081/artifactory/repo" // The Artifactory (preferably virtual) repository to resolve from - credentials { // Optional resolver credentials (leave out to use anonymous resolution) - username = "admin" // Artifactory user name - password = "password" // Password or API Key - } - } - - // mavenCentral() + id "com.jfrog.artifactory" version "4.9.8" + id 'maven-publish' } group = 'com.microservices.laundrymanagement' diff --git a/laundry-management-service/laundrymanagement-app/build.gradle b/laundry-management-service/laundrymanagement-app/build.gradle index 7f769e7a..46f2eccb 100644 --- a/laundry-management-service/laundrymanagement-app/build.gradle +++ b/laundry-management-service/laundrymanagement-app/build.gradle @@ -6,11 +6,8 @@ // classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE' //} -plugins { - id "org.springframework.boot" version "2.1.4.RELEASE" -} apply plugin: 'idea' -// apply plugin: 'org.springframework.boot' +apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' /* apply plugin: "com.jfrog.artifactory" */ diff --git a/order-management-service/ordermanagement-app/build.gradle b/order-management-service/ordermanagement-app/build.gradle index 31d939ae..e659252b 100644 --- a/order-management-service/ordermanagement-app/build.gradle +++ b/order-management-service/ordermanagement-app/build.gradle @@ -17,10 +17,10 @@ bootJar { sourceCompatibility = 1.8 -repositories { +/*repositories { mavenCentral() mavenLocal() -} +}*/ dependencyManagement { imports { @@ -33,7 +33,7 @@ dependencies { compile 'org.springframework.boot:spring-boot-starter-data-jpa' compile 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client' compile 'org.springframework.cloud:spring-cloud-starter-zipkin' - compile "com.microservices.ordermanagement.api:ordermanagement-api:${orderManagementApiVersion}" + compile "com.microservices.ordermanagement:ordermanagement-api:${orderManagementApiVersion}" compile "com.microservices.laundrymanagement:laundrymanagement-api:${laundryManagementApiVersion}" compile 'com.google.protobuf:protobuf-java:3.8.0' compile 'org.flywaydb:flyway-core:5.2.4' diff --git a/tariff-management-service/tariffmanagement-api/build.gradle b/tariff-management-service/tariffmanagement-api/build.gradle index afeb1431..bffe3b4d 100644 --- a/tariff-management-service/tariffmanagement-api/build.gradle +++ b/tariff-management-service/tariffmanagement-api/build.gradle @@ -7,9 +7,12 @@ } }*/ - -apply plugin: 'idea' -apply plugin: 'io.spring.dependency-management' +plugins { + id 'io.spring.dependency-management' + id "com.jfrog.artifactory" version "4.9.8" + id 'maven-publish' + id 'idea' +} group 'com.microservices.tariffmanagement' version = apiVersion diff --git a/taskcoordinator/build.gradle b/taskcoordinator/build.gradle index f292f591..715f32e5 100644 --- a/taskcoordinator/build.gradle +++ b/taskcoordinator/build.gradle @@ -7,10 +7,10 @@ allprojects { repositories { //mavenCentral() maven { - url "http://artifactory:8081/artifactory/repo" // The Artifactory (preferably virtual) repository to resolve from + url "${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) - username = "admin" // Artifactory user name - password = "password" // Password or API Key + username = "${artifactoryUser}" // Artifactory user name + password = "${artifactoryPassword}" // Password or API Key } } } @@ -19,4 +19,4 @@ allprojects { //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory implementation "org.jfrog.buildinfo:build-info-extractor-gradle:4+" } -} +} \ No newline at end of file diff --git a/user-management-service/Dockerfile b/user-management-service/Dockerfile index 892be4b7..ccb71d8d 100644 --- a/user-management-service/Dockerfile +++ b/user-management-service/Dockerfile @@ -1,4 +1,21 @@ +FROM gradle:5.4.1 AS builder + +ARG ARTIFACTORY_URL +ARG ARTIFACTORY_USER +ARG ARTIFACTORY_PASSWORD + +ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryUser=${ARTIFACTORY_USER} +# Enforce more security +ENV ORG_GRADLE_PROJECT_artifactoryPassword=${ARTIFACTORY_PASSWORD} + +WORKDIR /project + +COPY . /project + +RUN gradle -Dorg.gradle.daemon=false :usermanagement-app:build + FROM openjdk:8-jre-alpine -COPY ./usermanagement-app/build/libs/user-management-service-0.1-SNAPSHOT.jar /user-management-service-0.1-SNAPSHOT.jar +COPY --from=builder /project/usermanagement-app/build/libs/usermanagement-service-app-0.1-SNAPSHOT.jar /user-management-service-app-0.1-SNAPSHOT.jar EXPOSE 8094 -ENTRYPOINT ["java", "-jar", "user-management-service-0.1-SNAPSHOT.jar", "--spring.profiles.active=docker"] +ENTRYPOINT ["java", "-jar", "user-management-service-app-0.1-SNAPSHOT.jar", "--spring.profiles.active=docker"] diff --git a/user-management-service/build.gradle b/user-management-service/build.gradle index e69de29b..cd44a4e1 100644 --- a/user-management-service/build.gradle +++ b/user-management-service/build.gradle @@ -0,0 +1,22 @@ +plugins { + id 'java' + id "org.springframework.boot" version "2.1.4.RELEASE" +} + +allprojects { + repositories { + //mavenCentral() + maven { + url "${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from + credentials { // Optional resolver credentials (leave out to use anonymous resolution) + username = "${artifactoryUser}" // Artifactory user name + password = "${artifactoryPassword}" // Password or API Key + } + } + } + apply plugin: "java" + dependencies { + //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory + implementation "org.jfrog.buildinfo:build-info-extractor-gradle:4+" + } +} diff --git a/user-management-service/usermanagement-api/build.gradle b/user-management-service/usermanagement-api/build.gradle index ad2cd92d..daa6fa91 100644 --- a/user-management-service/usermanagement-api/build.gradle +++ b/user-management-service/usermanagement-api/build.gradle @@ -1,27 +1,29 @@ -buildscript { +/*buildscript { repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE") } -} - +}*/ -apply plugin: 'java' -apply plugin: 'idea' -apply plugin: 'io.spring.dependency-management' +plugins { + id "com.jfrog.artifactory" version "4.9.8" + id 'maven-publish' + id 'idea' + id 'io.spring.dependency-management' +} -group 'com.microservices.usermanagement.api' +group 'com.microservices.usermanagement' version = apiVersion jar { archiveBaseName = "usermanagement-api" } -repositories { +/*repositories { mavenCentral() -} +}*/ dependencies { compile 'org.springframework.cloud:spring-cloud-openfeign-core' @@ -40,3 +42,39 @@ uploadArchives { mavenLocal() } } + +publishing { + publications { + mavenJava(MavenPublication) { + artifactId "${project.name}" + groupId = group + version = project.version + from components.java + } + } +} + +artifactory { + contextUrl = "http://artifactory:8081/artifactory" //The base Artifactory URL if not overridden by the publisher/resolver + publish { + repository { + repoKey = 'artifacts' + username = "admin" + password = "password" + maven = true + } + defaults { + publications('mavenJava') + publishArtifacts = true + } + } + resolve { + repository { + repoKey = 'repo' + username = "admin" + password = "password" + maven = true + + } + } +} \ No newline at end of file diff --git a/user-management-service/usermanagement-app/build.gradle b/user-management-service/usermanagement-app/build.gradle index fd905a58..c87e98c8 100644 --- a/user-management-service/usermanagement-app/build.gradle +++ b/user-management-service/usermanagement-app/build.gradle @@ -1,11 +1,11 @@ -buildscript { +/*buildscript { repositories { mavenCentral() } dependencies { classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE' } -} +}*/ apply plugin: 'java' apply plugin: 'idea' @@ -13,20 +13,20 @@ apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' bootJar { - baseName = 'usermanagement-app' + baseName = 'usermanagement-service-app' version = applicationVersion enabled = true } sourceCompatibility = 1.8 -repositories { +/*repositories { mavenLocal() mavenCentral() -} +}*/ dependencies { - compile "com.microservices.usermanagement.api:usermanagementapi:${userManagementApiVersion}" + compile "com.microservices.usermanagement:usermanagement-api:${userManagementApiVersion}" compile 'org.springframework.boot:spring-boot-starter-web' compile 'org.springframework.boot:spring-boot-starter-data-jpa' compile 'org.flywaydb:flyway-core:5.2.4' From 12c3bb7599f092036b6e34ba6b77947b363eea67 Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Fri, 4 Oct 2019 20:10:02 +0300 Subject: [PATCH 06/27] Fix up api-deployer --- api-deployer/api-deployer.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api-deployer/api-deployer.sh b/api-deployer/api-deployer.sh index 3b34ba4b..9afab948 100644 --- a/api-deployer/api-deployer.sh +++ b/api-deployer/api-deployer.sh @@ -7,7 +7,9 @@ API_PROJECTS=" laundry-management-service/laundrymanagement-api order-management-service/ordermanagement-api taskcoordinator/taskcoordinator-api - tariff-management-service/api + tariff-management-service/tariffmanagement-api + accounting-service/accounting-api + user-management-service/usermanagement-api " WORKDIR="${PWD}" From ff2349de7511139f050decf35880aead667edb1a Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Fri, 4 Oct 2019 20:24:09 +0300 Subject: [PATCH 07/27] Put docker files in order --- grafana/docker-build/dockerfile | 2 +- order-management-service/Dockerfile | 2 +- taskcoordinator/Dockerfile | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/grafana/docker-build/dockerfile b/grafana/docker-build/dockerfile index 58c7b77f..01d9458a 100644 --- a/grafana/docker-build/dockerfile +++ b/grafana/docker-build/dockerfile @@ -1,4 +1,4 @@ -FROM grafana/grafana +FROM grafana/grafana:v6.3.0-beta2 COPY ./entrypoint.sh /entrypoint.sh diff --git a/order-management-service/Dockerfile b/order-management-service/Dockerfile index be9224e5..855b7a84 100644 --- a/order-management-service/Dockerfile +++ b/order-management-service/Dockerfile @@ -13,7 +13,7 @@ WORKDIR /project COPY . /project -RUN gradle :ordermanagement-app:build +RUN gradle -Dorg.gradle.daemon=false :ordermanagement-app:build FROM openjdk:8-jre-alpine COPY --from=builder /project/ordermanagement-app/build/libs/order-management-service-app-0.1-SNAPSHOT.jar /order-management-service-app-0.1-SNAPSHOT.jar diff --git a/taskcoordinator/Dockerfile b/taskcoordinator/Dockerfile index 44cf52a6..6e2c1f60 100644 --- a/taskcoordinator/Dockerfile +++ b/taskcoordinator/Dockerfile @@ -1,5 +1,22 @@ +FROM gradle:5.4.1 AS builder + +ARG ARTIFACTORY_URL +ARG ARTIFACTORY_USER +ARG ARTIFACTORY_PASSWORD + +ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryUser=${ARTIFACTORY_USER} +# Enforce more security +ENV ORG_GRADLE_PROJECT_artifactoryPassword=${ARTIFACTORY_PASSWORD} + +WORKDIR /project + +COPY . /project + +RUN gradle -Dorg.gradle.daemon=false -x test :taskcoordinator-app:build + FROM openjdk:8-jre-alpine -COPY ./taskcoordinator-app/build/libs/taskcoordinator-app-0.1-SNAPSHOT.jar /taskcoordinator-app-0.1-SNAPSHOT.jar +COPY --from=builder /project/taskcoordinator-app/build/libs/taskcoordinator-app-0.1-SNAPSHOT.jar /taskcoordinator-app-0.1-SNAPSHOT.jar EXPOSE 8095 # Hostname is a command in a docker container that returns the container id. # In order to enable subshell substitution, shell form is used From eeb23fa05f838f250959c628c509e1abc94040c9 Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Fri, 4 Oct 2019 20:55:17 +0300 Subject: [PATCH 08/27] Fix up grafana once more --- grafana/docker-build/dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grafana/docker-build/dockerfile b/grafana/docker-build/dockerfile index 01d9458a..4c6e74cc 100644 --- a/grafana/docker-build/dockerfile +++ b/grafana/docker-build/dockerfile @@ -1,4 +1,4 @@ -FROM grafana/grafana:v6.3.0-beta2 +FROM grafana/grafana:6.3.6 COPY ./entrypoint.sh /entrypoint.sh From 5bbd0b986164af9200ab9ab28f4581f31a727330 Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Fri, 4 Oct 2019 22:22:33 +0300 Subject: [PATCH 09/27] Fix up services monitoring --- api-gateway-service/src/main/resources/application.yml | 4 ++-- artifactory/.dockerignore | 1 + grafana/docker-build/dockerfile | 4 +++- grafana/provisioning/datasources/elastic.yml | 4 ++-- .../src/main/resources/application-docker.properties | 3 ++- 5 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 artifactory/.dockerignore diff --git a/api-gateway-service/src/main/resources/application.yml b/api-gateway-service/src/main/resources/application.yml index 45a085b6..2533a180 100644 --- a/api-gateway-service/src/main/resources/application.yml +++ b/api-gateway-service/src/main/resources/application.yml @@ -5,7 +5,7 @@ spring: eureka: client: serviceUrl: - defaultZone: http://localhost:8761/eureka/ + defaultZone: http://eureka:8761/eureka/ zuul: routes: @@ -16,4 +16,4 @@ zuul: tariffs: path: /tariffs/** serviceId: tariff-management-service - strip-prefix: false \ No newline at end of file + strip-prefix: false diff --git a/artifactory/.dockerignore b/artifactory/.dockerignore new file mode 100644 index 00000000..4833bbb0 --- /dev/null +++ b/artifactory/.dockerignore @@ -0,0 +1 @@ +volume diff --git a/grafana/docker-build/dockerfile b/grafana/docker-build/dockerfile index 4c6e74cc..5e3ab446 100644 --- a/grafana/docker-build/dockerfile +++ b/grafana/docker-build/dockerfile @@ -9,5 +9,7 @@ RUN \ && apt-get -y install gettext-base \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* + +RUN chmod a+x /entrypoint.sh -ENTRYPOINT [ "/entrypoint.sh" ] \ No newline at end of file +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/grafana/provisioning/datasources/elastic.yml b/grafana/provisioning/datasources/elastic.yml index f417a3de..d818cbd1 100644 --- a/grafana/provisioning/datasources/elastic.yml +++ b/grafana/provisioning/datasources/elastic.yml @@ -7,9 +7,9 @@ datasources: access: direct # Index name database: ${index.name} - url: http://localhost:9200 + url: http://elasticsearch:9200 jsonData: # Field used as time timeField: "@timestamp" # Elasticsearch version (as number, without dot) - esVersion: 70 \ No newline at end of file + esVersion: 70 diff --git a/tariff-management-service/tariffmanagement-app/src/main/resources/application-docker.properties b/tariff-management-service/tariffmanagement-app/src/main/resources/application-docker.properties index 0ca50665..b03d8148 100644 --- a/tariff-management-service/tariffmanagement-app/src/main/resources/application-docker.properties +++ b/tariff-management-service/tariffmanagement-app/src/main/resources/application-docker.properties @@ -1,2 +1,3 @@ # Database properties -spring.datasource.url=jdbc:postgresql://postgres:5432/laundry_db \ No newline at end of file +spring.datasource.url=jdbc:postgresql://postgres:5432/laundry_db +eureka.client.serviceUrl.defaultZone=http://eureka:8761/eureka/ From 95e2ba24fb62d8d3f28d4d65bbd72da043cdd6a7 Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Fri, 4 Oct 2019 22:23:30 +0300 Subject: [PATCH 10/27] Grafana changes --- .../dashboards/tc-dashboard/order-metrics.json | 10 +++++----- .../dashboards/tc-dashboard/tc-dashboard.json | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/grafana/provisioning/dashboards/tc-dashboard/order-metrics.json b/grafana/provisioning/dashboards/tc-dashboard/order-metrics.json index c3b9d5d9..a62c334f 100644 --- a/grafana/provisioning/dashboards/tc-dashboard/order-metrics.json +++ b/grafana/provisioning/dashboards/tc-dashboard/order-metrics.json @@ -742,8 +742,8 @@ "list": [ { "current": { - "text": "20s", - "value": "20s" + "text": "10s", + "value": "10s" }, "hide": 2, "label": null, @@ -751,11 +751,11 @@ "options": [ { "selected": true, - "text": "20s", - "value": "20s" + "text": "10s", + "value": "10s" } ], - "query": "20s", + "query": "10s", "skipUrlSync": false, "type": "constant" }, diff --git a/grafana/provisioning/dashboards/tc-dashboard/tc-dashboard.json b/grafana/provisioning/dashboards/tc-dashboard/tc-dashboard.json index 6a237045..202d0a85 100644 --- a/grafana/provisioning/dashboards/tc-dashboard/tc-dashboard.json +++ b/grafana/provisioning/dashboards/tc-dashboard/tc-dashboard.json @@ -333,7 +333,7 @@ "type": "sum" } ], - "query": "name:jvm_gc_memory_* AND instance:$instance", + "query": "name:jvm_gc_memory_* AND instance.keyword:$instance", "refId": "A", "timeField": "@timestamp" } @@ -1630,8 +1630,8 @@ }, { "current": { - "text": "20s", - "value": "20s" + "text": "10s", + "value": "10s" }, "hide": 2, "label": null, @@ -1639,11 +1639,11 @@ "options": [ { "selected": true, - "text": "20s", - "value": "20s" + "text": "10s", + "value": "10s" } ], - "query": "20s", + "query": "10s", "skipUrlSync": false, "type": "constant" } From acbed460661962ccc854c63f2c846540766ed9f3 Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Fri, 4 Oct 2019 22:31:42 +0300 Subject: [PATCH 11/27] Improve .gitignore --- .gitignore | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d8f804cb..5d82761e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ */.gradle */build/ */!gradle/wrapper/gradle-wrapper.jar +*.class .idea *.iws @@ -11,4 +12,15 @@ #pattern for excluding generated proto files from git **/api/messages/ **/api/events/ -artifactory/volume/ \ No newline at end of file + +# Docker volumes +artifactory/volume/ + +# Auto-generated +.project +.classpath +org.eclipse.buildship.core.prefs + +# Other +api-gateway-service/bin/main/application.yml +eureka-service-discovery/bin/main/application.yml \ No newline at end of file From ddc42b24221e0b6d688bd45a4cf4ee6037ec79c3 Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 15:49:44 +0300 Subject: [PATCH 12/27] Fix up artifactory deployment --- artifactory/Dockerfile | 6 ++++-- artifactory/entrypoint.sh | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/artifactory/Dockerfile b/artifactory/Dockerfile index cf4ff12b..d59cbc2c 100644 --- a/artifactory/Dockerfile +++ b/artifactory/Dockerfile @@ -1,6 +1,8 @@ FROM docker.bintray.io/jfrog/artifactory-oss COPY ./entrypoint.sh /entrypoint.sh -# RUN chmod a+x /entrypoint.sh -ENTRYPOINT [ "/bin/bash", "/entrypoint.sh" ] \ No newline at end of file +ENTRYPOINT [ "/bin/bash", "/entrypoint.sh" ] + +# Required for chown +USER "root" diff --git a/artifactory/entrypoint.sh b/artifactory/entrypoint.sh index c478bc9c..4c64e7b5 100644 --- a/artifactory/entrypoint.sh +++ b/artifactory/entrypoint.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash -# XXX: Fix up permissions on volume in Windows(Hyper-V) -chown -R artifact:artifact /var/opt/jfrog/artifactory +# XXX: Fix up permissions on volume in Windows(Hyper-V) and Linux +chown -R artifactory:artifactory /var/opt/jfrog/artifactory -exec /entrypoint-artifactory.sh \ No newline at end of file +# Return from root under expected user +exec su artifactory /entrypoint-artifactory.sh From ffc3994f97624487402299444ffcd1b56f5def8c Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 16:04:30 +0300 Subject: [PATCH 13/27] Include repo setup in api-deployer --- api-deployer/Dockerfile | 4 + api-deployer/config.yml | 354 +++++++++++++++++++++++++++++++++++++ api-deployer/repo-setup.sh | 7 + docker-compose-storage.yml | 7 + 4 files changed, 372 insertions(+) create mode 100644 api-deployer/config.yml create mode 100644 api-deployer/repo-setup.sh diff --git a/api-deployer/Dockerfile b/api-deployer/Dockerfile index 942c0bca..e57ebe5c 100644 --- a/api-deployer/Dockerfile +++ b/api-deployer/Dockerfile @@ -1,6 +1,10 @@ FROM gradle:5.4.1 COPY ./api-deployer.sh /api-deployer.sh +COPY ./config.yml /artifactory.yml +COPY ./repo-setup.sh /setup.sh + +RUN chmod +x /api-deployer.sh /setup.sh RUN apt-get update && apt-get install -y vim diff --git a/api-deployer/config.yml b/api-deployer/config.yml new file mode 100644 index 00000000..cb6a5c53 --- /dev/null +++ b/api-deployer/config.yml @@ -0,0 +1,354 @@ + +localRepositories: + "artifactory-build-info": + type: buildinfo + description: "Build Info repository" + includesPattern: "**/*" + repoLayout: "simple-default" + dockerApiVersion: V2 + forceNugetAuthentication: false + blackedOut: false + handleReleases: true + handleSnapshots: true + maxUniqueSnapshots: 0 + maxUniqueTags: 0 + suppressPomConsistencyChecks: true + propertySets: + archiveBrowsingEnabled: false + snapshotVersionBehavior: unique + checksumPolicyType: "client-checksums" + calculateYumMetadata: false + yumRootDepth: 0 + debianTrivialLayout: false + enableFileListsIndexing: false + + artifacts: + type: gradle + includesPattern: "**/*" + repoLayout: "gradle-default" + dockerApiVersion: V2 + forceNugetAuthentication: false + blackedOut: false + handleReleases: true + handleSnapshots: true + maxUniqueSnapshots: 0 + maxUniqueTags: 0 + suppressPomConsistencyChecks: true + propertySets: + archiveBrowsingEnabled: false + snapshotVersionBehavior: unique + checksumPolicyType: "client-checksums" + calculateYumMetadata: false + yumRootDepth: 0 + debianTrivialLayout: false + enableFileListsIndexing: false + + "gradle-dev-local": + type: gradle + includesPattern: "**/*" + repoLayout: "gradle-default" + dockerApiVersion: V2 + forceNugetAuthentication: false + blackedOut: false + handleReleases: true + handleSnapshots: true + maxUniqueSnapshots: 0 + maxUniqueTags: 0 + suppressPomConsistencyChecks: true + propertySets: + archiveBrowsingEnabled: false + snapshotVersionBehavior: unique + checksumPolicyType: "client-checksums" + calculateYumMetadata: false + yumRootDepth: 0 + debianTrivialLayout: false + enableFileListsIndexing: false + + "gradle-release-local": + type: gradle + includesPattern: "**/*" + repoLayout: "gradle-default" + dockerApiVersion: V2 + forceNugetAuthentication: false + blackedOut: false + handleReleases: true + handleSnapshots: true + maxUniqueSnapshots: 0 + maxUniqueTags: 0 + suppressPomConsistencyChecks: true + propertySets: + archiveBrowsingEnabled: false + snapshotVersionBehavior: unique + checksumPolicyType: "client-checksums" + calculateYumMetadata: false + yumRootDepth: 0 + debianTrivialLayout: false + enableFileListsIndexing: false + + "libs-release-local": + type: maven + includesPattern: "**/*" + repoLayout: "maven-2-default" + dockerApiVersion: V2 + forceNugetAuthentication: false + blackedOut: false + handleReleases: true + handleSnapshots: false + maxUniqueSnapshots: 0 + maxUniqueTags: 0 + suppressPomConsistencyChecks: false + propertySets: + archiveBrowsingEnabled: false + snapshotVersionBehavior: unique + checksumPolicyType: "client-checksums" + calculateYumMetadata: false + yumRootDepth: 0 + debianTrivialLayout: false + enableFileListsIndexing: false + + "libs-snapshot-local": + type: maven + includesPattern: "**/*" + repoLayout: "maven-2-default" + dockerApiVersion: V2 + forceNugetAuthentication: false + blackedOut: false + handleReleases: false + handleSnapshots: true + maxUniqueSnapshots: 0 + maxUniqueTags: 0 + suppressPomConsistencyChecks: false + propertySets: + archiveBrowsingEnabled: false + snapshotVersionBehavior: unique + checksumPolicyType: "client-checksums" + calculateYumMetadata: false + yumRootDepth: 0 + debianTrivialLayout: false + enableFileListsIndexing: false + +remoteRepositories: + "gradle-plugins": + type: gradle + includesPattern: "**/*" + repoLayout: "gradle-default" + dockerApiVersion: V2 + forceNugetAuthentication: false + blackedOut: false + handleReleases: true + handleSnapshots: true + maxUniqueSnapshots: 0 + maxUniqueTags: 0 + suppressPomConsistencyChecks: true + propertySets: + archiveBrowsingEnabled: false + url: "https://plugins.gradle.org/m2/" + offline: false + hardFail: false + storeArtifactsLocally: true + fetchJarsEagerly: false + fetchSourcesEagerly: false + retrievalCachePeriodSecs: 600 + assumedOfflinePeriodSecs: 300 + missedRetrievalCachePeriodSecs: 1800 + remoteRepoChecksumPolicyType: "generate-if-absent" + unusedArtifactsCleanupPeriodHours: 0 + shareConfiguration: false + synchronizeProperties: false + listRemoteFolderItems: true + rejectInvalidJars: false + p2OriginalUrl: "https://plugins.gradle.org/m2/" + contentSynchronisation: + enabled: false + blockMismatchingMimeTypes: true + mismatchingMimeTypesOverrideList: "" + bypassHeadRequests: false + allowAnyHostAuth: false + socketTimeoutMillis: 15000 + enableCookieManagement: false + enableTokenAuthentication: false + propagateQueryParams: false + + jcenter: + type: maven + includesPattern: "**/*" + repoLayout: "maven-2-default" + dockerApiVersion: V2 + forceNugetAuthentication: false + blackedOut: false + handleReleases: true + handleSnapshots: true + maxUniqueSnapshots: 0 + maxUniqueTags: 0 + suppressPomConsistencyChecks: false + propertySets: + archiveBrowsingEnabled: false + url: "https://jcenter.bintray.com" + offline: false + hardFail: false + storeArtifactsLocally: true + fetchJarsEagerly: false + fetchSourcesEagerly: false + retrievalCachePeriodSecs: 600 + assumedOfflinePeriodSecs: 300 + missedRetrievalCachePeriodSecs: 1800 + remoteRepoChecksumPolicyType: "generate-if-absent" + unusedArtifactsCleanupPeriodHours: 0 + shareConfiguration: false + synchronizeProperties: false + listRemoteFolderItems: true + rejectInvalidJars: false + p2OriginalUrl: "https://jcenter.bintray.com" + contentSynchronisation: + enabled: false + blockMismatchingMimeTypes: true + mismatchingMimeTypesOverrideList: "" + bypassHeadRequests: false + allowAnyHostAuth: false + socketTimeoutMillis: 15000 + enableCookieManagement: false + enableTokenAuthentication: false + propagateQueryParams: false + + "maven-central": + type: maven + includesPattern: "**/*" + repoLayout: "maven-2-default" + dockerApiVersion: V2 + forceNugetAuthentication: false + blackedOut: false + handleReleases: true + handleSnapshots: true + maxUniqueSnapshots: 0 + maxUniqueTags: 0 + suppressPomConsistencyChecks: false + propertySets: + archiveBrowsingEnabled: false + url: "https://repo1.maven.org/maven2/" + offline: false + hardFail: false + storeArtifactsLocally: true + fetchJarsEagerly: false + fetchSourcesEagerly: false + retrievalCachePeriodSecs: 600 + assumedOfflinePeriodSecs: 300 + missedRetrievalCachePeriodSecs: 1800 + remoteRepoChecksumPolicyType: "generate-if-absent" + unusedArtifactsCleanupPeriodHours: 0 + shareConfiguration: false + synchronizeProperties: false + listRemoteFolderItems: true + rejectInvalidJars: false + p2OriginalUrl: "https://repo1.maven.org/maven2/" + contentSynchronisation: + enabled: false + blockMismatchingMimeTypes: true + mismatchingMimeTypesOverrideList: "" + bypassHeadRequests: false + allowAnyHostAuth: false + socketTimeoutMillis: 15000 + enableCookieManagement: false + enableTokenAuthentication: false + propagateQueryParams: false + +virtualRepositories: + "gradle-dev": + type: gradle + includesPattern: "**/*" + repoLayout: "gradle-default" + dockerApiVersion: V2 + forceNugetAuthentication: false + artifactoryRequestsCanRetrieveRemoteArtifacts: false + resolveDockerTagsByTimestamp: false + repositories: + - "gradle-dev-local" + - jcenter + pomRepositoryReferencesCleanupPolicy: discard_active_reference + defaultDeploymentRepo: "gradle-dev-local" + virtualCacheConfig: + virtualRetrievalCachePeriodSecs: 600 + forceMavenAuthentication: false + debianDefaultArchitectures: "i386,amd64" + + "gradle-release": + type: gradle + includesPattern: "**/*" + repoLayout: "gradle-default" + dockerApiVersion: V2 + forceNugetAuthentication: false + artifactoryRequestsCanRetrieveRemoteArtifacts: false + resolveDockerTagsByTimestamp: false + repositories: + - "gradle-release-local" + - jcenter + pomRepositoryReferencesCleanupPolicy: discard_active_reference + defaultDeploymentRepo: "gradle-release-local" + virtualCacheConfig: + virtualRetrievalCachePeriodSecs: 600 + forceMavenAuthentication: false + debianDefaultArchitectures: "i386,amd64" + + "libs-release": + type: maven + includesPattern: "**/*" + repoLayout: "maven-2-default" + dockerApiVersion: V2 + forceNugetAuthentication: false + artifactoryRequestsCanRetrieveRemoteArtifacts: false + resolveDockerTagsByTimestamp: false + repositories: + - "libs-release-local" + - jcenter + pomRepositoryReferencesCleanupPolicy: discard_active_reference + defaultDeploymentRepo: "libs-release-local" + virtualCacheConfig: + virtualRetrievalCachePeriodSecs: 600 + forceMavenAuthentication: false + debianDefaultArchitectures: "i386,amd64" + + "libs-snapshot": + type: maven + includesPattern: "**/*" + repoLayout: "maven-2-default" + dockerApiVersion: V2 + forceNugetAuthentication: false + artifactoryRequestsCanRetrieveRemoteArtifacts: false + resolveDockerTagsByTimestamp: false + repositories: + - "libs-snapshot-local" + - jcenter + pomRepositoryReferencesCleanupPolicy: discard_active_reference + defaultDeploymentRepo: "libs-snapshot-local" + virtualCacheConfig: + virtualRetrievalCachePeriodSecs: 600 + forceMavenAuthentication: false + debianDefaultArchitectures: "i386,amd64" + + repo: + type: gradle + includesPattern: "**/*" + repoLayout: "gradle-default" + dockerApiVersion: V2 + forceNugetAuthentication: false + artifactoryRequestsCanRetrieveRemoteArtifacts: false + resolveDockerTagsByTimestamp: false + repositories: + - artifacts + - "gradle-dev-local" + - "gradle-release-local" + - "libs-release-local" + - "libs-snapshot-local" + - "gradle-plugins" + - jcenter + - "maven-central" + - "gradle-dev" + - "gradle-release" + - "libs-release" + - "libs-snapshot" + pomRepositoryReferencesCleanupPolicy: discard_active_reference + defaultDeploymentRepo: artifacts + virtualCacheConfig: + virtualRetrievalCachePeriodSecs: 600 + forceMavenAuthentication: false + debianDefaultArchitectures: "i386,amd64" + diff --git a/api-deployer/repo-setup.sh b/api-deployer/repo-setup.sh new file mode 100644 index 00000000..e3566bfd --- /dev/null +++ b/api-deployer/repo-setup.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +curl --user "${ORG_GRADLE_PROJECT_artifactoryUser}:${ORG_GRADLE_PROJECT_artifactoryPassword}" \ + --request PATCH \ + --header "Content-Type:application/yaml" \ + --upload-file /artifactory.yml \ + "${ORG_GRADLE_PROJECT_artifactoryUrl}/api/system/configuration" diff --git a/docker-compose-storage.yml b/docker-compose-storage.yml index 9c68f395..94c37fe2 100644 --- a/docker-compose-storage.yml +++ b/docker-compose-storage.yml @@ -10,6 +10,7 @@ services: - "8081:8081" volumes: - "./artifactory/volume:/var/opt/jfrog/artifactory" + api-deployer: build: ./api-deployer image: api-deployer @@ -17,3 +18,9 @@ services: working_dir: "/project" volumes: - ".:/project" + environment: + ORG_GRADLE_PROJECT_artifactoryUrl: "https://artifactory:8081/artifactory" + ORG_GRADLE_PROJECT_artifactoryUser: admin + ORG_GRADLE_PROJECT_artifactoryPassword: password + # TODO: Replace after refactoring with repo name + ORG_GRADLE_PROJECT_artifactoryRepo: "https://artifactory:8081/artifactory/repo" From 96e6ec71d499ef71ec2ca58027e00a4ccb708e6a Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 16:07:18 +0300 Subject: [PATCH 14/27] Do not try to use artifactory by SSL for now --- docker-compose-storage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose-storage.yml b/docker-compose-storage.yml index 94c37fe2..56a3f498 100644 --- a/docker-compose-storage.yml +++ b/docker-compose-storage.yml @@ -19,8 +19,8 @@ services: volumes: - ".:/project" environment: - ORG_GRADLE_PROJECT_artifactoryUrl: "https://artifactory:8081/artifactory" + ORG_GRADLE_PROJECT_artifactoryUrl: "http://artifactory:8081/artifactory" ORG_GRADLE_PROJECT_artifactoryUser: admin ORG_GRADLE_PROJECT_artifactoryPassword: password # TODO: Replace after refactoring with repo name - ORG_GRADLE_PROJECT_artifactoryRepo: "https://artifactory:8081/artifactory/repo" + ORG_GRADLE_PROJECT_artifactoryRepo: "http://artifactory:8081/artifactory/repo" From e7ae9c8ca1788cdc69e8a88f8e135398553024c6 Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 16:27:29 +0300 Subject: [PATCH 15/27] Parametrize artifactory usage properly --- accounting-service/Dockerfile | 4 +++- accounting-service/accounting-api/build.gradle | 15 +++++++-------- accounting-service/build.gradle | 2 +- docker-compose-services.yml | 3 ++- docker-compose-storage.yml | 4 +--- laundry-management-service/Dockerfile | 4 +++- laundry-management-service/build.gradle | 2 +- .../laundrymanagement-api/build.gradle | 15 +++++++-------- order-management-service/Dockerfile | 4 +++- order-management-service/build.gradle | 2 +- .../ordermanagement-api/build.gradle | 15 +++++++-------- tariff-management-service/Dockerfile | 4 +++- tariff-management-service/build.gradle | 2 +- .../tariffmanagement-api/build.gradle | 15 +++++++-------- taskcoordinator/Dockerfile | 4 +++- taskcoordinator/build.gradle | 2 +- taskcoordinator/taskcoordinator-api/build.gradle | 15 +++++++-------- user-management-service/Dockerfile | 4 +++- user-management-service/build.gradle | 2 +- .../usermanagement-api/build.gradle | 15 +++++++-------- 20 files changed, 69 insertions(+), 64 deletions(-) diff --git a/accounting-service/Dockerfile b/accounting-service/Dockerfile index 6011d042..6bdaf7ee 100644 --- a/accounting-service/Dockerfile +++ b/accounting-service/Dockerfile @@ -3,8 +3,10 @@ FROM gradle:5.4.1 AS builder ARG ARTIFACTORY_URL ARG ARTIFACTORY_USER ARG ARTIFACTORY_PASSWORD +ARG ARTIFACTORY_REPO -ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryUrl=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_REPO} ENV ORG_GRADLE_PROJECT_artifactoryUser=${ARTIFACTORY_USER} # Enforce more security ENV ORG_GRADLE_PROJECT_artifactoryPassword=${ARTIFACTORY_PASSWORD} diff --git a/accounting-service/accounting-api/build.gradle b/accounting-service/accounting-api/build.gradle index c7c4df75..7c988675 100644 --- a/accounting-service/accounting-api/build.gradle +++ b/accounting-service/accounting-api/build.gradle @@ -58,12 +58,12 @@ publishing { } artifactory { - contextUrl = "http://artifactory:8081/artifactory" //The base Artifactory URL if not overridden by the publisher/resolver + contextUrl = "${artifactoryUrl}" //The base Artifactory URL if not overridden by the publisher/resolver publish { repository { - repoKey = 'artifacts' - username = "admin" - password = "password" + repoKey = "${artifactoryRepo}" + username = "${artifactoryUser}" + password = "${artifactoryPassword}" maven = true } defaults { @@ -73,11 +73,10 @@ artifactory { } resolve { repository { - repoKey = 'repo' - username = "admin" - password = "password" + repoKey = "${artifactoryRepo}" + username = "${artifactoryUser}" + password = "${artifactoryPassword}" maven = true - } } } \ No newline at end of file diff --git a/accounting-service/build.gradle b/accounting-service/build.gradle index cd44a4e1..08fdf078 100644 --- a/accounting-service/build.gradle +++ b/accounting-service/build.gradle @@ -7,7 +7,7 @@ allprojects { repositories { //mavenCentral() maven { - url "${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from + url "${artifactoryUrl}/${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) username = "${artifactoryUser}" // Artifactory user name password = "${artifactoryPassword}" // Password or API Key diff --git a/docker-compose-services.yml b/docker-compose-services.yml index 8dfa800c..8db447b3 100644 --- a/docker-compose-services.yml +++ b/docker-compose-services.yml @@ -1,9 +1,10 @@ version: '3.4' x-artifactory-args: &artifactory-args - ARTIFACTORY_URL: http://172.24.0.1:8081/artifactory/repo + ARTIFACTORY_URL: http://172.24.0.1:8081/artifactory ARTIFACTORY_USER: "admin" ARTIFACTORY_PASSWORD: "password" + ARTIFACTORY_REPO: "repo" services: accounting: diff --git a/docker-compose-storage.yml b/docker-compose-storage.yml index 56a3f498..f1f69a10 100644 --- a/docker-compose-storage.yml +++ b/docker-compose-storage.yml @@ -14,7 +14,6 @@ services: api-deployer: build: ./api-deployer image: api-deployer - #tty: true working_dir: "/project" volumes: - ".:/project" @@ -22,5 +21,4 @@ services: ORG_GRADLE_PROJECT_artifactoryUrl: "http://artifactory:8081/artifactory" ORG_GRADLE_PROJECT_artifactoryUser: admin ORG_GRADLE_PROJECT_artifactoryPassword: password - # TODO: Replace after refactoring with repo name - ORG_GRADLE_PROJECT_artifactoryRepo: "http://artifactory:8081/artifactory/repo" + ORG_GRADLE_PROJECT_artifactoryRepo: "repo" diff --git a/laundry-management-service/Dockerfile b/laundry-management-service/Dockerfile index ea6b5b70..cfa41f16 100644 --- a/laundry-management-service/Dockerfile +++ b/laundry-management-service/Dockerfile @@ -3,8 +3,10 @@ FROM gradle:5.4.1 AS builder ARG ARTIFACTORY_URL ARG ARTIFACTORY_USER ARG ARTIFACTORY_PASSWORD +ARG ARTIFACTORY_REPO -ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryUrl=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_REPO} ENV ORG_GRADLE_PROJECT_artifactoryUser=${ARTIFACTORY_USER} # Enforce more security ENV ORG_GRADLE_PROJECT_artifactoryPassword=${ARTIFACTORY_PASSWORD} diff --git a/laundry-management-service/build.gradle b/laundry-management-service/build.gradle index cd44a4e1..08fdf078 100644 --- a/laundry-management-service/build.gradle +++ b/laundry-management-service/build.gradle @@ -7,7 +7,7 @@ allprojects { repositories { //mavenCentral() maven { - url "${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from + url "${artifactoryUrl}/${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) username = "${artifactoryUser}" // Artifactory user name password = "${artifactoryPassword}" // Password or API Key diff --git a/laundry-management-service/laundrymanagement-api/build.gradle b/laundry-management-service/laundrymanagement-api/build.gradle index 8946ddb9..6b533192 100644 --- a/laundry-management-service/laundrymanagement-api/build.gradle +++ b/laundry-management-service/laundrymanagement-api/build.gradle @@ -57,12 +57,12 @@ publishing { } artifactory { - contextUrl = "http://artifactory:8081/artifactory" //The base Artifactory URL if not overridden by the publisher/resolver + contextUrl = "${artifactoryUrl}" //The base Artifactory URL if not overridden by the publisher/resolver publish { repository { - repoKey = 'artifacts' - username = "admin" - password = "password" + repoKey = "${artifactoryRepo}" + username = "${artifactoryUser}" + password = "${artifactoryPassword}" maven = true } defaults { @@ -72,11 +72,10 @@ artifactory { } resolve { repository { - repoKey = 'repo' - username = "admin" - password = "password" + repoKey = "${artifactoryRepo}" + username = "${artifactoryUser}" + password = "${artifactoryPassword}" maven = true - } } } \ No newline at end of file diff --git a/order-management-service/Dockerfile b/order-management-service/Dockerfile index 855b7a84..6b368647 100644 --- a/order-management-service/Dockerfile +++ b/order-management-service/Dockerfile @@ -3,8 +3,10 @@ FROM gradle:5.4.1 AS builder ARG ARTIFACTORY_URL ARG ARTIFACTORY_USER ARG ARTIFACTORY_PASSWORD +ARG ARTIFACTORY_REPO -ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryUrl=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_REPO} ENV ORG_GRADLE_PROJECT_artifactoryUser=${ARTIFACTORY_USER} # Enforce more security ENV ORG_GRADLE_PROJECT_artifactoryPassword=${ARTIFACTORY_PASSWORD} diff --git a/order-management-service/build.gradle b/order-management-service/build.gradle index cd44a4e1..08fdf078 100644 --- a/order-management-service/build.gradle +++ b/order-management-service/build.gradle @@ -7,7 +7,7 @@ allprojects { repositories { //mavenCentral() maven { - url "${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from + url "${artifactoryUrl}/${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) username = "${artifactoryUser}" // Artifactory user name password = "${artifactoryPassword}" // Password or API Key diff --git a/order-management-service/ordermanagement-api/build.gradle b/order-management-service/ordermanagement-api/build.gradle index ad6df205..864ca497 100644 --- a/order-management-service/ordermanagement-api/build.gradle +++ b/order-management-service/ordermanagement-api/build.gradle @@ -66,12 +66,12 @@ publishing { } artifactory { - contextUrl = "http://artifactory:8081/artifactory" //The base Artifactory URL if not overridden by the publisher/resolver + contextUrl = "${artifactoryUrl}" //The base Artifactory URL if not overridden by the publisher/resolver publish { repository { - repoKey = 'artifacts' - username = "admin" - password = "password" + repoKey = "${artifactoryRepo}" + username = "${artifactoryUser}" + password = "${artifactoryPassword}" maven = true } defaults { @@ -81,11 +81,10 @@ artifactory { } resolve { repository { - repoKey = 'repo' - username = "admin" - password = "password" + repoKey = "${artifactoryRepo}" + username = "${artifactoryUser}" + password = "${artifactoryPassword}" maven = true - } } } \ No newline at end of file diff --git a/tariff-management-service/Dockerfile b/tariff-management-service/Dockerfile index 349d359b..44e63289 100644 --- a/tariff-management-service/Dockerfile +++ b/tariff-management-service/Dockerfile @@ -3,8 +3,10 @@ FROM gradle:5.4.1 AS builder ARG ARTIFACTORY_URL ARG ARTIFACTORY_USER ARG ARTIFACTORY_PASSWORD +ARG ARTIFACTORY_REPO -ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryUrl=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_REPO} ENV ORG_GRADLE_PROJECT_artifactoryUser=${ARTIFACTORY_USER} # Enforce more security ENV ORG_GRADLE_PROJECT_artifactoryPassword=${ARTIFACTORY_PASSWORD} diff --git a/tariff-management-service/build.gradle b/tariff-management-service/build.gradle index 1e3ae5c5..7a469ecd 100644 --- a/tariff-management-service/build.gradle +++ b/tariff-management-service/build.gradle @@ -7,7 +7,7 @@ allprojects { repositories { //mavenCentral() maven { - url "${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from + url "${artifactoryUrl}/${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) username = "${artifactoryUser}" // Artifactory user name password = "${artifactoryPassword}" // Password or API Key diff --git a/tariff-management-service/tariffmanagement-api/build.gradle b/tariff-management-service/tariffmanagement-api/build.gradle index bffe3b4d..48cd7aaf 100644 --- a/tariff-management-service/tariffmanagement-api/build.gradle +++ b/tariff-management-service/tariffmanagement-api/build.gradle @@ -52,12 +52,12 @@ publishing { } artifactory { - contextUrl = "http://artifactory:8081/artifactory" //The base Artifactory URL if not overridden by the publisher/resolver + contextUrl = "${artifactoryUrl}" //The base Artifactory URL if not overridden by the publisher/resolver publish { repository { - repoKey = 'artifacts' - username = "admin" - password = "password" + repoKey = "${artifactoryRepo}" + username = "${artifactoryUser}" + password = "${artifactoryPassword}" maven = true } defaults { @@ -67,11 +67,10 @@ artifactory { } resolve { repository { - repoKey = 'repo' - username = "admin" - password = "password" + repoKey = "${artifactoryRepo}" + username = "${artifactoryUser}" + password = "${artifactoryPassword}" maven = true - } } } diff --git a/taskcoordinator/Dockerfile b/taskcoordinator/Dockerfile index 6e2c1f60..32c67278 100644 --- a/taskcoordinator/Dockerfile +++ b/taskcoordinator/Dockerfile @@ -3,8 +3,10 @@ FROM gradle:5.4.1 AS builder ARG ARTIFACTORY_URL ARG ARTIFACTORY_USER ARG ARTIFACTORY_PASSWORD +ARG ARTIFACTORY_REPO -ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryUrl=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_REPO} ENV ORG_GRADLE_PROJECT_artifactoryUser=${ARTIFACTORY_USER} # Enforce more security ENV ORG_GRADLE_PROJECT_artifactoryPassword=${ARTIFACTORY_PASSWORD} diff --git a/taskcoordinator/build.gradle b/taskcoordinator/build.gradle index 715f32e5..2c90d907 100644 --- a/taskcoordinator/build.gradle +++ b/taskcoordinator/build.gradle @@ -7,7 +7,7 @@ allprojects { repositories { //mavenCentral() maven { - url "${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from + url "${artifactoryUrl}/${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) username = "${artifactoryUser}" // Artifactory user name password = "${artifactoryPassword}" // Password or API Key diff --git a/taskcoordinator/taskcoordinator-api/build.gradle b/taskcoordinator/taskcoordinator-api/build.gradle index e484992b..ab593c85 100644 --- a/taskcoordinator/taskcoordinator-api/build.gradle +++ b/taskcoordinator/taskcoordinator-api/build.gradle @@ -54,12 +54,12 @@ publishing { } artifactory { - contextUrl = "http://artifactory:8081/artifactory" //The base Artifactory URL if not overridden by the publisher/resolver + contextUrl = "${artifactoryUrl}" //The base Artifactory URL if not overridden by the publisher/resolver publish { repository { - repoKey = 'artifacts' - username = "admin" - password = "password" + repoKey = "${artifactoryRepo}" + username = "${artifactoryUser}" + password = "${artifactoryPassword}" maven = true } defaults { @@ -69,11 +69,10 @@ artifactory { } resolve { repository { - repoKey = 'repo' - username = "admin" - password = "password" + repoKey = "${artifactoryRepo}" + username = "${artifactoryUser}" + password = "${artifactoryPassword}" maven = true - } } } \ No newline at end of file diff --git a/user-management-service/Dockerfile b/user-management-service/Dockerfile index ccb71d8d..363479e8 100644 --- a/user-management-service/Dockerfile +++ b/user-management-service/Dockerfile @@ -3,8 +3,10 @@ FROM gradle:5.4.1 AS builder ARG ARTIFACTORY_URL ARG ARTIFACTORY_USER ARG ARTIFACTORY_PASSWORD +ARG ARTIFACTORY_REPO -ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryUrl=${ARTIFACTORY_URL} +ENV ORG_GRADLE_PROJECT_artifactoryRepo=${ARTIFACTORY_REPO} ENV ORG_GRADLE_PROJECT_artifactoryUser=${ARTIFACTORY_USER} # Enforce more security ENV ORG_GRADLE_PROJECT_artifactoryPassword=${ARTIFACTORY_PASSWORD} diff --git a/user-management-service/build.gradle b/user-management-service/build.gradle index cd44a4e1..08fdf078 100644 --- a/user-management-service/build.gradle +++ b/user-management-service/build.gradle @@ -7,7 +7,7 @@ allprojects { repositories { //mavenCentral() maven { - url "${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from + url "${artifactoryUrl}/${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) username = "${artifactoryUser}" // Artifactory user name password = "${artifactoryPassword}" // Password or API Key diff --git a/user-management-service/usermanagement-api/build.gradle b/user-management-service/usermanagement-api/build.gradle index daa6fa91..9607af9f 100644 --- a/user-management-service/usermanagement-api/build.gradle +++ b/user-management-service/usermanagement-api/build.gradle @@ -55,12 +55,12 @@ publishing { } artifactory { - contextUrl = "http://artifactory:8081/artifactory" //The base Artifactory URL if not overridden by the publisher/resolver + contextUrl = "${artifactoryUrl}" //The base Artifactory URL if not overridden by the publisher/resolver publish { repository { - repoKey = 'artifacts' - username = "admin" - password = "password" + repoKey = "${artifactoryRepo}" + username = "${artifactoryUser}" + password = "${artifactoryPassword}" maven = true } defaults { @@ -70,11 +70,10 @@ artifactory { } resolve { repository { - repoKey = 'repo' - username = "admin" - password = "password" + repoKey = "${artifactoryRepo}" + username = "${artifactoryUser}" + password = "${artifactoryPassword}" maven = true - } } } \ No newline at end of file From 89c1eb47b65432da1d44d9043ab01e52c7157bd2 Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 16:32:11 +0300 Subject: [PATCH 16/27] Clean up usage of mavenCentral --- .../accounting-api/build.gradle | 15 ------------- .../accounting-app/build.gradle | 21 ------------------- accounting-service/build.gradle | 1 - api-gateway-service/build.gradle | 8 ------- eureka-service-discovery/build.gradle | 4 ---- laundry-management-service/build.gradle | 1 - .../laundrymanagement-api/build.gradle | 8 ------- .../laundrymanagement-app/build.gradle | 16 -------------- order-management-service/build.gradle | 1 - .../ordermanagement-api/build.gradle | 4 ---- .../ordermanagement-app/build.gradle | 11 ---------- rest-assured-tests/build.gradle | 4 ---- tariff-management-service/build.gradle | 1 - .../tariffmanagement-api/build.gradle | 14 ------------- .../tariffmanagement-app/build.gradle | 15 ------------- taskcoordinator/build.gradle | 1 - .../taskcoordinator-api/build.gradle | 4 ---- .../taskcoordinator-app/build.gradle | 12 ----------- user-management-service/build.gradle | 1 - .../usermanagement-api/build.gradle | 13 ------------ .../usermanagement-app/build.gradle | 14 ------------- 21 files changed, 169 deletions(-) diff --git a/accounting-service/accounting-api/build.gradle b/accounting-service/accounting-api/build.gradle index 7c988675..b80ff037 100644 --- a/accounting-service/accounting-api/build.gradle +++ b/accounting-service/accounting-api/build.gradle @@ -1,13 +1,3 @@ -/*buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE") - } -}*/ - - plugins { id "com.jfrog.artifactory" version "4.9.8" id 'maven-publish' @@ -22,11 +12,6 @@ jar { archiveBaseName = "accounting-api" } -/*repositories { - mavenLocal() - mavenCentral() -}*/ - dependencies { compile 'org.springframework.cloud:spring-cloud-openfeign-core' compile 'javax.validation:validation-api:2.0.1.Final' diff --git a/accounting-service/accounting-app/build.gradle b/accounting-service/accounting-app/build.gradle index 36df899e..a766f8be 100644 --- a/accounting-service/accounting-app/build.gradle +++ b/accounting-service/accounting-app/build.gradle @@ -1,18 +1,3 @@ -/*buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE' - } -} -*/ - -/*plugins { - id "org.springframework.boot" version "2.1.4.RELEASE" -}*/ -//apply plugin: 'java' apply plugin: 'idea' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' @@ -25,12 +10,6 @@ bootJar { sourceCompatibility = 1.8 -/*repositories { - mavenLocal() - mavenCentral() -} -*/ - dependencies { compile "com.microservices.accounting.api:accounting-api:${accountingApiVersion}" compile 'org.springframework.boot:spring-boot-starter-web' diff --git a/accounting-service/build.gradle b/accounting-service/build.gradle index 08fdf078..03782b89 100644 --- a/accounting-service/build.gradle +++ b/accounting-service/build.gradle @@ -5,7 +5,6 @@ plugins { allprojects { repositories { - //mavenCentral() maven { url "${artifactoryUrl}/${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) diff --git a/api-gateway-service/build.gradle b/api-gateway-service/build.gradle index 6bf6b652..52efed87 100644 --- a/api-gateway-service/build.gradle +++ b/api-gateway-service/build.gradle @@ -1,7 +1,4 @@ buildscript { - repositories { - mavenCentral() - } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE") } @@ -20,11 +17,6 @@ bootJar { sourceCompatibility = 1.8 -repositories { - mavenCentral() - mavenLocal() -} - dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}" diff --git a/eureka-service-discovery/build.gradle b/eureka-service-discovery/build.gradle index 75195f9c..40e12201 100644 --- a/eureka-service-discovery/build.gradle +++ b/eureka-service-discovery/build.gradle @@ -10,10 +10,6 @@ group = 'com.microservices' version = applicationVersion sourceCompatibility = '1.8' -repositories { - mavenCentral() -} - ext { set('springCloudVersion', "Greenwich.SR2") } diff --git a/laundry-management-service/build.gradle b/laundry-management-service/build.gradle index 08fdf078..03782b89 100644 --- a/laundry-management-service/build.gradle +++ b/laundry-management-service/build.gradle @@ -5,7 +5,6 @@ plugins { allprojects { repositories { - //mavenCentral() maven { url "${artifactoryUrl}/${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) diff --git a/laundry-management-service/laundrymanagement-api/build.gradle b/laundry-management-service/laundrymanagement-api/build.gradle index 6b533192..54b2482e 100644 --- a/laundry-management-service/laundrymanagement-api/build.gradle +++ b/laundry-management-service/laundrymanagement-api/build.gradle @@ -37,14 +37,6 @@ uploadArchives { } } -/* publishing { - publications { - mavenJava(MavenPublication) { - from components.java - } - } -} -*/ publishing { publications { mavenJava(MavenPublication) { diff --git a/laundry-management-service/laundrymanagement-app/build.gradle b/laundry-management-service/laundrymanagement-app/build.gradle index 46f2eccb..3dd09d0c 100644 --- a/laundry-management-service/laundrymanagement-app/build.gradle +++ b/laundry-management-service/laundrymanagement-app/build.gradle @@ -1,15 +1,6 @@ -// buildscript { - // these repositories and dependencies are used by Gradle itself -// } -// -//dependencies { -// classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE' -//} - apply plugin: 'idea' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' -/* apply plugin: "com.jfrog.artifactory" */ bootJar { baseName = 'laundry-management-service-app' @@ -19,13 +10,6 @@ bootJar { sourceCompatibility = 1.8 -// these repositories are used in project -/* repositories { - mavenCentral() - mavenLocal() -} -*/ - dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}" diff --git a/order-management-service/build.gradle b/order-management-service/build.gradle index 08fdf078..03782b89 100644 --- a/order-management-service/build.gradle +++ b/order-management-service/build.gradle @@ -5,7 +5,6 @@ plugins { allprojects { repositories { - //mavenCentral() maven { url "${artifactoryUrl}/${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) diff --git a/order-management-service/ordermanagement-api/build.gradle b/order-management-service/ordermanagement-api/build.gradle index 864ca497..d98d8c9d 100644 --- a/order-management-service/ordermanagement-api/build.gradle +++ b/order-management-service/ordermanagement-api/build.gradle @@ -6,10 +6,6 @@ plugins { id 'maven-publish' } -/*repositories { - mavenCentral() -}*/ - group = 'com.microservices.ordermanagement' version = apiVersion diff --git a/order-management-service/ordermanagement-app/build.gradle b/order-management-service/ordermanagement-app/build.gradle index e659252b..b5578246 100644 --- a/order-management-service/ordermanagement-app/build.gradle +++ b/order-management-service/ordermanagement-app/build.gradle @@ -1,9 +1,3 @@ -buildscript { - /*repositories { - mavenCentral() - }*/ -} - apply plugin: 'java' apply plugin: 'idea' apply plugin: 'org.springframework.boot' @@ -17,11 +11,6 @@ bootJar { sourceCompatibility = 1.8 -/*repositories { - mavenCentral() - mavenLocal() -}*/ - dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}" diff --git a/rest-assured-tests/build.gradle b/rest-assured-tests/build.gradle index 44550571..fe3095fa 100644 --- a/rest-assured-tests/build.gradle +++ b/rest-assured-tests/build.gradle @@ -7,10 +7,6 @@ version '1.0-SNAPSHOT' sourceCompatibility = 1.8 -repositories { - mavenCentral() -} - dependencies { testCompile 'org.projectlombok:lombok:1.18.4' testCompile 'io.rest-assured:rest-assured:4.1.0' diff --git a/tariff-management-service/build.gradle b/tariff-management-service/build.gradle index 7a469ecd..02f7e42a 100644 --- a/tariff-management-service/build.gradle +++ b/tariff-management-service/build.gradle @@ -5,7 +5,6 @@ plugins { allprojects { repositories { - //mavenCentral() maven { url "${artifactoryUrl}/${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) diff --git a/tariff-management-service/tariffmanagement-api/build.gradle b/tariff-management-service/tariffmanagement-api/build.gradle index 48cd7aaf..a83590f2 100644 --- a/tariff-management-service/tariffmanagement-api/build.gradle +++ b/tariff-management-service/tariffmanagement-api/build.gradle @@ -1,12 +1,3 @@ -/*buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE") - } -}*/ - plugins { id 'io.spring.dependency-management' id "com.jfrog.artifactory" version "4.9.8" @@ -17,11 +8,6 @@ plugins { group 'com.microservices.tariffmanagement' version = apiVersion -/*repositories { - mavenLocal() - mavenCentral() -}*/ - dependencies { compile 'org.springframework.cloud:spring-cloud-openfeign-core' compileOnly 'org.projectlombok:lombok:1.18.4' diff --git a/tariff-management-service/tariffmanagement-app/build.gradle b/tariff-management-service/tariffmanagement-app/build.gradle index 06fcbec3..1742831a 100644 --- a/tariff-management-service/tariffmanagement-app/build.gradle +++ b/tariff-management-service/tariffmanagement-app/build.gradle @@ -1,12 +1,3 @@ -/*buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE") - } -}*/ - apply plugin: 'idea' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' @@ -19,12 +10,6 @@ bootJar { sourceCompatibility = 1.8 -/*repositories { - mavenLocal() - mavenCentral() -} -*/ - dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}" diff --git a/taskcoordinator/build.gradle b/taskcoordinator/build.gradle index 2c90d907..4f83baa2 100644 --- a/taskcoordinator/build.gradle +++ b/taskcoordinator/build.gradle @@ -5,7 +5,6 @@ plugins { allprojects { repositories { - //mavenCentral() maven { url "${artifactoryUrl}/${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) diff --git a/taskcoordinator/taskcoordinator-api/build.gradle b/taskcoordinator/taskcoordinator-api/build.gradle index ab593c85..008e67eb 100644 --- a/taskcoordinator/taskcoordinator-api/build.gradle +++ b/taskcoordinator/taskcoordinator-api/build.gradle @@ -5,10 +5,6 @@ plugins { id 'maven-publish' } -/*repositories { - mavenCentral() -}*/ - group = 'com.microservices.taskcoordinator' version = apiVersion diff --git a/taskcoordinator/taskcoordinator-app/build.gradle b/taskcoordinator/taskcoordinator-app/build.gradle index 67758094..40a3d635 100644 --- a/taskcoordinator/taskcoordinator-app/build.gradle +++ b/taskcoordinator/taskcoordinator-app/build.gradle @@ -1,10 +1,3 @@ -buildscript { - /* - repositories { - mavenCentral() - }*/ -} - apply plugin: 'java' apply plugin: 'idea' apply plugin: 'org.springframework.boot' @@ -18,11 +11,6 @@ bootJar { sourceCompatibility = 1.8 -/*repositories { - mavenCentral() - mavenLocal() -}*/ - dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:${releaseTrainVersion}" diff --git a/user-management-service/build.gradle b/user-management-service/build.gradle index 08fdf078..03782b89 100644 --- a/user-management-service/build.gradle +++ b/user-management-service/build.gradle @@ -5,7 +5,6 @@ plugins { allprojects { repositories { - //mavenCentral() maven { url "${artifactoryUrl}/${artifactoryRepo}" // The Artifactory (preferably virtual) repository to resolve from credentials { // Optional resolver credentials (leave out to use anonymous resolution) diff --git a/user-management-service/usermanagement-api/build.gradle b/user-management-service/usermanagement-api/build.gradle index 9607af9f..e34f94b9 100644 --- a/user-management-service/usermanagement-api/build.gradle +++ b/user-management-service/usermanagement-api/build.gradle @@ -1,12 +1,3 @@ -/*buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE") - } -}*/ - plugins { id "com.jfrog.artifactory" version "4.9.8" id 'maven-publish' @@ -21,10 +12,6 @@ jar { archiveBaseName = "usermanagement-api" } -/*repositories { - mavenCentral() -}*/ - dependencies { compile 'org.springframework.cloud:spring-cloud-openfeign-core' compileOnly 'org.projectlombok:lombok:1.18.4' diff --git a/user-management-service/usermanagement-app/build.gradle b/user-management-service/usermanagement-app/build.gradle index c87e98c8..d99c81c1 100644 --- a/user-management-service/usermanagement-app/build.gradle +++ b/user-management-service/usermanagement-app/build.gradle @@ -1,12 +1,3 @@ -/*buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE' - } -}*/ - apply plugin: 'java' apply plugin: 'idea' apply plugin: 'org.springframework.boot' @@ -20,11 +11,6 @@ bootJar { sourceCompatibility = 1.8 -/*repositories { - mavenLocal() - mavenCentral() -}*/ - dependencies { compile "com.microservices.usermanagement:usermanagement-api:${userManagementApiVersion}" compile 'org.springframework.boot:spring-boot-starter-web' From a7b583bbe1c47e642044e4067f99b99eaf23f4d6 Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 16:54:55 +0300 Subject: [PATCH 17/27] Checking travis --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..e0103480 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +services: + - docker + +script: + - docker --version + - docker ps \ No newline at end of file From c2c0e419a69497a29d0d97678129545b11d1372e Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 16:58:39 +0300 Subject: [PATCH 18/27] Trying out artifactory --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index e0103480..18e0a5a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,10 @@ services: - docker +before_install: + - docker-compose -f docker-compose-storage.yml -d up + - docker-compose -f docker-compose-storage.yml run --rm api-deployer /setup.sh + script: - docker --version - docker ps \ No newline at end of file From a2d9d7de8aa604b2b7cb0237591231e00fe795bd Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 17:00:15 +0300 Subject: [PATCH 19/27] Fix up a typo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 18e0a5a0..c6da26f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ services: - docker before_install: - - docker-compose -f docker-compose-storage.yml -d up + - docker-compose -f docker-compose-storage.yml up -d - docker-compose -f docker-compose-storage.yml run --rm api-deployer /setup.sh script: From 38874d598525cc6d976237355f560e7cf557e69b Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 17:07:50 +0300 Subject: [PATCH 20/27] Trying to wait for the artifactory --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index c6da26f8..2e64dee5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ services: before_install: - docker-compose -f docker-compose-storage.yml up -d + - docker-compose -f docker-compose-storage.yml run --rm api-deployer bash -c 'while ! curl ${ORG_GRADLE_PROJECT_artifactoryUrl}; do sleep 1; done' - docker-compose -f docker-compose-storage.yml run --rm api-deployer /setup.sh script: From be7d0b710164f7d86118cbc005bbc0c2e999c2d4 Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 17:20:05 +0300 Subject: [PATCH 21/27] Fix up waiting --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2e64dee5..6764c771 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,7 @@ services: before_install: - docker-compose -f docker-compose-storage.yml up -d - - docker-compose -f docker-compose-storage.yml run --rm api-deployer bash -c 'while ! curl ${ORG_GRADLE_PROJECT_artifactoryUrl}; do sleep 1; done' - - docker-compose -f docker-compose-storage.yml run --rm api-deployer /setup.sh + - docker-compose -f docker-compose-storage.yml run --rm api-deployer bash -c 'while ! /setup.sh | grep successfully; do echo "Still waiting..."; sleep 1; done' script: - docker --version From 27094005f855b2138462c6a750724952edadfbfe Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 17:25:13 +0300 Subject: [PATCH 22/27] Do actual project building --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6764c771..7b78bcd7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,5 +6,6 @@ before_install: - docker-compose -f docker-compose-storage.yml run --rm api-deployer bash -c 'while ! /setup.sh | grep successfully; do echo "Still waiting..."; sleep 1; done' script: - - docker --version - - docker ps \ No newline at end of file + - docker-compose -f docker-compose.yml -f docker-compose-services.yml pull + - docker-compose -f docker-compose-storage.yml run --rm api-deployer /api-deployer.sh + - docker-compose -f docker-compose.yml -f docker-compose-services.yml build \ No newline at end of file From 79da0f155c6d347c1b0e7eaacfb71c049cf2b680 Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 17:48:09 +0300 Subject: [PATCH 23/27] Trying out extended timeout --- api-deployer/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api-deployer/config.yml b/api-deployer/config.yml index cb6a5c53..5c29e934 100644 --- a/api-deployer/config.yml +++ b/api-deployer/config.yml @@ -164,7 +164,7 @@ remoteRepositories: mismatchingMimeTypesOverrideList: "" bypassHeadRequests: false allowAnyHostAuth: false - socketTimeoutMillis: 15000 + socketTimeoutMillis: 100000 enableCookieManagement: false enableTokenAuthentication: false propagateQueryParams: false @@ -205,7 +205,7 @@ remoteRepositories: mismatchingMimeTypesOverrideList: "" bypassHeadRequests: false allowAnyHostAuth: false - socketTimeoutMillis: 15000 + socketTimeoutMillis: 100000 enableCookieManagement: false enableTokenAuthentication: false propagateQueryParams: false @@ -246,7 +246,7 @@ remoteRepositories: mismatchingMimeTypesOverrideList: "" bypassHeadRequests: false allowAnyHostAuth: false - socketTimeoutMillis: 15000 + socketTimeoutMillis: 100000 enableCookieManagement: false enableTokenAuthentication: false propagateQueryParams: false From 960d0e4379da257820c4bb38cecbddca0987b131 Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 18:05:03 +0300 Subject: [PATCH 24/27] Debug travis docker network --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7b78bcd7..5de04e76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,8 @@ services: before_install: - docker-compose -f docker-compose-storage.yml up -d - docker-compose -f docker-compose-storage.yml run --rm api-deployer bash -c 'while ! /setup.sh | grep successfully; do echo "Still waiting..."; sleep 1; done' + # Some debugging + - docker-compose -f docker-compose-storage.yml run --rm --entrypoint=/bin/sh --user=root artifactory -c 'ip r' script: - docker-compose -f docker-compose.yml -f docker-compose-services.yml pull From af78fdda2cbc3a90fc2e6eac8059c789026ffd9c Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 18:28:09 +0300 Subject: [PATCH 25/27] Trying to determine IP at build time --- .travis.yml | 4 ++-- artifactory/Dockerfile | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5de04e76..29bd88c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,6 @@ before_install: - docker-compose -f docker-compose-storage.yml run --rm --entrypoint=/bin/sh --user=root artifactory -c 'ip r' script: - - docker-compose -f docker-compose.yml -f docker-compose-services.yml pull - docker-compose -f docker-compose-storage.yml run --rm api-deployer /api-deployer.sh - - docker-compose -f docker-compose.yml -f docker-compose-services.yml build \ No newline at end of file + - docker-compose -f docker-compose.yml -f docker-compose-services.yml build + - docker-compose -f docker-compose.yml -f docker-compose-services.yml pull \ No newline at end of file diff --git a/artifactory/Dockerfile b/artifactory/Dockerfile index d59cbc2c..0acaea30 100644 --- a/artifactory/Dockerfile +++ b/artifactory/Dockerfile @@ -2,6 +2,8 @@ FROM docker.bintray.io/jfrog/artifactory-oss COPY ./entrypoint.sh /entrypoint.sh +RUN [ "/busybox/ip", "r" ] + ENTRYPOINT [ "/bin/bash", "/entrypoint.sh" ] # Required for chown From 91ce636ba21f231f9a19fa878a1860463ee788b1 Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 18:37:02 +0300 Subject: [PATCH 26/27] Trying to fix the issue by variable substitituion --- .travis.yml | 3 +++ docker-compose-services.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 29bd88c6..6da40577 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,9 @@ services: - docker +env: + - ARTIFACTORY_IP=172.17.0.1 + before_install: - docker-compose -f docker-compose-storage.yml up -d - docker-compose -f docker-compose-storage.yml run --rm api-deployer bash -c 'while ! /setup.sh | grep successfully; do echo "Still waiting..."; sleep 1; done' diff --git a/docker-compose-services.yml b/docker-compose-services.yml index 8db447b3..9f6eba74 100644 --- a/docker-compose-services.yml +++ b/docker-compose-services.yml @@ -1,7 +1,7 @@ version: '3.4' x-artifactory-args: &artifactory-args - ARTIFACTORY_URL: http://172.24.0.1:8081/artifactory + ARTIFACTORY_URL: "http://${ARTIFACTORY_IP:-172.24.0.1}:8081/artifactory" ARTIFACTORY_USER: "admin" ARTIFACTORY_PASSWORD: "password" ARTIFACTORY_REPO: "repo" From e63b20c8a942e81d38ce23e2cf98ad3e03e857c5 Mon Sep 17 00:00:00 2001 From: Alex Talker Date: Sat, 5 Oct 2019 19:47:23 +0300 Subject: [PATCH 27/27] Fixing up a doc --- .travis.yml | 8 +++---- doc/Docker.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 doc/Docker.md diff --git a/.travis.yml b/.travis.yml index 6da40577..5a329c87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,15 +2,15 @@ services: - docker env: + # Update if building docker-compose-services.yml breaks - ARTIFACTORY_IP=172.17.0.1 before_install: - docker-compose -f docker-compose-storage.yml up -d + # Deploy expected configuration to Artifactory - docker-compose -f docker-compose-storage.yml run --rm api-deployer bash -c 'while ! /setup.sh | grep successfully; do echo "Still waiting..."; sleep 1; done' - # Some debugging - - docker-compose -f docker-compose-storage.yml run --rm --entrypoint=/bin/sh --user=root artifactory -c 'ip r' script: + - docker-compose -f docker-compose.yml -f docker-compose-services.yml pull - docker-compose -f docker-compose-storage.yml run --rm api-deployer /api-deployer.sh - - docker-compose -f docker-compose.yml -f docker-compose-services.yml build - - docker-compose -f docker-compose.yml -f docker-compose-services.yml pull \ No newline at end of file + - docker-compose -f docker-compose.yml -f docker-compose-services.yml build \ No newline at end of file diff --git a/doc/Docker.md b/doc/Docker.md new file mode 100644 index 00000000..8d691bb9 --- /dev/null +++ b/doc/Docker.md @@ -0,0 +1,59 @@ +# Bulding and deploying in Docker + +## Dependency caching and publishing + +Many of services, presented in this repository, +have an API package which is a dependency for other services. +Originally, resolving this dependency meant bulding the package, deploying it into local Maven +and then referencing to local Maven in other services. +Unfortunatelly, in order to build the software in a predictable environment, +this method has been abandoned. +That's because local Maven can be supported in Docker only by using a volume +but it is expected that each service is built as a separate Docker image. +Thus, since at built time, feature of volumes is unavailable in Docker, +there has to be an external repository to do the job. + +After a little research, Artifactory project has been choosen to resolve issue with publishing of API artifacts. +Also, Artifactory provides two features that seems quite useful: ability to proxy remote repositories, +including caching of requested data, and feature of virtual repositories that represent set of repositories as one. + +Thus, to build this project, it is required to raise Artifactory service in Docker first: +``` +docker-compose -f docker-compose-storage.yml up +``` + +Then, after Artifactory is up, it is necessary to deploy first-time configuration by calling: +``` +docker-compose -f docker-compose-storage.yml run --rm api-deployer /setup.sh +``` + +If previous command has succeeded, then it is time to build API artifacts and deploy them into the Artifactory: +``` +docker-compose -f docker-compose-storage.yml run --rm api-deployer /api-deployer.sh +``` + +## Building services + +After API artifacts is available at Artifactory, it is time to build all the images: +``` +docker-compose -f docker-compose.yml -f docker-compose-services.yml pull +docker-compose -f docker-compose.yml -f docker-compose-services.yml build +``` + +It is also possible to skip this step as `docker-compose` automatically builds images the first time +but after changes has been made, it is necessary to call the `build` command again. + +## Deploying services + +``` +docker-compose -f docker-compose.yml -f docker-compose-services.yml up +``` + +## Including new service + +If a new service is in development, first it is necessary to rely on Artifactory +in order to resolve all the dependencies. Examples of such repository configuration can be found in existing services. +To deploy API of a service, one must edit `api-deployer/api-deployer.sh` and include path to API in proper order in this script. +To build a Docker image, one can rely on examples of `Dockerfile` in other services. + +Also, it is important to remember that referencing `localhost` inside of Docker container means only reference to the current container itself and not the host nor any other container. Thus, working with external services, they must be referenced by service name in `docker-compose.yml` files. \ No newline at end of file