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