From 632df3bf1963e3a8a9622e0f07ad8dc02a39379a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=81=E5=AE=A2=E5=BC=80=E6=BA=90?= Date: Sun, 5 Feb 2023 23:05:23 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feature=20=E6=B7=BB=E5=8A=A0docker-compose.?= =?UTF-8?q?yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 62 +++++++++++++++++++ eiam-console/source.list | 10 +++ .../src/main/resources/application.yml | 26 ++++---- .../EiamElasticsearchConfiguration.java | 4 +- .../src/main/resources/application.yml | 26 ++++---- .../src/main/resources/application.yml | 26 ++++---- .../src/main/resources/application.yml | 20 +++--- 7 files changed, 123 insertions(+), 51 deletions(-) create mode 100644 docker-compose.yml create mode 100644 eiam-console/source.list diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..4e4a0674 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,62 @@ +version: '3' +services: + eiam-console: + build: + context: ./eiam-console/ + dockerfile: Dockerfile + environment: + MYSQL_HOST: 192.168.56.107 + MYSQL_USER: root + MYSQL_PASSWORD: admin + ES_HOST: 192.168.56.107 + REDIS_HOST: 192.168.56.107 + REDIS_PASSWORD: 12345678 + ports: + - 1898:1898 + image: eiam-console + restart: always + eiam-openapi: + build: + context: ./eiam-openapi/ + dockerfile: Dockerfile + environment: + MYSQL_HOST: 192.168.56.107 + MYSQL_USER: root + MYSQL_PASSWORD: admin + ES_HOST: 192.168.56.107 + REDIS_HOST: 192.168.56.107 + REDIS_PASSWORD: 12345678 + image: eiam-openapi + restart: always + ports: + - 1988:1988 + eiam-portal: + build: + context: ./eiam-portal/ + dockerfile: Dockerfile + environment: + MYSQL_HOST: 192.168.56.107 + MYSQL_USER: root + MYSQL_PASSWORD: admin + ES_HOST: 192.168.56.107 + REDIS_HOST: 192.168.56.107 + REDIS_PASSWORD: 12345678 + image: eiam-portal + restart: always + ports: + - 1989:1989 + eiam-synchronizer: + build: + context: ./eiam-synchronizer/ + dockerfile: Dockerfile + environment: + MYSQL_HOST: 192.168.56.107 + MYSQL_USER: root + MYSQL_PASSWORD: admin + ES_HOST: 192.168.56.107 + REDIS_HOST: 192.168.56.107 + REDIS_PASSWORD: 12345678 + image: eiam-synchronizer + restart: always + ports: + - 1986:1986 diff --git a/eiam-console/source.list b/eiam-console/source.list new file mode 100644 index 00000000..3f18a0f9 --- /dev/null +++ b/eiam-console/source.list @@ -0,0 +1,10 @@ +deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse +deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse +deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse \ No newline at end of file diff --git a/eiam-console/src/main/resources/application.yml b/eiam-console/src/main/resources/application.yml index 91d7e1d1..38b94c96 100644 --- a/eiam-console/src/main/resources/application.yml +++ b/eiam-console/src/main/resources/application.yml @@ -54,9 +54,9 @@ spring: datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/eiam_develop?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true - username: 'eiam' - password: '' + url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/eiam_develop?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true + username: ${MYSQL_USER:'eiam'} + password: ${MYSQL_PASSWORD:''} hikari: auto-commit: true connection-test-query: SELECT 1 @@ -68,9 +68,9 @@ spring: pool-name: eiam #reids redis: - host: localhost - port: 6379 - password: '' + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + password: ${REDIS_PASSWORD:''} database: 9 lettuce: pool: @@ -82,9 +82,9 @@ spring: timeout: 5000ms #elasticsearch elasticsearch: - uris: "http://localhost:9200" - username: "elastic" - password: "" + uris: "http://${ES_HOST:localhost}:${ES_PORT:9200}" + username: ${ES_USER:"elastic"} + password: ${ES_PASSWORD:""} socket-timeout: 30000s connection-timeout: 10000s data: @@ -156,7 +156,7 @@ springdoc: #TopIAM topiam: server: - console-public-base-url: - portal-public-base-url: - openapi-public-base-url: - synchronizer-public-base-url: \ No newline at end of file + console-public-base-url: https://localhost:1898 + portal-public-base-url: https://localhost:1989 + openapi-public-base-url: https://localhost:1988 + synchronizer-public-base-url: https://localhost:1986 \ No newline at end of file diff --git a/eiam-core/src/main/java/cn/topiam/employee/core/configuration/EiamElasticsearchConfiguration.java b/eiam-core/src/main/java/cn/topiam/employee/core/configuration/EiamElasticsearchConfiguration.java index 43fb33dc..b16f3e7c 100644 --- a/eiam-core/src/main/java/cn/topiam/employee/core/configuration/EiamElasticsearchConfiguration.java +++ b/eiam-core/src/main/java/cn/topiam/employee/core/configuration/EiamElasticsearchConfiguration.java @@ -17,6 +17,8 @@ */ package cn.topiam.employee.core.configuration; +import java.time.Duration; + import org.apache.http.client.config.RequestConfig; import org.apache.http.impl.nio.client.HttpAsyncClientBuilder; import org.elasticsearch.client.RestClientBuilder; @@ -24,8 +26,6 @@ import org.springframework.boot.autoconfigure.elasticsearch.RestClientBuilderCus import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import java.time.Duration; - /** * EiamElasticsearchConfiguration * diff --git a/eiam-openapi/src/main/resources/application.yml b/eiam-openapi/src/main/resources/application.yml index 7b167f5b..0c633848 100644 --- a/eiam-openapi/src/main/resources/application.yml +++ b/eiam-openapi/src/main/resources/application.yml @@ -54,9 +54,9 @@ spring: datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/eiam_develop?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true - username: 'eiam' - password: '' + url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/eiam_develop?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true + username: ${MYSQL_USER:'eiam'} + password: ${MYSQL_PASSWORD:''} hikari: auto-commit: true connection-test-query: SELECT 1 @@ -68,9 +68,9 @@ spring: pool-name: eiam #reids redis: - host: localhost - port: 6379 - password: '' + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + password: ${REDIS_PASSWORD:''} database: 9 lettuce: pool: @@ -82,9 +82,9 @@ spring: timeout: 5000ms #elasticsearch elasticsearch: - uris: "http://localhost:9200" - username: "elastic" - password: "" + uris: "http://${ES_HOST:localhost}:${ES_PORT:9200}" + username: ${ES_USER:"elastic"} + password: ${ES_PASSWORD:""} socket-timeout: 30000s connection-timeout: 10000s data: @@ -156,7 +156,7 @@ springdoc: #TopIAM topiam: server: - console-public-base-url: - portal-public-base-url: - openapi-public-base-url: - synchronizer-public-base-url: \ No newline at end of file + console-public-base-url: https://localhost:1898 + portal-public-base-url: https://localhost:1989 + openapi-public-base-url: https://localhost:1988 + synchronizer-public-base-url: https://localhost:1986 \ No newline at end of file diff --git a/eiam-portal/src/main/resources/application.yml b/eiam-portal/src/main/resources/application.yml index 5a9566e6..8abc8ad4 100644 --- a/eiam-portal/src/main/resources/application.yml +++ b/eiam-portal/src/main/resources/application.yml @@ -54,9 +54,9 @@ spring: datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/eiam_develop?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true - username: 'eiam' - password: '' + url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/eiam_develop?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true + username: ${MYSQL_USER:'eiam'} + password: ${MYSQL_PASSWORD:''} hikari: auto-commit: true connection-test-query: SELECT 1 @@ -68,9 +68,9 @@ spring: pool-name: eiam #reids redis: - host: localhost - port: 6379 - password: '' + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + password: ${REDIS_PASSWORD:''} database: 9 lettuce: pool: @@ -82,9 +82,9 @@ spring: timeout: 5000ms #elasticsearch elasticsearch: - uris: "http://localhost:9200" - username: "elastic" - password: "" + uris: "http://${ES_HOST:localhost}:${ES_PORT:9200}" + username: ${ES_USER:"elastic"} + password: ${ES_PASSWORD:""} socket-timeout: 30000s connection-timeout: 10000s data: @@ -158,7 +158,7 @@ topiam: demo: open: true server: - console-public-base-url: https://eiam-console.topiam.cn - portal-public-base-url: https://eiam-portal.topiam.cn:8080 - openapi-public-base-url: https://eiam-openapi.topiam.cn - synchronizer-public-base-url: https://eia2m-synchronizer.topiam.cn \ No newline at end of file + console-public-base-url: https://localhost:1898 + portal-public-base-url: https://localhost:1989 + openapi-public-base-url: https://localhost:1988 + synchronizer-public-base-url: https://localhost:1986 \ No newline at end of file diff --git a/eiam-synchronizer/src/main/resources/application.yml b/eiam-synchronizer/src/main/resources/application.yml index cd08f458..a9950f8e 100644 --- a/eiam-synchronizer/src/main/resources/application.yml +++ b/eiam-synchronizer/src/main/resources/application.yml @@ -54,9 +54,9 @@ spring: datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/eiam_develop?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true - username: 'eiam' - password: '' + url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/eiam_develop?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true + username: ${MYSQL_USER:'eiam'} + password: ${MYSQL_PASSWORD:''} hikari: auto-commit: true connection-test-query: SELECT 1 @@ -68,9 +68,9 @@ spring: pool-name: eiam #reids redis: - host: localhost - port: 6379 - password: '' + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + password: ${REDIS_PASSWORD:''} database: 9 lettuce: pool: @@ -156,7 +156,7 @@ springdoc: #TopIAM topiam: server: - console-public-base-url: - portal-public-base-url: - openapi-public-base-url: - synchronizer-public-base-url: \ No newline at end of file + console-public-base-url: https://localhost:1898 + portal-public-base-url: https://localhost:1989 + openapi-public-base-url: https://localhost:1988 + synchronizer-public-base-url: https://localhost:1986 \ No newline at end of file From 8820b5929793b3c2ed97fd14af67ab9e87336617 Mon Sep 17 00:00:00 2001 From: "chenwen@trusfort.com" Date: Tue, 7 Feb 2023 13:55:53 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feature:=E6=B7=BB=E5=8A=A0=E5=8D=95?= =?UTF-8?q?=E6=9C=BA=E7=89=88=E6=9C=ACdocker-comspoe.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose-standalone.yml | 66 +++++++++++++++++++ docker-compose.yml | 62 ----------------- docker/eiam-console/Dockerfile | 50 ++++++++++++++ docker/eiam-openapi/Dockerfile | 50 ++++++++++++++ docker/eiam-portal/Dockerfile | 51 ++++++++++++++ docker/eiam-synchronizer/Dockerfile | 49 ++++++++++++++ docker/entrypoint.sh | 23 +++++++ .../src/main/resources/application.yml | 8 +-- 8 files changed, 293 insertions(+), 66 deletions(-) create mode 100644 docker-compose-standalone.yml delete mode 100644 docker-compose.yml create mode 100644 docker/eiam-console/Dockerfile create mode 100644 docker/eiam-openapi/Dockerfile create mode 100644 docker/eiam-portal/Dockerfile create mode 100644 docker/eiam-synchronizer/Dockerfile create mode 100644 docker/entrypoint.sh diff --git a/docker-compose-standalone.yml b/docker-compose-standalone.yml new file mode 100644 index 00000000..e287ace1 --- /dev/null +++ b/docker-compose-standalone.yml @@ -0,0 +1,66 @@ +version: '3' +x-public-common: &public-config + environment: + MYSQL_HOST: 192.168.56.107 # 配置数据库的信息 + MYSQL_USER: root + MYSQL_PASSWORD: admin + ES_HOST: 192.168.56.107 # 配置ES信息 + REDIS_HOST: 192.168.56.107 # 配置REDIS的信息 + REDIS_PASSWORD: 12345678 + CONSOLE_PUBLIC_BASE_URL: http://192.168.56.104:1898 + PORTAL_PUBLIC_BASE_URL: https://192.168.56.104:1989 + OPENAPI_PUBLIC_BASE_URL: http://192.168.56.104:1988 + SYNCHRONIZER_PUBLIC_BASE_URL: http://192.168.56.104:1986 +services: + eiam-console: + build: + context: . + dockerfile: docker/eiam-console/Dockerfile + <<: *public-config + container_name: eiam-console + ports: + - 1898:1898 + image: eiam-console + restart: always + networks: + - eiam-network + eiam-openapi: + build: + context: . + dockerfile: docker/eiam-openapi/Dockerfile + <<: *public-config + container_name: eiam-openapi + image: eiam-openapi + restart: always + ports: + - 1988:1988 + networks: + - eiam-network + eiam-portal: + build: + context: . + dockerfile: docker/eiam-portal/Dockerfile + <<: *public-config + container_name: eiam-portal + image: eiam-portal + restart: always + ports: + - 1989:1989 + networks: + - eiam-network + eiam-synchronizer: + build: + context: . + dockerfile: docker/eiam-synchronizer/Dockerfile + <<: *public-config + container_name: eiam-synchronizer + image: eiam-synchronizer + restart: always + ports: + - 1986:1986 + networks: + - eiam-network +networks: + eiam-network: + external: false + name: eiam-network diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 4e4a0674..00000000 --- a/docker-compose.yml +++ /dev/null @@ -1,62 +0,0 @@ -version: '3' -services: - eiam-console: - build: - context: ./eiam-console/ - dockerfile: Dockerfile - environment: - MYSQL_HOST: 192.168.56.107 - MYSQL_USER: root - MYSQL_PASSWORD: admin - ES_HOST: 192.168.56.107 - REDIS_HOST: 192.168.56.107 - REDIS_PASSWORD: 12345678 - ports: - - 1898:1898 - image: eiam-console - restart: always - eiam-openapi: - build: - context: ./eiam-openapi/ - dockerfile: Dockerfile - environment: - MYSQL_HOST: 192.168.56.107 - MYSQL_USER: root - MYSQL_PASSWORD: admin - ES_HOST: 192.168.56.107 - REDIS_HOST: 192.168.56.107 - REDIS_PASSWORD: 12345678 - image: eiam-openapi - restart: always - ports: - - 1988:1988 - eiam-portal: - build: - context: ./eiam-portal/ - dockerfile: Dockerfile - environment: - MYSQL_HOST: 192.168.56.107 - MYSQL_USER: root - MYSQL_PASSWORD: admin - ES_HOST: 192.168.56.107 - REDIS_HOST: 192.168.56.107 - REDIS_PASSWORD: 12345678 - image: eiam-portal - restart: always - ports: - - 1989:1989 - eiam-synchronizer: - build: - context: ./eiam-synchronizer/ - dockerfile: Dockerfile - environment: - MYSQL_HOST: 192.168.56.107 - MYSQL_USER: root - MYSQL_PASSWORD: admin - ES_HOST: 192.168.56.107 - REDIS_HOST: 192.168.56.107 - REDIS_PASSWORD: 12345678 - image: eiam-synchronizer - restart: always - ports: - - 1986:1986 diff --git a/docker/eiam-console/Dockerfile b/docker/eiam-console/Dockerfile new file mode 100644 index 00000000..e0991362 --- /dev/null +++ b/docker/eiam-console/Dockerfile @@ -0,0 +1,50 @@ +# +# TopIAM Employee - Employee Identity and Access Management Program +# Copyright © 2020-2023 TopIAM (support@topiam.cn) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +FROM azul/zulu-openjdk:17-jre as build +WORKDIR /workspace/app +ARG MODULE_NAME=eiam-console +ARG JAR_FILE=${MODULE_NAME}/target/topiam-employee-console-*.jar +COPY ${JAR_FILE} target/application.jar +RUN java -Djarmode=layertools -jar target/application.jar extract --destination target/extracted + +FROM azul/zulu-openjdk:17-jre + +ARG EXTRACTED=/workspace/app/target/extracted +WORKDIR topiam +ARG ENTRYPOINT_FILE=docker/entrypoint.sh +COPY ${ENTRYPOINT_FILE} / +COPY --from=build ${EXTRACTED}/dependencies/ ./ +COPY --from=build ${EXTRACTED}/spring-boot-loader/ ./ +COPY --from=build ${EXTRACTED}/snapshot-dependencies/ ./ +COPY --from=build ${EXTRACTED}/application/ ./ + + +ENV TZ=Asia/Shanghai +RUN sed -i 's/archive.ubuntu.com/cn.archive.ubuntu.com/g' /etc/apt/sources.list \ + && apt-get update \ + && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \ + && apt-get install tzdata \ + && apt-get clean \ + && apt-get autoclean \ + && apt-get autoremove \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + +EXPOSE 1898 + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/docker/eiam-openapi/Dockerfile b/docker/eiam-openapi/Dockerfile new file mode 100644 index 00000000..218b89ab --- /dev/null +++ b/docker/eiam-openapi/Dockerfile @@ -0,0 +1,50 @@ +# +# TopIAM Employee - Employee Identity and Access Management Program +# Copyright © 2020-2023 TopIAM (support@topiam.cn) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +FROM azul/zulu-openjdk:17-jre as build +WORKDIR /workspace/app +ARG MODULE_NAME=eiam-openapi +ARG JAR_FILE=${MODULE_NAME}/target/topiam-employee-openapi-*.jar +COPY ${JAR_FILE} target/application.jar +RUN java -Djarmode=layertools -jar target/application.jar extract --destination target/extracted + +FROM azul/zulu-openjdk:17-jre + +ARG EXTRACTED=/workspace/app/target/extracted +WORKDIR topiam +ARG ENTRYPOINT_FILE=docker/entrypoint.sh +COPY ${ENTRYPOINT_FILE} / +COPY --from=build ${EXTRACTED}/dependencies/ ./ +COPY --from=build ${EXTRACTED}/spring-boot-loader/ ./ +COPY --from=build ${EXTRACTED}/snapshot-dependencies/ ./ +COPY --from=build ${EXTRACTED}/application/ ./ + + +ENV TZ=Asia/Shanghai +RUN sed -i 's/archive.ubuntu.com/cn.archive.ubuntu.com/g' /etc/apt/sources.list \ + && apt-get update \ + && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \ + && apt-get install tzdata \ + && apt-get clean \ + && apt-get autoclean \ + && apt-get autoremove \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + +EXPOSE 1988 + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/docker/eiam-portal/Dockerfile b/docker/eiam-portal/Dockerfile new file mode 100644 index 00000000..abd1861a --- /dev/null +++ b/docker/eiam-portal/Dockerfile @@ -0,0 +1,51 @@ +# +# TopIAM Employee - Employee Identity and Access Management Program +# Copyright © 2020-2023 TopIAM (support@topiam.cn) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +FROM azul/zulu-openjdk:17-jre as build +WORKDIR /workspace/app +ARG MODULE_NAME=eiam-portal +ARG JAR_FILE=${MODULE_NAME}/target/topiam-employee-portal-*.jar +COPY ${JAR_FILE} target/application.jar +RUN java -Djarmode=layertools -jar target/application.jar extract --destination target/extracted + +FROM azul/zulu-openjdk:17-jre + + + +ARG EXTRACTED=/workspace/app/target/extracted +WORKDIR topiam +ARG ENTRYPOINT_FILE=docker/entrypoint.sh +COPY ${ENTRYPOINT_FILE} / +COPY --from=build ${EXTRACTED}/dependencies/ ./ +COPY --from=build ${EXTRACTED}/spring-boot-loader/ ./ +COPY --from=build ${EXTRACTED}/snapshot-dependencies/ ./ +COPY --from=build ${EXTRACTED}/application/ ./ + +ENV TZ=Asia/Shanghai +RUN sed -i 's/archive.ubuntu.com/cn.archive.ubuntu.com/g' /etc/apt/sources.list \ + && apt-get update \ + && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \ + && apt-get install tzdata \ + && apt-get clean \ + && apt-get autoclean \ + && apt-get autoremove \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + +EXPOSE 1989 + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/docker/eiam-synchronizer/Dockerfile b/docker/eiam-synchronizer/Dockerfile new file mode 100644 index 00000000..4fcad8f3 --- /dev/null +++ b/docker/eiam-synchronizer/Dockerfile @@ -0,0 +1,49 @@ +# +# TopIAM Employee - Employee Identity and Access Management Program +# Copyright © 2020-2023 TopIAM (support@topiam.cn) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +FROM azul/zulu-openjdk:17-jre as build +WORKDIR /workspace/app +ARG MODULE_NAME=eiam-synchronizer +ARG JAR_FILE=${MODULE_NAME}/target/topiam-employee-synchronizer-*.jar +COPY ${JAR_FILE} target/application.jar +RUN java -Djarmode=layertools -jar target/application.jar extract --destination target/extracted + +FROM azul/zulu-openjdk:17-jre +ARG ENTRYPOINT_FILE=docker/entrypoint.sh +COPY ${ENTRYPOINT_FILE} / +ARG EXTRACTED=/workspace/app/target/extracted +WORKDIR topiam +COPY --from=build ${EXTRACTED}/dependencies/ ./ +COPY --from=build ${EXTRACTED}/spring-boot-loader/ ./ +COPY --from=build ${EXTRACTED}/snapshot-dependencies/ ./ +COPY --from=build ${EXTRACTED}/application/ ./ + + +ENV TZ=Asia/Shanghai +RUN sed -i 's/archive.ubuntu.com/cn.archive.ubuntu.com/g' /etc/apt/sources.list \ + && apt-get update \ + && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \ + && apt-get install tzdata \ + && apt-get clean \ + && apt-get autoclean \ + && apt-get autoremove \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + +EXPOSE 1986 + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 00000000..cd5973f1 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# +# TopIAM Employee - Employee Identity and Access Management Program +# Copyright © 2020-2023 TopIAM (support@topiam.cn) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +java -XX:TieredStopAtLevel=1 \ + -Djava.security.egd=file:/dev/./urandom \ + -Dspring.main.lazy-initialization=false \ + org.springframework.boot.loader.JarLauncher \ No newline at end of file diff --git a/eiam-console/src/main/resources/application.yml b/eiam-console/src/main/resources/application.yml index 38b94c96..9cb91992 100644 --- a/eiam-console/src/main/resources/application.yml +++ b/eiam-console/src/main/resources/application.yml @@ -156,7 +156,7 @@ springdoc: #TopIAM topiam: server: - console-public-base-url: https://localhost:1898 - portal-public-base-url: https://localhost:1989 - openapi-public-base-url: https://localhost:1988 - synchronizer-public-base-url: https://localhost:1986 \ No newline at end of file + console-public-base-url: ${CONSOLE_PUBLIC_BASE_URL:https://localhost:1898} + portal-public-base-url: ${PORTAL_PUBLIC_BASE_URL:https://localhost:1989} + openapi-public-base-url: ${OPENAPI_PUBLIC_BASE_URL:https://localhost:1988} + synchronizer-public-base-url: ${SYNCHRONIZER_PUBLIC_BASE_URL:https://localhost:1986} \ No newline at end of file From 60aa953897223d7a0f35a5e9186fe46f943f91f7 Mon Sep 17 00:00:00 2001 From: "chenwen@trusfort.com" Date: Wed, 8 Feb 2023 15:55:22 +0800 Subject: [PATCH 3/5] =?UTF-8?q?feature:=E6=B7=BB=E5=8A=A0DB=EF=BC=8CREDIS?= =?UTF-8?q?=EF=BC=8CES=20Docker=E5=88=B0docker-compose=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E8=87=AA=E5=8A=A8=E5=90=AF=E5=8A=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose-standalone.yml | 117 +++++++++++++++++++++++++++++++--- 1 file changed, 108 insertions(+), 9 deletions(-) diff --git a/docker-compose-standalone.yml b/docker-compose-standalone.yml index e287ace1..8e2aeec6 100644 --- a/docker-compose-standalone.yml +++ b/docker-compose-standalone.yml @@ -1,17 +1,83 @@ version: '3' x-public-common: &public-config environment: - MYSQL_HOST: 192.168.56.107 # 配置数据库的信息 + MYSQL_HOST: eiam-db # 配置数据库的信息 MYSQL_USER: root - MYSQL_PASSWORD: admin - ES_HOST: 192.168.56.107 # 配置ES信息 - REDIS_HOST: 192.168.56.107 # 配置REDIS的信息 - REDIS_PASSWORD: 12345678 - CONSOLE_PUBLIC_BASE_URL: http://192.168.56.104:1898 - PORTAL_PUBLIC_BASE_URL: https://192.168.56.104:1989 - OPENAPI_PUBLIC_BASE_URL: http://192.168.56.104:1988 - SYNCHRONIZER_PUBLIC_BASE_URL: http://192.168.56.104:1986 + MYSQL_PASSWORD: topiam + ES_HOST: eiam-es # 配置ES信息 + REDIS_HOST: eiam-redis # 配置REDIS的信息 + REDIS_PASSWORD: topiam + CONSOLE_PUBLIC_BASE_URL: http://localhost:1898 + PORTAL_PUBLIC_BASE_URL: https://localhost:1989 + OPENAPI_PUBLIC_BASE_URL: http://localhost:1988 + SYNCHRONIZER_PUBLIC_BASE_URL: http://localhost:1986 services: + eiam-es: + image: docker.elastic.co/elasticsearch/elasticsearch:6.8.16 + container_name: "eiam-es" + environment: + - discovery.type=single-node + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + ulimits: + memlock: + soft: -1 + hard: -1 + ports: + - "9200:9200" + - "9300:9300" + healthcheck: + test: [ "CMD", "curl" , "-f", "http://localhost:9200/_cat/health?v" ] + timeout: 20s + retries: 10 + volumes: + - eiam_es_data:/usr/share/elasticsearch/data + networks: + - eiam-network + eiam-db: + image: mysql:8.0 + container_name: "eiam-db" + environment: + - MYSQL_ROOT_PASSWORD=topiam + - MYSQL_DATABASE=eiam_develop + healthcheck: + test: [ "CMD", "mysqladmin" , "-ptopiam", "-hlocalhost","ping"] + timeout: 20s + retries: 10 + ports: + - "3306:3306" + volumes: + - eiam_db_data:/var/lib/mysql + networks: + - eiam-network + eiam-db-admin: + container_name: "eiam-db-admin" + image: phpmyadmin:latest + ports: + - "7080:80" + environment: + - PMA_HOST=eiam-db + - UPLOAD_LIMIT=512M + healthcheck: + test: [ "CMD", "curl" , "-f", "http://localhost" ] + timeout: 20s + retries: 10 + depends_on: + eiam-db: + condition: service_healthy + networks: + - eiam-network + eiam-redis: + image: redis:7.0 + container_name: "eiam-redis" + command: redis-server --requirepass topiam + healthcheck: + test: [ "CMD", "redis-cli" ,"ping" ] + timeout: 20s + retries: 10 + ports: + - "6379:6379" + networks: + - eiam-network eiam-console: build: context: . @@ -22,6 +88,15 @@ services: - 1898:1898 image: eiam-console restart: always + depends_on: + eiam-es: + condition: service_healthy + eiam-db: + condition: service_healthy + eiam-redis: + condition: service_healthy + eiam-db-admin: + condition: service_healthy networks: - eiam-network eiam-openapi: @@ -34,6 +109,13 @@ services: restart: always ports: - 1988:1988 + depends_on: + eiam-es: + condition: service_healthy + eiam-db: + condition: service_healthy + eiam-redis: + condition: service_healthy networks: - eiam-network eiam-portal: @@ -46,6 +128,13 @@ services: restart: always ports: - 1989:1989 + depends_on: + eiam-es: + condition: service_healthy + eiam-db: + condition: service_healthy + eiam-redis: + condition: service_healthy networks: - eiam-network eiam-synchronizer: @@ -58,9 +147,19 @@ services: restart: always ports: - 1986:1986 + depends_on: + eiam-es: + condition: service_healthy + eiam-db: + condition: service_healthy + eiam-redis: + condition: service_healthy networks: - eiam-network networks: eiam-network: external: false name: eiam-network +volumes: + eiam_es_data: + eiam_db_data: From f9f1ba1f2d7a8aad9d24d3c4feccce2ab4dfe984 Mon Sep 17 00:00:00 2001 From: "chenwen@trusfort.com" Date: Wed, 8 Feb 2023 21:20:04 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=E8=A7=A3=E5=86=B3ES=20Clien=20Bean?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=A4=B1=E8=B4=A5=EF=BC=8C=E7=BC=BA=E5=B0=91?= =?UTF-8?q?=E7=B1=BB=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index c5f138f1..acab3121 100644 --- a/pom.xml +++ b/pom.xml @@ -376,6 +376,11 @@ org.springframework.boot spring-boot-starter-data-elasticsearch + + org.apache.lucene + lucene-core + 8.11.1 + org.springframework.boot From 7b76776207fc27e279e0417f739086b63454eeb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=81=E5=AE=A2=E5=BC=80=E6=BA=90?= Date: Thu, 9 Feb 2023 13:29:08 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8E=9F=E6=9D=A5?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=87=8C=E9=9D=A2=E7=9A=84Dockfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eiam-console/Dockerfile | 48 ----------------------------------- eiam-openapi/Dockerfile | 48 ----------------------------------- eiam-portal/Dockerfile | 49 ------------------------------------ eiam-synchronizer/Dockerfile | 48 ----------------------------------- 4 files changed, 193 deletions(-) delete mode 100644 eiam-console/Dockerfile delete mode 100644 eiam-openapi/Dockerfile delete mode 100644 eiam-portal/Dockerfile delete mode 100644 eiam-synchronizer/Dockerfile diff --git a/eiam-console/Dockerfile b/eiam-console/Dockerfile deleted file mode 100644 index 75d45de8..00000000 --- a/eiam-console/Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -# -# eiam-console - Employee Identity and Access Management Program -# Copyright © 2020-2023 TopIAM (support@topiam.cn) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# - -FROM azul/zulu-openjdk:17-jre as build -WORKDIR /workspace/app - -ARG JAR_FILE=target/topiam-employee-console-*.jar -COPY ${JAR_FILE} target/application.jar -RUN java -Djarmode=layertools -jar target/application.jar extract --destination target/extracted - -FROM azul/zulu-openjdk:17-jre - -ARG EXTRACTED=/workspace/app/target/extracted -WORKDIR topiam -COPY --from=build ${EXTRACTED}/dependencies/ ./ -COPY --from=build ${EXTRACTED}/spring-boot-loader/ ./ -COPY --from=build ${EXTRACTED}/snapshot-dependencies/ ./ -COPY --from=build ${EXTRACTED}/application/ ./ - - -ENV TZ=Asia/Shanghai -RUN sed -i 's/archive.ubuntu.com/cn.archive.ubuntu.com/g' /etc/apt/sources.list \ - && apt-get update \ - && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \ - && apt-get install tzdata \ - && apt-get clean \ - && apt-get autoclean \ - && apt-get autoremove \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ - -EXPOSE 1898 - -ENTRYPOINT ["java","-XX:TieredStopAtLevel=1","-Djava.security.egd=file:/dev/./urandom","-Dspring.main.lazy-initialization=false","org.springframework.boot.loader.JarLauncher"] \ No newline at end of file diff --git a/eiam-openapi/Dockerfile b/eiam-openapi/Dockerfile deleted file mode 100644 index 29324e76..00000000 --- a/eiam-openapi/Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -# -# eiam-openapi - Employee Identity and Access Management Program -# Copyright © 2020-2023 TopIAM (support@topiam.cn) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# - -FROM azul/zulu-openjdk:17-jre as build -WORKDIR /workspace/app - -ARG JAR_FILE=target/topiam-employee-openapi-*.jar -COPY ${JAR_FILE} target/application.jar -RUN java -Djarmode=layertools -jar target/application.jar extract --destination target/extracted - -FROM azul/zulu-openjdk:17-jre - -ARG EXTRACTED=/workspace/app/target/extracted -WORKDIR topiam -COPY --from=build ${EXTRACTED}/dependencies/ ./ -COPY --from=build ${EXTRACTED}/spring-boot-loader/ ./ -COPY --from=build ${EXTRACTED}/snapshot-dependencies/ ./ -COPY --from=build ${EXTRACTED}/application/ ./ - - -ENV TZ=Asia/Shanghai -RUN sed -i 's/archive.ubuntu.com/cn.archive.ubuntu.com/g' /etc/apt/sources.list \ - && apt-get update \ - && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \ - && apt-get install tzdata \ - && apt-get clean \ - && apt-get autoclean \ - && apt-get autoremove \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ - -EXPOSE 1988 - -ENTRYPOINT ["java","-XX:TieredStopAtLevel=1","-Djava.security.egd=file:/dev/./urandom","-Dspring.main.lazy-initialization=false","org.springframework.boot.loader.JarLauncher"] \ No newline at end of file diff --git a/eiam-portal/Dockerfile b/eiam-portal/Dockerfile deleted file mode 100644 index b6819c15..00000000 --- a/eiam-portal/Dockerfile +++ /dev/null @@ -1,49 +0,0 @@ -# -# eiam-portal - Employee Identity and Access Management Program -# Copyright © 2020-2023 TopIAM (support@topiam.cn) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# - -FROM azul/zulu-openjdk:17-jre as build -WORKDIR /workspace/app - -ARG JAR_FILE=target/topiam-employee-portal-*.jar -COPY ${JAR_FILE} target/application.jar -RUN java -Djarmode=layertools -jar target/application.jar extract --destination target/extracted - -FROM azul/zulu-openjdk:17-jre - - - -ARG EXTRACTED=/workspace/app/target/extracted -WORKDIR topiam -COPY --from=build ${EXTRACTED}/dependencies/ ./ -COPY --from=build ${EXTRACTED}/spring-boot-loader/ ./ -COPY --from=build ${EXTRACTED}/snapshot-dependencies/ ./ -COPY --from=build ${EXTRACTED}/application/ ./ - -ENV TZ=Asia/Shanghai -RUN sed -i 's/archive.ubuntu.com/cn.archive.ubuntu.com/g' /etc/apt/sources.list \ - && apt-get update \ - && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \ - && apt-get install tzdata \ - && apt-get clean \ - && apt-get autoclean \ - && apt-get autoremove \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ - -EXPOSE 1989 - -ENTRYPOINT ["java","-XX:TieredStopAtLevel=1","-Djava.security.egd=file:/dev/./urandom","-Dspring.main.lazy-initialization=false","org.springframework.boot.loader.JarLauncher"] \ No newline at end of file diff --git a/eiam-synchronizer/Dockerfile b/eiam-synchronizer/Dockerfile deleted file mode 100644 index f1555f97..00000000 --- a/eiam-synchronizer/Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -# -# eiam-synchronizer - Employee Identity and Access Management Program -# Copyright © 2020-2023 TopIAM (support@topiam.cn) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# - -FROM azul/zulu-openjdk:17-jre as build -WORKDIR /workspace/app - -ARG JAR_FILE=target/topiam-employee-synchronizer-*.jar -COPY ${JAR_FILE} target/application.jar -RUN java -Djarmode=layertools -jar target/application.jar extract --destination target/extracted - -FROM azul/zulu-openjdk:17-jre - -ARG EXTRACTED=/workspace/app/target/extracted -WORKDIR topiam -COPY --from=build ${EXTRACTED}/dependencies/ ./ -COPY --from=build ${EXTRACTED}/spring-boot-loader/ ./ -COPY --from=build ${EXTRACTED}/snapshot-dependencies/ ./ -COPY --from=build ${EXTRACTED}/application/ ./ - - -ENV TZ=Asia/Shanghai -RUN sed -i 's/archive.ubuntu.com/cn.archive.ubuntu.com/g' /etc/apt/sources.list \ - && apt-get update \ - && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \ - && apt-get install tzdata \ - && apt-get clean \ - && apt-get autoclean \ - && apt-get autoremove \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ - -EXPOSE 1986 - -ENTRYPOINT ["java","-XX:TieredStopAtLevel=1","-Djava.security.egd=file:/dev/./urandom","-Dspring.main.lazy-initialization=false","org.springframework.boot.loader.JarLauncher"] \ No newline at end of file