Skip to content

Commit c813178

Browse files
committed
🎨源码部署脚本支持配置外部mysql和redis
1 parent cbeb4e5 commit c813178

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

scripts/base/install_db.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,10 @@ function quiet_install_mariadb() {
402402
# 交互式安装Redis #
403403
####################################
404404
function interactive_install_redis() {
405+
if [ "$USE_EXTERNAL_REDIS" == "true" ]; then
406+
LOG_INFO "Use external redis, host: $REDIS_HOST, port: $REDIS_PORT"
407+
return 0
408+
fi
405409
ret=$( check_redis )
406410
if [ "$ret" == "true" ]; then
407411
return 0
@@ -448,6 +452,10 @@ function interactive_install_mariadb() {
448452
esac
449453
fi
450454

455+
if [ "$USE_EXTERNAL_MYSQL" == "true" ]; then
456+
LOG_INFO "Use external mysql, host: $MYSQL_HOST, port: $MYSQL_PORT"
457+
return 0
458+
fi
451459
ret=$( check_mysqld )
452460
if [ "$ret" == "true" ]; then
453461
return 0

scripts/config.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#!/bin/bash
22
# -*-*-*- 需要关注的配置内容 -*-*-*-
33
# 数据库配置,默认MySQL端口号为3306
4+
export USE_EXTERNAL_MYSQL=${USE_EXTERNAL_MYSQL:-false}
45
export MYSQL_HOST=${MYSQL_HOST:-127.0.0.1}
56
export MYSQL_PORT=${MYSQL_PORT:-3306}
67
export MYSQL_USER=${MYSQL_USER:-tca}
78
export MYSQL_PASSWORD=${MYSQL_PASSWORD:-"TCA!@#2021"}
89

910
# Redis配置,默认Redis端口号为6379
11+
export USE_EXTERNAL_REDIS=${USE_EXTERNAL_REDIS:-false}
1012
export REDIS_HOST=${REDIS_HOST:-127.0.0.1}
1113
export REDIS_PORT=${REDIS_PORT:-6379}
1214
export REDIS_PASSWD=${REDIS_PASSWD:-"tca2022"}

0 commit comments

Comments
 (0)