Commit 89cfac1e by tingweiwang

服务的2-replace-file改成修改configmap模板的形式

1 parent 111ce079
#!/bin/bash
#wangtingwei
#用于autodl服务配置文件渲染
workspace=/workspace/autodl
core_nginx=http://PUBLIC_IP:30099 #30099
################################autodl配置文件##########################
config_workspace=/root/configmap/
######################autodl组件变量信息####################################
autodl_backend=http://PUBLIC_IP:30091 #30091
autodl_back_socket=ws://PUBLIC_IP:30091 #如果是域名 https此处需要为wss ,如果是ip 则改成ws
autodl_file=http://PUBLIC_IP:30093 #30093
......@@ -11,8 +9,19 @@ autodl_admin_backend=http://PUBLIC_IP:30092 # 30092
deploy_is_private=true # true代表私有部署
autodl_admin_back_socket=ws://PUBLIC_IP:30092 # 30092
custom_source= #智源项目改成zhiyuan,其他为空。
###############其他依赖服务变量信息#########################################
autodl_es=http://INTRANET_IP:9200
################seetaas组件变量信息##########################
#seetaas_frontend=http://PUBLIC_IP:30180 #30180
#seetaas_backend=http://PUBLIC_IP:30200 #30200
#seetaas_back_socket=ws://PUBLIC_IP:30200 # 30200 https对应wss
#seetaas_imageproxy=http://PUBLIC_IP:30202 #30202
#seetaas_deploy=http://PUBLIC_IP:30201 #30201
#usercenter_frontend=http://PUBLIC_IP:30302 #30302
#usercenter_backend=http://PUBLIC_IP:30300 #30300
core_nginx=http://PUBLIC_IP:30099 #30099
#visit_uc_frontend=PUBLIC_IP #user-center前端的主机ip 或域名
#mobile_frontend=http://PUBLIC_IP:30181 #30181
###############其他依赖服务变量信息#########################################
mysql_host=INTRANET_IP:3306
mysql_user=root
mysql_password=seetatech
......@@ -21,35 +30,45 @@ redis_password=seetatech
mongo_host='mongodb://admin:admin@INTRANET_IP:27017/seetaas?authSource=admin' #&号前记得加转义
harbor_host=INTRANET_IP:5000
hb_host=INTRANET_IP:5000 #如果是私有部署则共用一个私有harbor,如果是 公用部署则改成hb.seetatech.com
###############################修改后端app.yaml################################
sudo sed -i s/redis_host/$redis_host/g `find $workspace -type f -name app.yaml`
sudo sed -i s/mysql_host/$mysql_host/g `find $workspace -type f -name app.yaml`
sudo sed -i s/mysql_user/$mysql_user/g `find $workspace -type f -name app.yaml`
sudo sed -i s#mongo_host#$mongo_host#g `find $workspace -type f -name app.yaml`
sudo sed -i s/harbor_host/$harbor_host/g `find $workspace -type f -name app.yaml`
sudo sed -i s/hb_host/$hb_host/g `find $workspace -type f -name app.yaml`
sudo sed -i s/redis_password/$redis_password/g `find $workspace -type f -name app.yaml`
sudo sed -i s/mysql_password/$mysql_password/g `find $workspace -type f -name app.yaml`
###################################################################################
sudo sed -i s#core_nginx#$core_nginx#g `find $workspace -type f -name app.yaml`
###################################修改makefile###################################################
####################################公共##################################################
sudo sed -i s/redis_host/$redis_host/g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s/mysql_host/$mysql_host/g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s/mysql_user/$mysql_user/g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#mongo_host#$mongo_host#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s/harbor_host/$harbor_host/g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s/hb_host/$hb_host/g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s/redis_password/$redis_password/g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s/mysql_password/$mysql_password/g `find $config_workspace -type f -name "*.yaml"`
#####################################seetaas修改后端##############################################
#sudo sed -i s#seetaas_deploy#$seetaas_deploy#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#core_nginx#$core_nginx#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#seetaas_frontend#$seetaas_frontend#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#visit_uc_frontend#$visit_uc_frontend#g `find $config_workspace -type f -name "*.yaml"`
#############################seetaas修改前端app.yaml#######################################
#sudo sed -i s#seetaas_backend#$seetaas_backend#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#usercenter_frontend#$usercenter_frontend#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#usercenter_backend#$usercenter_backend#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#seetaas_back_socket#$seetaas_back_socket#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#seetaas_imageproxy#$seetaas_imageproxy#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#mobile_frontend#$mobile_frontend#g `find $config_workspace -type f -name "*.yaml"`
###############################autodl修改后端app.yaml#############################################
sudo sed -i s#autodl_es#$autodl_es#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#deploy_is_private#$deploy_is_private#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#autodl_backend#$autodl_backend#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#autodl_admin_backend#$autodl_admin_backend#g `find $config_workspace -type f -name "*.yaml"`
###############################autodl修改前端###########################################
sudo sed -i s#autodl_backend#$autodl_backend#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#autodl_back_socket#$autodl_back_socket#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#autodl_file#$autodl_file#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#autodl_admin_backend#$autodl_admin_backend#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#autodl_admin_back_socket#$autodl_admin_back_socket#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#custom_source#$custom_source#g `find $config_workspace -type f -name "*.yaml"`
########################################修改Makefile与########################################################
sudo sed -i s/harbor_host/$harbor_host/g `find $workspace -maxdepth 3 -type f -name Makefile`
cp ~/.docker/config.json $workspace/src/autodl-core/conf/ #用于生产环境以及私有部署autodl-core服务向镜像仓库推送镜像所添加的认证文件。
#########################################################################################################
sudo sed -i s#autodl_es#$autodl_es#g `find $workspace -type f -name app.yaml`
sudo sed -i s#deploy_is_private#$deploy_is_private#g `find $workspace -type f -name app.yaml`
sudo sed -i s#autodl_backend#$autodl_backend#g `find $workspace -type f -name app.yaml`
sudo sed -i s#autodl_admin_backend#$autodl_admin_backend#g `find $workspace -type f -name app.yaml`
#################################################################################################
sudo sed -i s#autodl_backend#$autodl_backend#g `find $workspace -type f -name production-base.js`
sudo sed -i s#autodl_back_socket#$autodl_back_socket#g `find $workspace -type f -name production-base.js`
sudo sed -i s#autodl_file#$autodl_file#g `find $workspace -type f -name production-base.js`
sudo sed -i s#autodl_admin_backend#$autodl_admin_backend#g `find $workspace -type f -name production-base.js`
sudo sed -i s#autodl_admin_back_socket#$autodl_admin_back_socket#g `find $workspace -type f -name production-base.js`
sudo sed -i s#custom_source#$custom_source#g `find $workspace -type f -name production-base.js`
#cp ~/.docker/config.json $workspace/src/seetaas-backend/conf/ #用于生产环境以及私有部署autodl-core服务向镜像仓库推送镜像所添加的认证文件。
##################################修改Dockerfile#######################################################
sed -i s#hb.seetatech.com/k8s/ubuntu-basic:16.04#$harbor_host/k8s/ubuntu-basic:16.04#g `find $workspace -maxdepth 5 -name Dockerfile -type f`
sed -i s#hb.seetatech.com/k8s/image-proxy:v0.9.0#$harbor_host/k8s/image-proxy:v0.9.0#g `find $workspace -maxdepth 5 -name Dockerfile -type f`
sed -i s#FROM\ nginx#FROM\ $harbor_host/k8s/nginx#g `find $workspace -maxdepth 5 -name Dockerfile -type f`
sed -i s#hb.seetatech.com/k8s/cuda:10.0-base-ubuntu16.04#$harbor_host/k8s/cuda:10.0-base-ubuntu16.04#g `find $workspace -maxdepth 5 -name Dockerfile -type f`
#!/bin/bash
#wangtingwei
#用于autodl服务配置文件渲染
workspace=/workspace/autodl
core_nginx=http://PUBLIC_IP:30099 #30099
################################autodl配置文件##########################
autodl_backend=http://PUBLIC_IP:30091 #30091
autodl_back_socket=ws://PUBLIC_IP:30091 #如果是域名 https此处需要为wss ,如果是ip 则改成ws
autodl_file=http://PUBLIC_IP:30093 #30093
autodl_admin_backend=http://PUBLIC_IP:30092 # 30092
deploy_is_private=true # true代表私有部署
autodl_admin_back_socket=ws://PUBLIC_IP:30092 # 30092
custom_source= #智源项目改成zhiyuan,其他为空。
###############其他依赖服务变量信息#########################################
autodl_es=http://INTRANET_IP:9200
mysql_host=INTRANET_IP:3306
mysql_user=root
mysql_password=seetatech
redis_host=INTRANET_IP:6379
redis_password=seetatech
mongo_host='mongodb://admin:admin@INTRANET_IP:27017/seetaas?authSource=admin' #&号前记得加转义
harbor_host=INTRANET_IP:5000
hb_host=INTRANET_IP:5000 #如果是私有部署则共用一个私有harbor,如果是 公用部署则改成hb.seetatech.com
###############################修改后端app.yaml################################
sudo sed -i s/redis_host/$redis_host/g `find $workspace -type f -name app.yaml`
sudo sed -i s/mysql_host/$mysql_host/g `find $workspace -type f -name app.yaml`
sudo sed -i s/mysql_user/$mysql_user/g `find $workspace -type f -name app.yaml`
sudo sed -i s#mongo_host#$mongo_host#g `find $workspace -type f -name app.yaml`
sudo sed -i s/harbor_host/$harbor_host/g `find $workspace -type f -name app.yaml`
sudo sed -i s/hb_host/$hb_host/g `find $workspace -type f -name app.yaml`
sudo sed -i s/redis_password/$redis_password/g `find $workspace -type f -name app.yaml`
sudo sed -i s/mysql_password/$mysql_password/g `find $workspace -type f -name app.yaml`
###################################################################################
sudo sed -i s#core_nginx#$core_nginx#g `find $workspace -type f -name app.yaml`
###################################修改makefile###################################################
sudo sed -i s/harbor_host/$harbor_host/g `find $workspace -maxdepth 3 -type f -name Makefile`
cp ~/.docker/config.json $workspace/src/autodl-core/conf/ #用于生产环境以及私有部署autodl-core服务向镜像仓库推送镜像所添加的认证文件。
#########################################################################################################
sudo sed -i s#autodl_es#$autodl_es#g `find $workspace -type f -name app.yaml`
sudo sed -i s#deploy_is_private#$deploy_is_private#g `find $workspace -type f -name app.yaml`
sudo sed -i s#autodl_backend#$autodl_backend#g `find $workspace -type f -name app.yaml`
sudo sed -i s#autodl_admin_backend#$autodl_admin_backend#g `find $workspace -type f -name app.yaml`
#################################################################################################
sudo sed -i s#autodl_backend#$autodl_backend#g `find $workspace -type f -name production-base.js`
sudo sed -i s#autodl_back_socket#$autodl_back_socket#g `find $workspace -type f -name production-base.js`
sudo sed -i s#autodl_file#$autodl_file#g `find $workspace -type f -name production-base.js`
sudo sed -i s#autodl_admin_backend#$autodl_admin_backend#g `find $workspace -type f -name production-base.js`
sudo sed -i s#autodl_admin_back_socket#$autodl_admin_back_socket#g `find $workspace -type f -name production-base.js`
sudo sed -i s#custom_source#$custom_source#g `find $workspace -type f -name production-base.js`
##################################修改Dockerfile#######################################################
sed -i s#hb.seetatech.com/k8s/ubuntu-basic:16.04#$harbor_host/k8s/ubuntu-basic:16.04#g `find $workspace -maxdepth 5 -name Dockerfile -type f`
sed -i s#hb.seetatech.com/k8s/image-proxy:v0.9.0#$harbor_host/k8s/image-proxy:v0.9.0#g `find $workspace -maxdepth 5 -name Dockerfile -type f`
sed -i s#FROM\ nginx#FROM\ $harbor_host/k8s/nginx#g `find $workspace -maxdepth 5 -name Dockerfile -type f`
sed -i s#hb.seetatech.com/k8s/cuda:10.0-base-ubuntu16.04#$harbor_host/k8s/cuda:10.0-base-ubuntu16.04#g `find $workspace -maxdepth 5 -name Dockerfile -type f`
......@@ -11,6 +11,7 @@ harbor_passwd=admin #写死的不能改,harbor配置文件中password写死
image_path=/root/k8s/images #写死的不能改
interface=eno1 #本机IP的物理网卡名称,用于flannel的配置。
########################################################################################
#ssh-keygen -y -f id_rsa > id_rsa.pub 私钥生成公钥
echo "开始安装ansbile"
apt update --allow-insecure-repositories
apt install nfs-common sshpass ansible -y --allow-unauthenticated
......
......@@ -10,6 +10,7 @@ sed -i s/PUBLIC_IP/$PUBLIC_IP/g seetaas/2-replace-file.sh
sed -i s/INTRANET_IP/$INTRANET_IP/g seetaas/2-replace-file.sh
}
function autodl_sed() {
sed -i s/PUBLIC_IP/$PUBLIC_IP/g autodl/2-replace-file.sh
sed -i s/INTRANET_IP/$INTRANET_IP/g autodl/2-replace-file.sh
......@@ -25,20 +26,21 @@ function autodl_recover() {
sed -i s/$PUBLIC_IP/PUBLIC_IP/g autodl/2-replace-file.sh
sed -i s/$INTRANET_IP/INTRANET_IP/g autodl/2-replace-file.sh
}
!
case $1 in
seetaas_sed)
seetaas_sed
;;
seetaas_recover)
seetaas_recover
;;
autodl_sed)
autodl_sed
;;
seetaas_recover)
seetaas_recover
;;
autodl_recover)
autodl_recover
;;
*)
echo "please input (seetaas_sed|autodl_sed|seetaas_recover|autodl_recover)"
echo "please input (seetaas_sed|seetaas_recover|autodl_recover|seetaas_recover)"
esac
#!/bin/bash
#王庭威
#用于私有部署修改seetaas业务配置文件模板
workspace=/workspace/seetaas
config_workspace=/root/configmap/
######################autodl组件变量信息####################################
#autodl_backend=http://PUBLIC_IP:30091 #30091
#autodl_back_socket=ws://PUBLIC_IP:30091 #如果是域名 https此处需要为wss ,如果是ip 则改成ws
#autodl_file=http://PUBLIC_IP:30093 #30093
#autodl_admin_backend=http://PUBLIC_IP:30092 # 30092
#deploy_is_private=true # true代表私有部署
#autodl_admin_back_socket=ws://PUBLIC_IP:30092 # 30092
#custom_source= #智源项目改成zhiyuan,其他为空。
#autodl_es=http://INTRANET_IP:9200
################seetaas组件变量信息##########################
seetaas_frontend=http://PUBLIC_IP:30180 #30180
seetaas_backend=http://PUBLIC_IP:30200 #30200
......@@ -22,37 +30,45 @@ redis_password=seetatech
mongo_host='mongodb://admin:admin@INTRANET_IP:27017/seetaas?authSource=admin' #&号前记得加转义
harbor_host=INTRANET_IP:5000
hb_host=INTRANET_IP:5000 #如果是私有部署则共用一个私有harbor,如果是 公用部署则改成hb.seetatech.com
###############################修改后端app.yaml################################
sudo sed -i s/redis_host/$redis_host/g `find $workspace -type f -name app.yaml`
sudo sed -i s/mysql_host/$mysql_host/g `find $workspace -type f -name app.yaml`
sudo sed -i s/mysql_user/$mysql_user/g `find $workspace -type f -name app.yaml`
sudo sed -i s#mongo_host#$mongo_host#g `find $workspace -type f -name app.yaml`
sudo sed -i s/harbor_host/$harbor_host/g `find $workspace -type f -name app.yaml`
sudo sed -i s/hb_host/$hb_host/g $workspace/src/seetaas-backend/conf/app.yaml
sudo sed -i s/redis_password/$redis_password/g `find $workspace -type f -name app.yaml`
sudo sed -i s/mysql_password/$mysql_password/g `find $workspace -type f -name app.yaml`
###################################################################################
sudo sed -i s#seetaas_deploy#$seetaas_deploy#g `find $workspace -type f -name app.yaml`
sudo sed -i s#core_nginx#$core_nginx#g `find $workspace -type f -name app.yaml`
sudo sed -i s#seetaas_frontend#$seetaas_frontend#g `find $workspace -type f -name app.yaml`
sudo sed -i s#visit_uc_frontend#$visit_uc_frontend#g `find $workspace -type f -name app.yaml`
###############################修改前端app.yaml#######################################
sudo sed -i s#seetaas_backend#$seetaas_backend#g `find $workspace -type f -name production-base.js`
sudo sed -i s#usercenter_frontend#$usercenter_frontend#g `find $workspace -type f -name production-base.js`
sudo sed -i s#usercenter_backend#$usercenter_backend#g `find $workspace -type f -name production-base.js`
sudo sed -i s#seetaas_back_socket#$seetaas_back_socket#g `find $workspace -type f -name production-base.js`
sudo sed -i s#seetaas_imageproxy#$seetaas_imageproxy#g `find $workspace -type f -name production-base.js`
sudo sed -i s#mobile_frontend#$mobile_frontend#g `find $workspace -type f -name production-base.js`
###################################修改makefile###################################################
####################################公共##################################################
sudo sed -i s/redis_host/$redis_host/g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s/mysql_host/$mysql_host/g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s/mysql_user/$mysql_user/g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#mongo_host#$mongo_host#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s/harbor_host/$harbor_host/g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s/hb_host/$hb_host/g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s/redis_password/$redis_password/g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s/mysql_password/$mysql_password/g `find $config_workspace -type f -name "*.yaml"`
#####################################seetaas修改后端##############################################
sudo sed -i s#seetaas_deploy#$seetaas_deploy#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#core_nginx#$core_nginx#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#seetaas_frontend#$seetaas_frontend#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#visit_uc_frontend#$visit_uc_frontend#g `find $config_workspace -type f -name "*.yaml"`
#############################seetaas修改前端app.yaml#######################################
sudo sed -i s#seetaas_backend#$seetaas_backend#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#usercenter_frontend#$usercenter_frontend#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#usercenter_backend#$usercenter_backend#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#seetaas_back_socket#$seetaas_back_socket#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#seetaas_imageproxy#$seetaas_imageproxy#g `find $config_workspace -type f -name "*.yaml"`
sudo sed -i s#mobile_frontend#$mobile_frontend#g `find $config_workspace -type f -name "*.yaml"`
###############################autodl修改后端app.yaml#############################################
#sudo sed -i s#autodl_es#$autodl_es#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#deploy_is_private#$deploy_is_private#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#autodl_backend#$autodl_backend#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#autodl_admin_backend#$autodl_admin_backend#g `find $config_workspace -type f -name "*.yaml"`
###############################autodl修改前端###########################################
#sudo sed -i s#autodl_backend#$autodl_backend#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#autodl_back_socket#$autodl_back_socket#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#autodl_file#$autodl_file#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#autodl_admin_backend#$autodl_admin_backend#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#autodl_admin_back_socket#$autodl_admin_back_socket#g `find $config_workspace -type f -name "*.yaml"`
#sudo sed -i s#custom_source#$custom_source#g `find $config_workspace -type f -name "*.yaml"`
########################################修改Makefile与########################################################
sudo sed -i s/harbor_host/$harbor_host/g `find $workspace -maxdepth 3 -type f -name Makefile`
cp ~/.docker/config.json $workspace/src/autodl-core/conf/ #用于生产环境以及私有部署autodl-core服务向镜像仓库推送镜像所添加的认证文件。
cp ~/.docker/config.json $workspace/src/seetaas-backend/conf/ #用于生产环境以及私有部署autodl-core服务向镜像仓库推送镜像所添加的认证文件。
##################################修改Dockerfile#######################################################
sed -i s#hb.seetatech.com/k8s/ubuntu-basic:16.04#$harbor_host/k8s/ubuntu-basic:16.04#g `find $workspace -maxdepth 5 -name Dockerfile -type f`
sed -i s#hb.seetatech.com/k8s/image-proxy:v0.9.0#$harbor_host/k8s/image-proxy:v0.9.0#g `find $workspace -maxdepth 5 -name Dockerfile -type f`
sed -i s#FROM\ nginx#FROM\ $harbor_host/k8s/nginx#g `find $workspace -maxdepth 5 -name Dockerfile -type f`
sed -i s#hb.seetatech.com/k8s/cuda:10.0-base-ubuntu16.04#$harbor_host/k8s/cuda:10.0-base-ubuntu16.04#g `find $workspace -maxdepth 5 -name Dockerfile -type f`
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!