|
@@ -0,0 +1,82 @@
|
|
|
+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')
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+server_group_id_list = ["sgp-ec4gopoclruofsfmxu"]
|
|
|
+
|
|
|
+
|
|
|
+clb_id_list = ["lb-bp1i49h7ncw2c9nl3kp6u"]
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+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',
|
|
|
+
|
|
|
+ 'security_group_id': ['sg-bp1irhrkr4vfj272hk4y'],
|
|
|
+
|
|
|
+ 'disk_size': ['200'],
|
|
|
+
|
|
|
+ 'instance_name': 'commonapi-[1,2]',
|
|
|
+
|
|
|
+ 'zone_id': 'cn-hangzhou-h',
|
|
|
+
|
|
|
+ 'disk_category': 'cloud_efficiency',
|
|
|
+
|
|
|
+ 'key_pair_name': 'stuuudy',
|
|
|
+
|
|
|
+ '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,
|
|
|
+}
|