1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

后端微服务配置上线

This commit is contained in:
程序员小墨 2023-04-18 03:48:38 +08:00
parent c77a4c98fc
commit cb1b0e4e7e
31 changed files with 188 additions and 24 deletions

View File

@ -330,6 +330,16 @@ window.wsUrl = 'ws://127.0.0.1:80/access/websocket/1';
##### 打 jar 包
IDEA 中右侧 Maven 双击 Lifestyle 的 package打包完成后的 jar 包可在以下位置找到
- backend/microservice-gateway/target/microservice-gateway-0.0.1-SNAPSHOT.jar
- backend/microservice-provider-user-8001/target/microservice-provider-user-8001-0.0.1-SNAPSHOT.jar
- backend/microservice-provider-access-8002/target/microservice-provider-access-8002-0.0.1-SNAPSHOT.jar
- backend/microservice-provider-shop-8003/target/microservice-provider-shop-8003-0.0.1-SNAPSHOT.jar
#### nginx 代理配置(可选) #### nginx 代理配置(可选)
配置文件在 `nginx-conf` 目录下(不能直接拿来用,需要根据自己的实际情况来改) 配置文件在 `nginx-conf` 目录下(不能直接拿来用,需要根据自己的实际情况来改)

View File

@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="AccessProvider-Remote" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> <configuration default="false" name="Dev-AccessProvider" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<envs> <envs>
<env name="--spring.profiles.active" value="remote" /> <env name="-spring.profiles.active" value="develop" />
</envs> </envs>
<module name="microservice-provider-access-8002" /> <module name="microservice-provider-access-8002" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.access.AccessProvider" /> <option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.access.AccessProvider" />

View File

@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Gateway-Remote" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> <configuration default="false" name="Dev-Gateway" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<envs> <envs>
<env name="--spring.profiles.active" value="remote" /> <env name="--spring.profiles.active" value="develop" />
</envs> </envs>
<module name="microservice-gateway" /> <module name="microservice-gateway" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.gateway.Gateway" /> <option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.gateway.Gateway" />

View File

@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="ShopProvider-Remote" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> <configuration default="false" name="Dev-ShopProvider" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<envs> <envs>
<env name="--spring.profiles.active" value="remote" /> <env name="--spring.profiles.active" value="develop" />
</envs> </envs>
<module name="microservice-provider-shop-8003" /> <module name="microservice-provider-shop-8003" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.shop.ShopProvider" /> <option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.shop.ShopProvider" />

View File

@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="TestProvider-Remote" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> <configuration default="false" name="Dev-TestProvider" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<envs> <envs>
<env name="--spring.profiles.active" value="remote" /> <env name="--spring.profiles.active" value="develop" />
</envs> </envs>
<module name="microservice-provider-test-8011" /> <module name="microservice-provider-test-8011" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.test.TestProvider" /> <option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.test.TestProvider" />

View File

@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="UserProvider-Remote" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> <configuration default="false" name="Dev-UserProvider" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<envs> <envs>
<env name="--spring.profiles.active" value="remote" /> <env name="--spring.profiles.active" value="develop" />
</envs> </envs>
<module name="microservice-provider-user-8001" /> <module name="microservice-provider-user-8001" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.user.UserProvider" /> <option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.user.UserProvider" />

View File

@ -1,5 +1,8 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="AccessProvider" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> <configuration default="false" name="Prod-AccessProvider" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<envs>
<env name="--spring.profiles.active" value="production" />
</envs>
<module name="microservice-provider-access-8002" /> <module name="microservice-provider-access-8002" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.access.AccessProvider" /> <option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.access.AccessProvider" />
<option name="VM_PARAMETERS" value="-Xms64m -Xmx256m" /> <option name="VM_PARAMETERS" value="-Xms64m -Xmx256m" />

View File

@ -1,5 +1,8 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Gateway" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true"> <configuration default="false" name="Prod-Gateway" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<envs>
<env name="--spring.profiles.active" value="production" />
</envs>
<module name="microservice-gateway" /> <module name="microservice-gateway" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.gateway.Gateway" /> <option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.gateway.Gateway" />
<option name="VM_PARAMETERS" value="-Xms64m -Xmx256m" /> <option name="VM_PARAMETERS" value="-Xms64m -Xmx256m" />

View File

