rov_server_config.py 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import os
  2. import logging
  3. logging.basicConfig(level=logging.INFO,
  4. format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
  5. datefmt='%a, %d %b %Y %H:%M:%S')
  6. slb_id = 'lb-bp1werfophtsjzfr76njm'
  7. # 修改负载均衡权限
  8. slb_client_params = {
  9. 'access_key_id': 'LTAIuPbTPL3LDDKN',
  10. 'access_key_secret': 'ORcNedKwWuwVtcq4IRFtUDZgS0b1le',
  11. 'region_id': 'cn-hangzhou'
  12. }
  13. # 购买机器权限
  14. create_client_params = {
  15. 'access_key_id': 'LTAI4GBWbFvvXoXsSVBe1o9f',
  16. 'access_key_secret': 'kRAikWitb4kDxaAyBqNrmLmllMEDO3',
  17. 'region_id': 'cn-hangzhou'
  18. }
  19. # 机器配置
  20. instance_config = {
  21. # 使用的镜像信息
  22. 'image_id': 'm-bp1e5jx8eqhq22l91xw7',
  23. # 设置实例规格
  24. 'instance_type': 'ecs.ic5.xlarge',
  25. # 选择的交换机
  26. 'vswitch_id': 'vsw-bp19lpjwtc6j0p0m9mdc2',
  27. # 当前VPC类型的安全组
  28. 'security_group_id': 'sg-bp1irhrkr4vfj272hk4y',
  29. # 硬盘的大小,单位:G
  30. 'disk_size': '200',
  31. # 服务器命名
  32. 'instance_name': 'ESS-rov-server-[1,2]',
  33. # 服务器所在区域
  34. 'zone_id': 'cn-hangzhou-h',
  35. # 磁盘类型:云盘
  36. 'disk_category': 'cloud_efficiency',
  37. # 密钥
  38. 'key_pair_name': 'stuuudy',
  39. # tag
  40. 'tags': [{"Key": "ecs", "Value": "rov-server.prod"}]
  41. }
  42. # 机器配置 hangzhou-i
  43. instance_config_i = {
  44. # 使用的镜像信息
  45. 'image_id': 'm-bp1e5jx8eqhq22l91xw7',
  46. # 设置实例规格
  47. 'instance_type': 'ecs.ic5.xlarge',
  48. # 选择的交换机
  49. 'vswitch_id': 'vsw-bp17c002ovyomzwnhhdhj',
  50. # 当前VPC类型的安全组
  51. 'security_group_id': 'sg-bp1irhrkr4vfj272hk4y',
  52. # 硬盘的大小,单位:G
  53. 'disk_size': '200',
  54. # 服务器命名
  55. 'instance_name': 'ESS-rov-server-[1,2]',
  56. # 服务器所在区域
  57. 'zone_id': 'cn-hangzhou-i',
  58. # 磁盘类型:云盘
  59. 'disk_category': 'cloud_efficiency',
  60. # 密钥
  61. 'key_pair_name': 'stuuudy',
  62. # tag
  63. 'tags': [{"Key": "ecs", "Value": "rov-server.prod"}]
  64. }
  65. # 服务启动脚本
  66. start_sh_dir = os.path.dirname(os.path.realpath(__file__))
  67. start_sh_filename = 'rov_server_start.sh'
  68. with open(file=os.path.join(start_sh_dir, start_sh_filename), mode='r', encoding='utf-8') as rf:
  69. file_content = rf.read()
  70. logging.info(f"start sh file content: {file_content}")
  71. start_sh = {
  72. 'target_dir': '/home/piaoquan_server_sh',
  73. 'name': start_sh_filename,
  74. 'content': file_content,
  75. }