2
0

feat: deploy default config file

This commit is contained in:
zhangsz
2025-01-17 15:21:03 +08:00
parent 70e3ade791
commit fc01a6f26e
6 changed files with 32 additions and 51 deletions

View File

@@ -18,14 +18,19 @@ docker_my_conf_file=${docker_mysql_conf_d}/my.cnf
wfc_jar_images=$(docker images --format "{{.Repository}}"|grep -E "docker-wfc-|docker_wfc-")
wfc_modules_images=$(docker images --format "{{.Repository}}"|grep -E "docker-wfc-modules-|docker_wfc-modules-")
conf_dirs="${docker_work_dir}/conf
${docker_work_dir}/wfc/gateway/conf
${docker_work_dir}/wfc/auth/conf
${docker_work_dir}/wfc/modules/system/conf
${docker_work_dir}/wfc/modules/user/conf
${docker_work_dir}/wfc/modules/job/conf
${docker_work_dir}/wfc/modules/file/conf
${docker_work_dir}/wfc/modules/payment/conf"
conf_dirs=" ${docker_work_dir}/conf
${docker_work_dir}/redis/conf
${docker_work_dir}/mysql/conf.d
${docker_work_dir}/nacos/conf
${docker_work_dir}/nginx/conf
${docker_work_dir}/wfc/gateway/conf
${docker_work_dir}/wfc/auth/conf
${docker_work_dir}/wfc/modules/system/conf
${docker_work_dir}/wfc/modules/user/conf
${docker_work_dir}/wfc/modules/job/conf
${docker_work_dir}/wfc/modules/file/conf
${docker_work_dir}/wfc/modules/payment/conf
"
case "$1" in
env)
@@ -35,14 +40,6 @@ case "$1" in
if [ ! -d ${redis_work_dir}/data ]; then
mkdir -p ${redis_work_dir}/data
fi
if [ -d ${docker_work_dir}/mysql/data ]; then
chown -R 999:999 ${docker_work_dir}/mysql/data
fi
find ${docker_work_dir} -type d -exec chmod 775 {} \;
find ${docker_work_dir} -type f -exec chmod 664 {} \;
chown root:root ${docker_work_dir}/mysql/conf.d/my.cnf
chmod 600 ${docker_work_dir}/mysql/conf.d/my.cnf
chmod 1777 ${docker_work_dir}/mysql/tmp
# setup system serivce
cp -rf ${src_service_dir}/wfccontrol.service ${dst_service_dir}/
@@ -98,12 +95,30 @@ case "$1" in
# nginx定义原始文件和临时文件
org_nginx_conf=${docker_work_dir}/nginx/conf/nginx.conf
tmp_intermediate_conf=${docker_work_dir}/nginx/conf/tmp_intermediate.conf
tmp_nginx_conf=${docker_work_dir}/nginx/conf/tmp_nginx.conf
# 使用sed命令替换proxy_pass行中的IP地址
sed "s|proxy_pass http://.*/;|proxy_pass http://${GATEWAY_SERVER_IP}:${GATEWAY_SERVER_PORT}/;|" $org_nginx_conf > $tmp_nginx_conf
# Define intermediate temporary nginx configuration file
# Replace the proxy_pass line with the correct GATEWAY_SERVER_IP and GATEWAY_SERVER_PORT
sed "s|proxy_pass http://.*:8080/;|proxy_pass http://${GATEWAY_SERVER_IP}:${GATEWAY_SERVER_PORT}/;|" $org_nginx_conf > $tmp_intermediate_conf
# Replace the IP address and port for the file server in the nginx configuration
sed "s|proxy_pass http://.*:9201/;|proxy_pass http://${GATEWAY_SERVER_IP}:${WFC_FILE_PORT}/;|" $tmp_intermediate_conf > $tmp_nginx_conf
# Remove the intermediate temporary file and move the final configuration
rm $tmp_intermediate_conf
mv $tmp_nginx_conf $org_nginx_conf
# chown and chmod for all docker work directory
if [ -d ${docker_work_dir}/mysql/data ]; then
chown -R 999:999 ${docker_work_dir}/mysql/data
fi
find ${docker_work_dir} -type d -exec chmod 775 {} \;
find ${docker_work_dir} -type f -exec chmod 664 {} \;
chown root:root ${docker_work_dir}/mysql/conf.d/my.cnf
chmod 600 ${docker_work_dir}/mysql/conf.d/my.cnf
chmod 1777 ${docker_work_dir}/mysql/tmp
;;
initdb)
# init database

View File

@@ -1,34 +0,0 @@
spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://wfc-mysql:3306/wfc_config_db?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=root
db.password=123456
nacos.naming.empty-service.auto-clean=true
nacos.naming.empty-service.clean.initial-delay-ms=50000
nacos.naming.empty-service.clean.period-time-ms=30000
# nacos.server.ip=${NACOS_SERVER_IP}
# nacos.server.port=${NACOS_SERVER_PORT}
management.endpoints.web.exposure.include=*
management.metrics.export.elastic.enabled=false
management.metrics.export.influx.enabled=false
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
server.tomcat.basedir=/home/wfc/nacos/tomcat/logs
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
nacos.core.auth.system.type=nacos
nacos.core.auth.enabled=false
nacos.core.auth.default.token.expire.seconds=18000
nacos.core.auth.default.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
nacos.core.auth.caching.enabled=true
nacos.core.auth.enable.userAgentAuthWhite=false
nacos.core.auth.server.identity.key=serverIdentity
nacos.core.auth.server.identity.value=security
nacos.istio.mcp.server.enabled=false