决定使用微服务架构,采用spring cloud alibaba 组件来管理
父子模块
maven多模块的子模块单独install失败
1、需要把parent工程,也就是package是pom的那个工程先install一下;之后再install公共引入的模块,最后就可以单独编译子模块。
2、不用install,直接编译parent项目;这种方式只能在parent项目下进行,不能单独编译子模块。
maven子模块单独打包
<build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.*</include> </includes> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.*</include> </includes> </resource> </resources> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <!-- 指定程序的主类 --> <configuration> <mainClass>com.croot.portal.PortalServerApplication</mainClass> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
版本选择
springboot选择
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.5.RELEASE</version> <relativePath></relativePath> </parent>
<spring-cloud-alibaba.version>2.2.3.RELEASE</spring-cloud-alibaba.version> <spring-cloud.version>Hoxton.SR9</spring-cloud.version>
docker安装nacos
docker pull nacos/nacos-server:2.0.1
mkdir -p /opt/nacos/init.d mkdir -p /opt/nacos/logs cd /opt/nacos/init.d touch custom.properties
docker run -d -p 8848:8848 -e MODE=standalone \ -v /opt/nacos/init.d/custom.properties:/home/nacos/init.d/custom.properties \ -v /opt/nacos/logs:/home/nacos/logs \ --restart always \ --name my-nacos nacos/nacos-server:2.0.1
docker安装gitLab
# gitlab-ce为稳定版本,后面不填写版本则默认pull最新latest版本 $ docker pull gitlab/gitlab-ce
启动
docker run -d -p 443:443 -p 80:80 -p 222:22 --name gitlab --restart always -v /home/gitlab/config:/etc/gitlab -v /home/gitlab/logs:/var/log/gitlab -v /home/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce