|
@@ -36,7 +36,7 @@ clt = client.AcsClient(ak_id, ak_secret, region_id)
|
|
|
|
|
|
amount = int(sys.argv[1])
|
|
|
|
|
|
-image_id = "m-bp1dnxi0r8zn5s0gpuwm"
|
|
|
+image_id = "m-bp1e5jx8eqhq22l91xw7"
|
|
|
|
|
|
|
|
|
instance_type = "ecs.ic5.large"
|
|
@@ -63,6 +63,14 @@ AccessSecret = 'ORcNedKwWuwVtcq4IRFtUDZgS0b1le'
|
|
|
RegionId = 'cn-hangzhou'
|
|
|
client = AcsClient(AccessKey, AccessSecret, RegionId)
|
|
|
|
|
|
+
|
|
|
+start_target_dir = '/home/sh'
|
|
|
+start_name = 'rov_server_start_new.sh'
|
|
|
+start_content = """#!/bin/bash
|
|
|
+docker login --username=stuuudys --password=Qingqu@2019 registry.piaoquantv.com
|
|
|
+docker run -d -it --network=host --name=rov-server registry.piaoquantv.com/piaoquan/rov-server:latest
|
|
|
+"""
|
|
|
+
|
|
|
|
|
|
def build_request():
|
|
|
"""购买服务器参数配置"""
|
|
@@ -195,13 +203,7 @@ def getIpaddr(instance_id):
|
|
|
return ipaddr
|
|
|
|
|
|
|
|
|
-def send_file_to_ecs(instance_id_list):
|
|
|
- content = """#!/bin/bash
|
|
|
-docker login --username=stuuudys --password=Qingqu@2019 registry.piaoquantv.com
|
|
|
-docker run -d -it --network=host --name=rov-server registry.piaoquantv.com/piaoquan/rov-server:latest
|
|
|
-"""
|
|
|
- target_dir = '/home/sh'
|
|
|
- name = 'rov_server_start_new.sh'
|
|
|
+def send_file_to_ecs(instance_id_list, target_dir, name, content):
|
|
|
request = SendFileRequest()
|
|
|
request.set_Content(content)
|
|
|
request.set_TargetDir(target_dir)
|
|
@@ -222,7 +224,8 @@ def _execute_request(request):
|
|
|
|
|
|
logging.info(f"{instance_ids} is running")
|
|
|
time.sleep(60)
|
|
|
- send_file_to_ecs(instance_id_list=instance_ids)
|
|
|
+ send_file_to_ecs(instance_id_list=instance_ids,
|
|
|
+ target_dir=start_target_dir, name=start_name, content=start_content)
|
|
|
runCommand(instance_ids)
|
|
|
|
|
|
for instance_id in instance_ids:
|