Ver código fonte

update image_id

liqian 2 anos atrás
pai
commit
f220c6bc04
1 arquivos alterados com 12 adições e 9 exclusões
  1. 12 9
      rov-sever/server/ess_instance_rov_server_new.py

+ 12 - 9
rov-sever/server/ess_instance_rov_server_new.py

@@ -36,7 +36,7 @@ clt = client.AcsClient(ak_id, ak_secret, region_id)
 # 获取批量创建ECS实例的数量, 取值范围:1-100, 默认值:1
 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)
 
+# server_start
+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: