distribution_config.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import os
  2. import logging
  3. import sys
  4. logging.basicConfig(level=logging.INFO,
  5. format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
  6. datefmt='%a, %d %b %Y %H:%M:%S')
  7. # alb后端服务器_调试使用组
  8. # server_group_id_list = ["sgp-ec4gopoclruofsfmxu"]
  9. # 生产环境 video-distribution-alb-ecs组
  10. server_group_id_list = ["sgp-aepczwiwxe4ncwi9p7"]
  11. # 后端服务器使用的端口
  12. port = "8080"
  13. # 修改负载均衡权限
  14. clb_client_params = {
  15. 'access_key_id': 'LTAIuPbTPL3LDDKN',
  16. 'access_key_secret': 'ORcNedKwWuwVtcq4IRFtUDZgS0b1le',
  17. 'region_id': 'cn-hangzhou'
  18. }
  19. alb_client_params = {
  20. 'access_key_id': 'LTAI5tASD5yEZLeC8ffmNebY',
  21. 'access_key_secret': '1PtsFRdp8viJmI78lEhNZR8MezWZBq',
  22. 'endpoint': 'alb.cn-hangzhou.aliyuncs.com',
  23. 'region_id': 'cn-hangzhou'
  24. }
  25. # 购买机器权限
  26. ecs_client_params = {
  27. 'access_key_id': 'LTAI4GBWbFvvXoXsSVBe1o9f',
  28. 'access_key_secret': 'kRAikWitb4kDxaAyBqNrmLmllMEDO3',
  29. 'region_id': 'cn-hangzhou'
  30. }
  31. docker_config = {
  32. 'username': 'stuuudys',
  33. 'password': 'Qingqu@2019',
  34. 'registry': 'registry-vpc.cn-hangzhou.aliyuncs.com'
  35. }
  36. # 机器配置
  37. instance_config_b = {
  38. # 使用的镜像信息
  39. 'image_id': 'm-bp15xqcuacm4zw2h2gi6',
  40. # 设置实例规格
  41. 'instance_type': 'ecs.sn1ne.xlarge',
  42. # 选择的交换机
  43. 'vswitch_id': 'vsw-bp1x47zx13vqkfrp9ugc4',
  44. # 当前VPC类型的安全组
  45. 'security_group_id': 'sg-bp1irhrkr4vfj272hk4y',
  46. # 硬盘的大小,单位:G
  47. 'disk_size': '200',
  48. # 服务器命名
  49. 'instance_name': 'video-distribution-alb-[1,2]',
  50. # 服务器所在区域
  51. 'zone_id': 'cn-hangzhou-b',
  52. # 磁盘类型:云盘
  53. 'disk_category': 'cloud_efficiency',
  54. # 密钥
  55. 'key_pair_name': 'stuuudy',
  56. # tag
  57. 'tags': [{"Key": "ecs", "Value": "distribution.prod"}]
  58. }
  59. # 服务启动脚本
  60. start_sh_dir = os.path.dirname(os.path.realpath(__file__))
  61. start_sh_filename = 'distribution_start.sh'
  62. with open(file=os.path.join(start_sh_dir, start_sh_filename), mode='r', encoding='utf-8') as rf:
  63. file_content = rf.read()
  64. start_sh = {
  65. 'target_dir': '/home/distribution_server_sh',
  66. 'name': start_sh_filename,
  67. 'content': file_content,
  68. }