distribution_config.py 2.1 KB

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