@ -1,5 +1,8 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="ShopProvider" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true"> <configuration default="false" name="Prod-ShopProvider" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<envs>
<env name="--spring.profiles.active" value="production" />
</envs>
<module name="microservice-provider-shop-8003" /> <module name="microservice-provider-shop-8003" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.shop.ShopProvider" /> <option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.shop.ShopProvider" />
<option name="VM_PARAMETERS" value="-Xms64m -Xmx256m" /> <option name="VM_PARAMETERS" value="-Xms64m -Xmx256m" />

View File

@ -1,5 +1,8 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="TestProvider" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true"> <configuration default="false" name="Prod-TestProvider" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<envs>
<env name="-spring.profiles.active" value="production" />
</envs>
<module name="microservice-provider-test-8011" /> <module name="microservice-provider-test-8011" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.test.TestProvider" /> <option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.test.TestProvider" />
<option name="VM_PARAMETERS" value="-Xms64m -Xmx256m" /> <option name="VM_PARAMETERS" value="-Xms64m -Xmx256m" />

View File

@ -0,0 +1,19 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Prod-UserProvider " type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<envs>
<env name="--spring.profiles.active" value="production" />
</envs>
<module name="microservice-provider-user-8001" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.user.UserProvider" />
<option name="VM_PARAMETERS" value="-Xms64m -Xmx256m" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.cxyxiaomo.epp.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -1,10 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="UserProvider" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<module name="microservice-provider-user-8001" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.user.UserProvider" />
<option name="VM_PARAMETERS" value="-Xms64m -Xmx256m" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -64,4 +64,33 @@
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.7.5</version>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
<!--
解决项目打包后运行如下报错
no main manifest attribute, in /xxxx/xxxx-0.0.1-SNAPSHOT.jar
refer: https://www.baeldung.com/spring-boot-fix-the-no-main-manifest-attribute
-->
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -3,3 +3,4 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: 106.75.217.14:8488 server-addr: 106.75.217.14:8488
namespace: develop

View File

@ -0,0 +1,6 @@
spring:
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8488
namespace: production

View File

@ -9,6 +9,7 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
namespace: public
gateway: gateway:
discovery: discovery:
locator: locator:

View File

@ -126,6 +126,18 @@
</exclude> </exclude>
</excludes> </excludes>
</configuration> </configuration>
<!--
解决项目打包后运行如下报错
no main manifest attribute, in /xxxx/xxxx-0.0.1-SNAPSHOT.jar
refer: https://www.baeldung.com/spring-boot-fix-the-no-main-manifest-attribute
-->
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -7,3 +7,4 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: 106.75.217.14:8488 server-addr: 106.75.217.14:8488
namespace: develop

View File

@ -0,0 +1,10 @@
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/epp?useUnicode=true&characterEncoding=utf8&useSSL=false
username: epp
password: NJ4ED7LKGJy4fBc5
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8488
namespace: production

View File

@ -15,6 +15,7 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
namespace: public
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver

View File

@ -118,6 +118,34 @@
</dependencies> </dependencies>
<build> <build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.7.5</version>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
<!--
解决项目打包后运行如下报错
no main manifest attribute, in /xxxx/xxxx-0.0.1-SNAPSHOT.jar
refer: https://www.baeldung.com/spring-boot-fix-the-no-main-manifest-attribute
-->
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins> <plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->

View File

@ -7,3 +7,4 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: 106.75.217.14:8488 server-addr: 106.75.217.14:8488
namespace: develop

View File

@ -0,0 +1,10 @@
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/epp?useUnicode=true&characterEncoding=utf8&useSSL=false
username: epp
password: NJ4ED7LKGJy4fBc5
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8488
namespace: production

View File

@ -15,6 +15,7 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
namespace: public
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver

View File

@ -3,3 +3,4 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: 106.75.217.14:8488 server-addr: 106.75.217.14:8488
namespace: develop

View File

@ -0,0 +1,6 @@
spring:
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8488
namespace: production

View File

@ -9,3 +9,4 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
namespace: public

View File

@ -131,6 +131,18 @@
</exclude> </exclude>
</excludes> </excludes>
</configuration> </configuration>
<!--
解决项目打包后运行如下报错
no main manifest attribute, in /xxxx/xxxx-0.0.1-SNAPSHOT.jar
refer: https://www.baeldung.com/spring-boot-fix-the-no-main-manifest-attribute
-->
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -7,3 +7,4 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: 106.75.217.14:8488 server-addr: 106.75.217.14:8488
namespace: develop

View File

@ -0,0 +1,10 @@
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/epp?useUnicode=true&characterEncoding=utf8&useSSL=false
username: epp
password: NJ4ED7LKGJy4fBc5
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8488
namespace: production

View File

@ -15,6 +15,7 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
namespace: public
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver