IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> Java知识库 -> PigCloud项目的使用解析一 -> 正文阅读

[Java知识库]PigCloud项目的使用解析一

1.项目结构

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

2.父模块分析

pom.xml:

<?xml version="1.0" encoding="UTF-8"?>

<!-- ~ Copyright (c) 2020 pig4cloud Authors. All Rights Reserved. ~ ~ Licensed 
	under the Apache License, Version 2.0 (the "License"); ~ you may not use 
	this file except in compliance with the License. ~ You may obtain a copy 
	of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless 
	required by applicable law or agreed to in writing, software ~ distributed 
	under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES 
	OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for 
	the specific language governing permissions and ~ limitations under the License. -->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://maven.apache.org/POM/4.0.0"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<!-- 源码: https://gitee.com/log4j/pig-cloud-dependencies-parent -->
		<groupId>com.pig4cloud</groupId>
		<artifactId>pig-cloud-dependencies-parent</artifactId>
		<version>3.1.1</version>
	</parent>

	<groupId>com.pig4cloud</groupId>
	<artifactId>pig</artifactId>
	<version>3.1.1</version>
	<name>${project.artifactId}</name>
	<packaging>pom</packaging>
	<url>https://www.pig4cloud.com</url>

	<properties>
		<redisson-spring-boot-starter.version>3.15.4</redisson-spring-boot-starter.version>
		<tinypinyin.version>2.0.3.RELEASE</tinypinyin.version>
		<commons-net.version>3.8.0</commons-net.version>
		<yaml.version>1.28</yaml.version>
		<nginxparser.version>0.9.6</nginxparser.version>
		<bcpkix-jdk15to18.version>1.68</bcpkix-jdk15to18.version>
		<metadata-extractor.version>2.16.0</metadata-extractor.version>

		<spring-boot.version>2.4.4</spring-boot.version>
		<spring-cloud.version>2020.0.2</spring-cloud.version>
		<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
		<spring-boot-admin.version>2.3.1</spring-boot-admin.version>
		<hutool.version>5.6.3</hutool.version>
		<mybatis-plus.version>3.4.2</mybatis-plus.version>
		<dynamic-ds.version>3.3.2</dynamic-ds.version>
		<captcha.version>2.2.0</captcha.version>
		<velocity.version>1.7</velocity.version>
		<configuration.version>1.10</configuration.version>
		<nacos.version>2.0.0</nacos.version>
		<jasypt.version>2.1.0</jasypt.version>
		<knife4j.version>3.0.2</knife4j.version>
		<xxl-job.version>2.3.0</xxl-job.version>
		<docker.plugin.version>0.36.1</docker.plugin.version>
		<docker.host>http://192.168.7.206:2375</docker.host>
		<docker.registry>http://47.106.103.68:5005</docker.registry>
		<docker.namespace>rbs_mc3</docker.namespace>
		<docker.username>admin</docker.username>
		<docker.password>Harbor12345</docker.password>
		<transmittable-thread-local.version>2.12.1</transmittable-thread-local.version>
		<excel-spring-boot-starter.version>0.4.1</excel-spring-boot-starter.version>
		<oshi.version>5.7.5</oshi.version>
		<mica-core.version>2.5.2</mica-core.version>
		<dom4j.version>2.1.3</dom4j.version>
		<cxf.version>3.4.3</cxf.version>
		<idempotent-spring-boot-starter.version>0.0.4</idempotent-spring-boot-starter.version>
		<log4j2.version>2.15.0</log4j2.version>
	</properties>

	<dependencies>
		<!--bootstrap 启动器 -->
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-bootstrap</artifactId>
		</dependency>
		<!--配置文件处理器 -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-configuration-processor</artifactId>
			<optional>true</optional>
		</dependency>
		<!--配置文件加解密 -->
		<dependency>
			<groupId>com.github.ulisesbocchio</groupId>
			<artifactId>jasypt-spring-boot-starter</artifactId>
			<version>${jasypt.version}</version>
		</dependency>
		<!--监控 -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
		<!--监控客户端 -->
		<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-starter-client</artifactId>
			<version>${spring-boot-admin.version}</version>
		</dependency>
		<!--Lombok -->
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<scope>provided</scope>
		</dependency>
		<!--测试依赖 -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<modules>
		<module>pig-register</module>
		<module>pig-gateway</module>
		<module>pig-auth</module>
		<module>pig-upms</module>
		<module>pig-common</module>
		<module>pig-visual</module>
		<module>mc-inner-conn</module>
		<module>mc-res-center</module>
		<module>mc-edu</module>
		<module>mc-out-tran</module>
		<module>mc-auth-third</module>
    <module>mc-file</module>
    </modules>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>com.pig4cloud</groupId>
				<artifactId>mc-common-swagger</artifactId>
				<version>${project.version}</version>
			</dependency>
			<!-- spring boot 依赖 -->
			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-dependencies</artifactId>
				<version>${spring-boot.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
			<!-- spring cloud 依赖 -->
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-dependencies</artifactId>
				<version>${spring-cloud.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
			<!-- spring cloud alibaba 依赖 -->
			<dependency>
				<groupId>com.alibaba.cloud</groupId>
				<artifactId>spring-cloud-alibaba-dependencies</artifactId>
				<version>${spring-cloud-alibaba.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<!-- 父子线程之间的数据传递 ttl -->
			<dependency>
				<groupId>com.alibaba</groupId>
				<artifactId>transmittable-thread-local</artifactId>
				<version>${transmittable-thread-local.version}</version>
			</dependency>

			<!-- excel 导入导出 -->
			<dependency>
				<groupId>com.pig4cloud.excel</groupId>
				<artifactId>excel-spring-boot-starter</artifactId>
				<version>${excel-spring-boot-starter.version}</version>
			</dependency>

			<!--XSS 安全过滤 -->
			<dependency>
				<groupId>net.dreamlu</groupId>
				<artifactId>mica-core</artifactId>
				<version>${mica-core.version}</version>
			</dependency>
			<dependency>
				<groupId>net.dreamlu</groupId>
				<artifactId>mica-xss</artifactId>
				<version>${mica-core.version}</version>
			</dependency>

			<dependency>
				<groupId>org.dom4j</groupId>
				<artifactId>dom4j</artifactId>
				<version>${dom4j.version}</version>
			</dependency>

			<!--webservice引入apache cxf包 -->
			<dependency>
				<groupId>org.apache.cxf</groupId>
				<artifactId>cxf-rt-transports-http</artifactId>
				<version>${cxf.version}</version>
				<exclusions>
					<exclusion>
						<artifactId>spring-web</artifactId>
						<groupId>org.springframework</groupId>
					</exclusion>
				</exclusions>
			</dependency>

			<dependency>
				<groupId>org.apache.cxf</groupId>
				<artifactId>cxf-rt-frontend-jaxws</artifactId>
				<version>${cxf.version}</version>
				<exclusions>
					<exclusion>
						<artifactId>wstx-asl</artifactId>
						<groupId>org.codehaus.woodstox</groupId>
					</exclusion>
				</exclusions>
			</dependency>

			<dependency>
				<groupId>com.pig4cloud.plugin</groupId>
				<artifactId>idempotent-spring-boot-starter</artifactId>
				<version>${idempotent-spring-boot-starter.version}</version>
			</dependency>


			<!-- redis for springboot -->
			<dependency>
				<groupId>org.redisson</groupId>
				<artifactId>redisson-spring-boot-starter</artifactId>
				<version>${redisson-spring-boot-starter.version}</version>
				<exclusions>
					<exclusion>
						<groupId>org.springframework.boot</groupId>
						<artifactId>spring-boot-starter-web</artifactId>
					</exclusion>
				</exclusions>
			</dependency>

			<!-- 拼音库 -->
			<dependency>
				<groupId>io.github.biezhi</groupId>
				<artifactId>TinyPinyin</artifactId>
				<version>${tinypinyin.version}</version>
			</dependency>

			<!-- ftp网络协议库 -->
			<dependency>
				<groupId>commons-net</groupId>
				<artifactId>commons-net</artifactId>
				<version>${commons-net.version}</version>
			</dependency>

			<!-- yaml解析库 -->
			<dependency>
				<groupId>org.yaml</groupId>
				<artifactId>snakeyaml</artifactId>
				<version>${yaml.version}</version>
			</dependency>

			<!-- nginx配置文件解析库 -->
			<dependency>
				<groupId>com.github.odiszapc</groupId>
				<artifactId>nginxparser</artifactId>
				<version>${nginxparser.version}</version>
			</dependency>

			<!-- 加密算法库 -->
			<dependency>
				<groupId>org.bouncycastle</groupId>
				<artifactId>bcpkix-jdk15to18</artifactId>
				<version>${bcpkix-jdk15to18.version}</version>
			</dependency>

			<!-- 媒体文件解析库 -->
			<dependency>
				<groupId>com.drewnoakes</groupId>
				<artifactId>metadata-extractor</artifactId>
				<version>${metadata-extractor.version}</version>
			</dependency>

			<!-- log4j2 版本漏洞 -->
			<dependency>
				<groupId>org.apache.logging.log4j</groupId>
				<artifactId>log4j-api</artifactId>
				<version>${log4j2.version}</version>
			</dependency>

			<dependency>
				<groupId>org.apache.logging.log4j</groupId>
				<artifactId>log4j-to-slf4j</artifactId>
				<version>${log4j2.version}</version>
			</dependency>

		</dependencies>
	</dependencyManagement>

	<build>
		<finalName>${project.name}</finalName>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.springframework.boot</groupId>
					<artifactId>spring-boot-maven-plugin</artifactId>
					<version>${spring-boot.version}</version>
					<executions>
						<execution>
							<id>repackage</id>
							<goals>
								<goal>repackage</goal>
							</goals>
							<phase>package</phase>
							<configuration>
								<finalName>${project.build.finalName}</finalName>
								<layers>
									<enabled>true</enabled>
								</layers>
							</configuration>
						</execution>
						<!--<execution> <id>build-image</id> <goals> <goal>build-image</goal> 
							</goals> <phase>package</phase> <configuration> <classifier>devUse</classifier> 
							<finalName>${project.build.finalName}</finalName> <layers> <enabled>true</enabled> 
							</layers> <image> &lt;!&ndash;配置镜像名称&ndash;&gt; <name>192.168.7.193:5000/edu/${project.name}:${project.version}</name> 
							&lt;!&ndash;镜像打包完成后自动推送到镜像仓库&ndash;&gt; <publish>true</publish> <builder>registry.cn-shenzhen.aliyuncs.com/eduteam/builder:base-platform-api-0.3</builder> 
							<runImage>registry.cn-shenzhen.aliyuncs.com/eduteam/runimage:base-cnb</runImage> 
							</image> <docker> &lt;!&ndash;Docker远程管理地址&ndash;&gt; <host>http://192.168.7.193:2375</host> 
							&lt;!&ndash;不使用TLS访问&ndash;&gt; <tlsVerify>false</tlsVerify> <builderRegistry> 
							&lt;!&ndash;推送镜像仓库用户名&ndash;&gt; <username>eduteam</username> &lt;!&ndash;推送镜像仓库密码&ndash;&gt; 
							<password>eduteam</password> &lt;!&ndash;推送镜像仓库地址&ndash;&gt; <url>http://192.168.7.193:5000</url> 
							</builderRegistry> &lt;!&ndash;Docker推送镜像仓库配置&ndash;&gt; <publishRegistry> 
							<username>eduteam</username> <password>eduteam</password> <url>http://192.168.7.193:5000</url> 
							</publishRegistry> </docker> </configuration> </execution> -->
					</executions>
					<!--<configuration> <finalName>${project.build.finalName}</finalName> 
						<layers> <enabled>true</enabled> </layers> <image> &lt;!&ndash;配置镜像名称&ndash;&gt; 
						<name>192.168.7.193:5000/edu/${project.name}:${project.version}</name> &lt;!&ndash;镜像打包完成后自动推送到镜像仓库&ndash;&gt; 
						<publish>true</publish> <builder>registry.cn-shenzhen.aliyuncs.com/eduteam/builder:base-platform-api-0.3</builder> 
						<runImage>registry.cn-shenzhen.aliyuncs.com/eduteam/runimage:base-cnb</runImage> 
						</image> <docker> &lt;!&ndash;Docker远程管理地址&ndash;&gt; <host>http://192.168.7.193:2375</host> 
						&lt;!&ndash;不使用TLS访问&ndash;&gt; <tlsVerify>false</tlsVerify> <builderRegistry> 
						&lt;!&ndash;推送镜像仓库用户名&ndash;&gt; <username>eduteam</username> &lt;!&ndash;推送镜像仓库密码&ndash;&gt; 
						<password>eduteam</password> &lt;!&ndash;推送镜像仓库地址&ndash;&gt; <url>http://192.168.7.193:5000</url> 
						</builderRegistry> &lt;!&ndash;Docker推送镜像仓库配置&ndash;&gt; <publishRegistry> 
						<username>eduteam</username> <password>eduteam</password> <url>http://192.168.7.193:5000</url> 
						</publishRegistry> </docker> </configuration> <executions> <execution> <phase>package</phase> 
						<goals> <goal>repackage</goal> <goal>build-image</goal> </goals> </execution> 
						</executions> -->
				</plugin>

				<plugin>
					<groupId>io.fabric8</groupId>
					<artifactId>docker-maven-plugin</artifactId>
					<version>${docker.plugin.version}</version>
					<configuration>
						<!-- Docker 远程管理地址 -->
						<dockerHost>${docker.host}</dockerHost>
						<!-- Docker 推送镜像仓库地址-->
						<pushRegistry>${docker.registry}</pushRegistry>
						<!-- 认证 -->
						<authConfig>
							<push>
								<username>${docker.username}</username>
								<password>${docker.password}</password>
							</push>
						</authConfig>
						<images>
							<image>
								<name>47.106.103.68:5005/${docker.namespace}/${project.name}:latest</name>
								<build>
									<noCache>true</noCache>
									<dockerFileDir>${project.basedir}</dockerFileDir>
                   <!--<dockerFile>${project.basedir}/Dockerfile</dockerFile>-->
								</build>
							</image>
						</images>
					</configuration>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-assembly-plugin</artifactId>
					<inherited>false</inherited>
					<configuration>
						<finalName>${project.name}</finalName>
						<descriptors>
							<descriptor>${project.basedir}/assembly/assembly.xml</descriptor><!--配置描述文件路径 -->
						</descriptors>
					</configuration>
					<executions>
						<execution><!-- 配置执行器 -->
							<id>make-assembly</id>
							<!-- 绑定到package生命周期阶段上 -->
							<phase>package</phase>
							<goals>
								<!-- 只运行一次 -->
								<goal>single</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
			</plugins>
		</pluginManagement>

		<plugins>
			<plugin>
				<groupId>io.fabric8</groupId>
				<artifactId>docker-maven-plugin</artifactId>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.5</version>
				<configuration>
					<encoding>UTF-8</encoding>
					<nonFilteredFileExtensions>
						<nonFilteredFileExtension>xlsx</nonFilteredFileExtension>
						<nonFilteredFileExtension>xls</nonFilteredFileExtension>
					</nonFilteredFileExtensions>
				</configuration>
			</plugin>

		</plugins>

	</build>

	<profiles>
		<profile>
			<id>dev</id>
			<properties>
				<!-- 环境标识,需要与配置文件的名称相对应 -->
				<profiles.active>dev</profiles.active>
			</properties>
			<activation>
				<!-- 默认环境 -->
				<activeByDefault>true</activeByDefault>
			</activation>
		</profile>
	</profiles>

</project>

docker-compose.yml:

version: '2.1'
services:

  #  mysql数据库服务
  pig-mysql:
    build:
      context: ./db      #去db目录下找dockerfile文件
    environment:
      - MYSQL_ROOT_PASSWORD=linux
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    restart: always
    container_name: pig-mysql
    hostname: pig-mysql
    image: pig-mysql
    ports:
      - 3306:3306
    volumes:
      - ./db/my.cnf:/etc/mysql/my.cnf
    ulimits:
      nproc: 65535
      nofile:
        soft: 65536
        hard: 65536
    network_mode: host
    healthcheck:
      test: [ "CMD", "mysql", "-u", "root", "-plinux", "-e", "select count(*) from mc.area_code" ]
      interval: 15s
      timeout: 10s
      retries: 5

  #  redis缓存服务
  pig-redis:
    image: redis:6.0
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    ports:
      - 6379:6379
    command: redis-server --requirepass fsmeeting0229 --appendonly yes
    restart: always
    container_name: pig-redis
    hostname: pig-redis
    network_mode: host
    healthcheck:
      test: [ "CMD", "redis-cli","-a","fsmeeting0229","ping" ]
      interval: 5s
      timeout: 5s
      retries: 10

  #  rabbitmq队列服务
  mc-rabbitmq:
    image: rabbitmq:3.8.3-management
    container_name: mc-rabbitmq
    restart: always
    hostname: mc-myRabbitmq
    ports:
      - 15672:15672
      - 5672:5672
    volumes:
      - ./data:/var/lib/rabbitmq
    environment:
      - RABBITMQ_DEFAULT_USER=developer
      - RABBITMQ_DEFAULT_PASS=hsteduteam
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    network_mode: host
    healthcheck:
      test: [ "CMD", "rabbitmq-diagnostics","-q" ,"ping" ]
      interval: 30s
      timeout: 10s
      retries: 5


  #  注册中心Nacos服务
  pig-register:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
      - MYSQL_HOST=pig-mysql
      - MYSQL_PORT=3306
      - MYSQL-USER=root
      - MYSQL-PWD=linux
    build:
      context: ./pig-register
    restart: always
    ports:
      - 8848:8848
    container_name: pig-register
    hostname: pig-register
    image: pig-register
    network_mode: host
    depends_on:
      pig-mysql:
        condition: service_healthy
      pig-redis:
        condition: service_healthy
      mc-rabbitmq:
        condition: service_healthy
    healthcheck:
      test: "/bin/netstat -anp | grep 8848"
      interval: 10s
      timeout: 10s
      retries: 10


  #  网关服务
  pig-gateway:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./pig-gateway
    restart: always
    ports:
      - 9999:9999
    container_name: pig-gateway
    hostname: pig-gateway
    image: pig-gateway
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy

  #  认证服务
  pig-auth:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./pig-auth
    restart: always
    container_name: pig-auth
    hostname: pig-auth
    image: pig-auth
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy


  #  监控服务
  pig-monitor:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./pig-visual/pig-monitor
    restart: always
    ports:
      - 5001:5001
    container_name: pig-monitor
    hostname: pig-monitor
    image: pig-monitor
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy

  #  流控服务
  pig-sentinel:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./pig-visual/pig-sentinel-dashboard
    restart: always
    image: pig-sentinel
    container_name: pig-sentinel
    ports:
      - 5003:5003
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy

  #  分布式调度中心服务
  pig-job:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
      - MYSQL_HOST=pig-mysql
      - MYSQL_PORT=3306
      - MYSQL-USER=root
      - MYSQL-PWD=linux
    build:
      context: ./pig-visual/pig-xxl-job-admin
    restart: always
    container_name: pig-job
    hostname: pig-job
    image: pig-job
    ports:
      - 5004:5004
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy
    healthcheck:
      test: "/bin/netstat -anp | grep 5004"
      interval: 30s
      timeout: 10s
      retries: 10

  #  组织用户基础服务
  pig-upms-biz:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./pig-upms/pig-upms-biz
    restart: always
    container_name: pig-upms-biz
    hostname: pig-upms-biz
    image: pig-upms-biz
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy
      pig-job:
        condition: service_healthy


  #  paas对接服务
  mc-competence-biz:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./mc-inner-conn/mc-competence/mc-competence-biz
    restart: always
    container_name: mc-competence-biz
    hostname: mc-competence-biz
    image: mc-competence-biz
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy
      pig-job:
        condition: service_healthy

  #  会议对接服务
  mc-conference-biz:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./mc-inner-conn/mc-conference/mc-conference-biz
    restart: always
    container_name: mc-conference-biz
    hostname: mc-conference-biz
    image: mc-conference-biz
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy
      pig-job:
        condition: service_healthy

  #  终端服务
  mc-terminal-biz:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./mc-inner-conn/mc-terminal/mc-terminal-biz
    restart: always
    container_name: mc-terminal-biz
    hostname: mc-terminal-biz
    image: mc-terminal-biz
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy
      pig-job:
        condition: service_healthy

  #  标签服务
  mc-label-biz:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./mc-res-center/mc-label/mc-label-biz
    restart: always
    container_name: mc-label-biz
    hostname: mc-label-biz
    image: mc-label-biz
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy
      pig-job:
        condition: service_healthy

  #  课程资源中心服务
  mc-rescenter-biz:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./mc-res-center/mc-rescenter-biz
    restart: always
    container_name: mc-rescenter-biz
    hostname: mc-rescenter-biz
    image: mc-rescenter-biz
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy
      pig-job:
        condition: service_healthy

  #  文件系统
  mc-file-biz:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./mc-file/mc-file-biz
    restart: always
    container_name: mc-file-biz
    hostname: mc-file-biz
    image: mc-file-biz
    volumes:
      - /fsmeeting/mc-file/Resource:/Resource
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy
      pig-job:
        condition: service_healthy

  #  教研服务
  mc-research-biz:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./mc-edu/mc-research/mc-research-biz
    restart: always
    container_name: mc-research-biz
    hostname: mc-research-biz
    image: mc-research-biz
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy
      pig-job:
        condition: service_healthy


  #  首页门户服务
  mc-cms-biz:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./mc-edu/mc-cms/mc-cms-biz
    restart: always
    container_name: mc-cms-biz
    hostname: mc-cms-biz
    image: mc-cms-biz
    ports:
      - 6001:6001
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy
      pig-job:
        condition: service_healthy


  #  第三方认证服务
  mc-auth-third-biz:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./mc-auth-third/mc-auth-third-biz
    restart: always
    container_name: mc-auth-third-biz
    hostname: mc-auth-third-biz
    image: mc-auth-third-biz
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy
      pig-job:
        condition: service_healthy


  #  云南1.0标准服务
  mc-yn-standard-biz:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./mc-out-tran/mc-yn-standard/mc-yn-standard-biz
    restart: always
    container_name: mc-yn-standard-biz
    hostname: mc-yn-standard-biz
    image: mc-yn-standard-biz
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy
      pig-job:
        condition: service_healthy


#  #开发者代码生成服务
#  pig-codegen:
#    environment:
#      - TZ=Asia/Shanghai
#      - LANG=C.UTF-8
#    build:
#      context: ./pig-visual/pig-codegen
#    restart: always
#    container_name: pig-codegen
#    hostname: pig-codegen
#    image: pig-codegen
#    network_mode: host

#  #ftp服务
#  mc-vsftpd:
#    image: fauria/vsftpd:latest
#    container_name: mc-vsftpd
#    hostname: mc-vsftpd
#    restart: always
#    volumes:
#      - /Resource/ftp:/home/vsftpd
#    ports:
#      - "5020:20"
#      - "5021:21"
#      - "21000-21210:21000-21210"
#    environment:
#      - FTP_USER=mc_ftp
#      - FTP_PASS=MC_ftp160422
#      - PASV_ENABLE=YES
#      - pasv_min_port=21000
#      - pasv_max_port=21210
#      - local_max_rate=200000
#      - pasv_promiscuous=YES # 此选项激活时,将关闭PASV模式的安全检查。该检查确保数据连接和控制连接是来自同一个IP地址。小心打开此选项。此选项唯一合理的用法是存在于由安全隧道方案构成的组织中。默认值为NO。
#      - LOG_STDOUT=YES # Any string to enable, empty string or not defined to disable.
#      - PASV_ADDRESS=47.106.103.68 # if you don't specify an IP address to be used in passive mode, the routed IP address of the Docker host will be used. Bear in mind that this could be a local address.
#      - PASV_ADDR_RESOLVE=NO # if you want to use a hostname (as opposed to IP address) in the PASV_ADDRESS option
#      - listen_address=192.168.0.21
#    network_mode: host
#    depends_on:
#      pig-register:
#        condition: service_healthy
#      pig-job:
#        condition: service_healthy
#
#  #维者数据同步服务
#  mc-wz-biz:
#    environment:
#      - TZ=Asia/Shanghai
#      - LANG=C.UTF-8
#    build:
#      context: ./mc-out-tran/mc-wz/mc-wz-biz
#    restart: always
#    container_name: mc-wz-biz
#    hostname: mc-wz-biz
#    image: mc-wz-biz
#    network_mode: host
#    depends_on:
#      pig-register:
#        condition: service_healthy
#      pig-job:
#        condition: service_healthy
#
#  #数据迁移模块
#  mc-data-move-biz:
#    environment:
#      - TZ=Asia/Shanghai
#      - LANG=C.UTF-8
#    build:
#      context: ./mc-out-tran/mc-data-move/mc-data-move-biz
#    restart: always
#    container_name: mc-data-move-biz
#    hostname: mc-data-move-biz
#    image: mc-data-move-biz
#    network_mode: host
#    depends_on:
#      pig-register:
#        condition: service_healthy
#      pig-job:
#        condition: service_healthy


  #  websocket互动和推送服务模块
  mc-websocket-biz:
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    build:
      context: ./mc-inner-conn/mc-websocket/mc-websocket-biz
    restart: always
    container_name: mc-websocket-biz
    hostname: mc-websocket-biz
    image: mc-websocket-biz
    network_mode: host
    depends_on:
      pig-register:
        condition: service_healthy
      pig-job:
        condition: service_healthy

这里父工程的docker文件相当于把其他子工程中有dockerfile文件打包的全部包含进来,执行更新的时候docker-compose up -d可以将每个子工程的打包的镜像全部更新。

3.db模块分析

里面放的都是数据库脚本,基础脚本以及增量脚本。
dockerfile:

FROM mysql:5.7.34
CMD [ "--max_connections=2000" ]
MAINTAINER lengleng(wangiegie@gmail.com)

#下面两句是docker服务器和宿主机时间同步操作
ENV TZ=Asia/Shanghai
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

#  缺省状态下只会将目录下的文件拷贝过去,如果连同目录一起拷贝则需要在目标中指定目录名称
COPY ./6.0.1 /docker-entrypoint-initdb.d/
COPY ./6.1.1 /docker-entrypoint-initdb.d/
COPY ./6.1.2 /docker-entrypoint-initdb.d/
COPY ./6.2.0 /docker-entrypoint-initdb.d/
COPY ./xdf /docker-entrypoint-initdb.d/

my.cnf:

[mysql]
default-character-set=utf8

[mysqld]
max_connections=2000

4.mc-auth-third模块分析

pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
		 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<parent>
		<artifactId>pig</artifactId>
		<groupId>com.pig4cloud</groupId>
		<version>3.1.1</version>
	</parent>
	<modelVersion>4.0.0</modelVersion>

	<artifactId>mc-auth-third</artifactId>
    <packaging>pom</packaging>
    <modules>
        <module>mc-auth-third-biz</module>
		<module>mc-auth-third-api</module>
	</modules>

    <properties>
		<maven.compiler.source>8</maven.compiler.source>
		<maven.compiler.target>8</maven.compiler.target>
	</properties>

</project>

在这里插入图片描述
RemoteAuthThirdService:

package com.hst.mc.third.api.feign;

import com.hst.mc.third.api.feign.factory.RemoteAuthThirdServiceFallbackFactory;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(
    contextId = "remoteAuthThirdService",
    value = ServiceNameConstants.AUTH_THIRD_SERVICE,    #指定被调用的模块名
    fallbackFactory = RemoteAuthThirdServiceFallbackFactory.class,
    path = "/oauth")
public interface RemoteAuthThirdService {

    /**
     * 获取第三方的唯一值
     */
    @GetMapping(value = "/getThirdUniqueString/{type}")
    String getThirdUniqueString(@PathVariable(value = "type") String type,
                                @RequestParam("accessCode") String accessCode,
                                @RequestHeader(SecurityConstants.FROM) String from);

}

RemoteAuthThirdServiceFallbackImpl:

package com.hst.mc.third.api.feign.fallback;

import cn.hutool.core.util.StrUtil;
import com.hst.mc.third.api.feign.RemoteAuthThirdService;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * RemoteAuthThirdServiceFallbackImpl
 */
@Slf4j
@Component
public class RemoteAuthThirdServiceFallbackImpl implements RemoteAuthThirdService {

    @Setter
    private Throwable cause;


    @Override
    public String getThirdUniqueString(String type, String accessCode, String from) {
        log.error("获取第三方唯一值失败", cause);
        return StrUtil.EMPTY;
    }
}

RemoteAuthThirdServiceFallbackFactory:

/*
 * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hst.mc.third.api.feign.factory;

import com.hst.mc.third.api.feign.RemoteAuthThirdService;
import com.hst.mc.third.api.feign.fallback.RemoteAuthThirdServiceFallbackImpl;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**熔断工厂类
 * @author Ben
 * @date 2020-07-05
 */
@Component
public class RemoteAuthThirdServiceFallbackFactory implements FallbackFactory<RemoteAuthThirdService> {

    @Override
    public RemoteAuthThirdService create(Throwable throwable) {
        RemoteAuthThirdServiceFallbackImpl remoteAuthThirdServiceFallback = new RemoteAuthThirdServiceFallbackImpl();
        remoteAuthThirdServiceFallback.setCause(throwable);
        return remoteAuthThirdServiceFallback;
    }

}

熔断工厂学习

mc-auth-third-biz是oauth2的配置相关等。

  Java知识库 最新文章
计算距离春节还有多长时间
系统开发系列 之WebService(spring框架+ma
springBoot+Cache(自定义有效时间配置)
SpringBoot整合mybatis实现增删改查、分页查
spring教程
SpringBoot+Vue实现美食交流网站的设计与实
虚拟机内存结构以及虚拟机中销毁和新建对象
SpringMVC---原理
小李同学: Java如何按多个字段分组
打印票据--java
上一篇文章      下一篇文章      查看所有文章
加:2022-03-16 22:07:36  更:2022-03-16 22:08:21 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/24 8:57:32-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码