12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- import os
- import logging
- import sys
- 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"]
- # commonapi clb 生产环境
- clb_id_list = ["lb-bp1xmaogphakz0l1o13mu"]
- # 后端服务器使用的端口
- port = "8182"
- # 修改负载均衡权限
- 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.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'
- }
- # 机器配置
- instance_config_h = {
- # 使用的镜像信息
- 'image_id': 'm-bp15xqcuacm4zw2h2gi6',
- # 设置实例规格
- 'instance_type': 'ecs.c6.xlarge',
- # 选择的交换机
- 'vswitch_id': 'vsw-bp19lpjwtc6j0p0m9mdc2',
- # 当前VPC类型的安全组
- 'security_group_id': 'sg-bp1irhrkr4vfj272hk4y',
- # 硬盘的大小,单位:G
- 'disk_size': '200',
- # 服务器命名
- 'instance_name': 'commonapi-[1,2]',
- # 服务器所在区域
- 'zone_id': 'cn-hangzhou-h',
- # 磁盘类型:云盘
- 'disk_category': 'cloud_efficiency',
- # 密钥
- 'key_pair_name': 'stuuudy',
- # tag
- 'tags': [{"Key": "ecs", "Value": "commonapi.prod"}]
- }
- # 服务启动脚本
- start_sh_dir = os.path.dirname(os.path.realpath(__file__))
- start_sh_filename = 'commonapi_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()
- start_sh = {
- 'target_dir': '/home/commonapi_server_sh',
- 'name': start_sh_filename,
- 'content': file_content,
- }
|