Compare commits

...

8 Commits
test ... master

Author SHA1 Message Date
bob 8598f1de17 feat(env) add test prod
continuous-integration/drone/push Build is passing Details
2 years ago
bob 6a2c22c7a3 feat(doc) mysql backup
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is failing Details
2 years ago
bob b8f305e0b7 feat(cd) drone pipeline add event test
continuous-integration/drone/pr Build is failing Details
continuous-integration/drone/push Build is passing Details
2 years ago
bob 8e63d6fc69 feat(cd) drone pipeline add event
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2 years ago
bob ae3a54062e feat(cd) drone pipeline add event
continuous-integration/drone/pr Build was killed Details
continuous-integration/drone/push Build was killed Details
2 years ago
bob 29fe333fa6 feat(cd) drone pipeline add event
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2 years ago
bob e16475d629 feat(cd) drone pipeline add event
continuous-integration/drone/pr Build is passing Details
2 years ago
bob 32bedd1bfd feat(cd) change Dockerfile
continuous-integration/drone/pr Build is passing Details
2 years ago

@ -12,7 +12,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
- name: maven-build - name: maven-build
path: /app/build # 将应用打包好的Jar和执行脚本挂载出来 path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
commands: # 定义在Docker容器中执行的shell命令 commands: # 定义在Docker容器中执行的shell命令
- mvn -T 8 clean package -Dmaven.test.skip=true -pl ruoyi-admin -am # 应用打包命令 - mvn clean package -Dmaven.test.skip=true -pl ruoyi-admin -am # 应用打包命令
- cp ruoyi-admin/target/*.jar /app/build/ - cp ruoyi-admin/target/*.jar /app/build/
- cp ruoyi-admin/Dockerfile /app/build/Dockerfile - cp ruoyi-admin/Dockerfile /app/build/Dockerfile
- cp run.sh /app/build/run.sh - cp run.sh /app/build/run.sh
@ -38,7 +38,8 @@ volumes: # 定义流水线挂载目录,用于共享数据
- name: maven-cache - name: maven-cache
host: host:
path: /app/maven/cache path: /app/maven/cache
# drone执行触发器 when:
trigger:
branch: branch:
- test - test
event:
- pull_request

@ -0,0 +1,45 @@
### 备份
以下命令用于将容器内的 mysql 的特定数据库备份到 sql 文件:
```sh
# 进入 mysql 容器(宿主机执行)
docker exec -it mysql bash
# 执行备份, 此命令演示中仅备份 iot 数据库(容器内执行)
mysqldump -u root -p -h 127.0.0.1 oa_system > /tmp/oa_system.sql
mysqldump -u root -p -h 127.0.0.1 crm_single > /tmp/crm_single.sql
mysqldump -u root -p -h 127.0.0.1 hrm_single > /tmp/hrm_single.sql
mysqldump -u root -p -h 127.0.0.1 nacos > /tmp/nacos.sql
mysqldump -u root -p -h 127.0.0.1 teamwork > /tmp/teamwork.sql
# 将备份文件复制到宿主机(宿主机执行)
docker cp mysql:/tmp/oa_system.sql ./oa_system.sql
# 打包备份文件,压缩存储对于文本文件可以节省大量空间(宿主机执行)
tar -zcvf oa_system.sql.tzr.gz oa_system.sql
```
### 恢复
以下命名将备份的 sql 文件恢复到容器内的 mysql 数据库中:
```sh
# 解压备份文件, 解压后生成 iot.sql(宿主机执行)
tar -zxvf oa_system.sql.tar.gz
# 将备份文件复制到容器内(宿主机执行)
docker cp oa_system.sql mysql:/tmp/iot.sql
# 进入 mysql 容器(宿主机执行)
docker exec -it mysql bash
# 执行恢复(容器内执行)
mysql -u root -p oa_system < oa_system.sql
```
**全新的数据库在恢复之前需要先创建该数据库,然后再进行恢复:**
```sql
create database iot default character set utf8mb4 collate utf8mb4_unicode_ci;
```

@ -6,6 +6,6 @@ ARG SPRING_PROFILE
ENV JAVA_OPTS "${JAVA_OPTS} ${CUSTOM_OPTS}" ENV JAVA_OPTS "${JAVA_OPTS} ${CUSTOM_OPTS}"
COPY target/*.jar /javarun COPY *.jar /javarun
CMD ["bash","-c","java ${JAVA_OPTS} -Dspring.profiles.active=${SPRING_PROFILE} -jar /javarun/*.jar"] CMD ["bash","-c","java ${JAVA_OPTS} -Dspring.profiles.active=${SPRING_PROFILE} -jar /javarun/*.jar"]

@ -17,7 +17,7 @@ public class RuoYiApplication
public static void main(String[] args) public static void main(String[] args)
{ {
// System.setProperty("spring.devtools.restart.enabled", "false"); // System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args);
log.info("=========================cd auto deploy success========="); log.info("=========================cd auto deploy success=========");
SpringApplication.run(RuoYiApplication.class, args);
} }
} }

@ -0,0 +1,81 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
# driverClassName: com.p6spy.engine.spy.P6SpyDriver
druid:
# 主库数据源
master:
url: jdbc:mysql://mysql:3306/oa_system?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2b8&allowPublicKeyRetrieval=true
username: root
password: Ldu@9ZZieMVjBj8G
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: admin
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# redis 配置
redis:
# 地址
host: redis
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password: v5rNC30HQTjeGpA4jCZc
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms

@ -56,3 +56,26 @@ spring:
wall: wall:
config: config:
multi-statement-allow: true multi-statement-allow: true
# redis 配置
redis:
# 地址
host: 49.232.170.154
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password: v5rNC30HQTjeGpA4jCZc
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms

@ -43,7 +43,7 @@ spring:
# 国际化资源文件路径 # 国际化资源文件路径
basename: i18n/messages basename: i18n/messages
profiles: profiles:
active: druid active: test
# 文件上传 # 文件上传
servlet: servlet:
multipart: multipart:
@ -56,29 +56,6 @@ spring:
restart: restart:
# 热部署开关 # 热部署开关
enabled: true enabled: true
# redis 配置
redis:
# 地址
host: 49.232.170.154
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password: v5rNC30HQTjeGpA4jCZc
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# token配置 # token配置
token: token:
# 令牌自定义标识 # 令牌自定义标识

Loading…
Cancel
Save