import os import logging logging.basicConfig(level=logging.INFO, format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s', datefmt='%a, %d %b %Y %H:%M:%S') # alb后端服务器_调试使用组 # server_group_id_list = ["sgp-ec4gopoclruofsfmxu"] # clb 测试环境_临时调试使用 # clb_id_list = ["lb-bp1i49h7ncw2c9nl3kp6u"] # gateway-alb-ecs组-生产环境 server_group_id_list = ["sgp-l2k0p33e470vfmj538"] # gateway clb 生产环境 clb_id_list = ["lb-bp1mfk1gmd47twfh6bgwv", "lb-bp1jtzhp9krunyv3mim2q"] apps = 'piaoquan-gateway' repository = 'registry-vpc.cn-hangzhou.aliyuncs.com/stuuudy/{}' registry = 'registry-vpc.cn-hangzhou.aliyuncs.com/stuuudy/{}:{}' # 后端服务器使用的端口 port = "9000" # 修改负载均衡权限 clb_client_params = { 'access_key_id': 'LTAIuPbTPL3LDDKN', 'access_key_secret': 'ORcNedKwWuwVtcq4IRFtUDZgS0b1le', 'region_id': 'cn-hangzhou' } alb_client_params = { 'access_key_id': 'LTAI5tASD5yEZLeC8ffmNebY', 'access_key_secret': '1PtsFRdp8viJmI78lEhNZR8MezWZBq', 'endpoint': 'alb-vpc.cn-hangzhou.aliyuncs.com', 'region_id': 'cn-hangzhou' } # 购买机器权限 ecs_client_params = { 'access_key_id': 'LTAI4GBWbFvvXoXsSVBe1o9f', 'access_key_secret': 'kRAikWitb4kDxaAyBqNrmLmllMEDO3', 'region_id': 'cn-hangzhou' } docker_config = { 'username': 'stuuudys', 'password': 'Qingqu@2019', 'registry': 'registry-vpc.cn-hangzhou.aliyuncs.com' } # 机器配置_hangzhou_j instance_config_j = { # 使用的镜像信息 'image_id': 'm-bp1e7t7odil9c8kqsm10', # 设置实例规格 'instance_type': 'ecs.c6.xlarge', # 选择的交换机 'vswitch_id': 'vsw-bp1ssuwxyrt0p17ceeir0', # 当前VPC类型的安全组 'security_group_id': 'sg-bp1irhrkr4vfj272hk4y', # 硬盘的大小,单位:G 'disk_size': '200', # 服务器命名 'instance_name': 'ESS-gateway-[1,2]', # 服务器所在区域 'zone_id': 'cn-hangzhou-j', # 磁盘类型:云盘 'disk_category': 'cloud_essd', # 密钥 'key_pair_name': 'stuuudy', # tag 'tags': [{"Key": "ecs", "Value": "gateway.prod"}] } # 服务启动脚本 start_sh_dir = os.path.dirname(os.path.realpath(__file__)) start_sh_filename = 'gateway_start.sh' with open(file=os.path.join(start_sh_dir, start_sh_filename), mode='r', encoding='utf-8') as rf: file_content = rf.read() # logging.info(f"start sh file content: {file_content}") start_sh = { 'target_dir': '/home/gateway_server_sh', 'name': start_sh_filename, 'content': file_content, }