commonapi_config.py 2.2 KB

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