compose.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. from ..core.module import Module
  2. from ..core.registry import registry
  3. class ComposeModule(Module):
  4. """Docker Compose module."""
  5. name = "compose"
  6. description = "Manage Docker Compose configurations"
  7. files = ["docker-compose.yml", "compose.yml", "compose.yaml"]
  8. # Category metadata
  9. categories = {
  10. "general": {
  11. "icon": "󰖷 ",
  12. "description": "General container settings"
  13. },
  14. "network": {
  15. "icon": "󰈀 ",
  16. "description": "Network configuration",
  17. "tip": "Use external networks for cross-container communication"
  18. },
  19. "traefik": {
  20. "icon": " ",
  21. "description": "Reverse proxy and load balancer",
  22. "tip": "Automatic SSL certificates with Let's Encrypt"
  23. },
  24. "swarm": {
  25. "icon": " ",
  26. "description": "Docker Swarm orchestration"
  27. }
  28. }
  29. # Variable metadata
  30. variable_metadata = {
  31. "service_name": {
  32. "hint": "e.g., webapp, api, database",
  33. "validation": "^[a-z][a-z0-9-]*$"
  34. },
  35. "container_name": {
  36. "hint": "Leave empty to use service name",
  37. "description": "Custom container name"
  38. },
  39. "network": {
  40. "description": "Enable custom network configuration"
  41. },
  42. "network.name": {
  43. "hint": "e.g., frontend, backend, bridge",
  44. "description": "Docker network name"
  45. },
  46. "network.external": {
  47. "hint": "Use 'true' for existing networks",
  48. "tip": "External networks must be created before running"
  49. },
  50. "traefik": {
  51. "description": "Enable Traefik reverse proxy",
  52. "tip": "Requires Traefik to be running separately"
  53. },
  54. "traefik.host": {
  55. "hint": "e.g., app.example.com, api.mydomain.org",
  56. "description": "Domain name for your service",
  57. "validation": "^[a-z0-9][a-z0-9.-]*[a-z0-9]$"
  58. },
  59. "traefik.tls": {
  60. "description": "Enable HTTPS/TLS",
  61. "tip": "Requires valid domain and DNS configuration"
  62. },
  63. "traefik.certresolver": {
  64. "hint": "e.g., letsencrypt, staging",
  65. "description": "Certificate resolver name"
  66. },
  67. "swarm": {
  68. "description": "Enable Docker Swarm mode",
  69. "tip": "Requires Docker Swarm to be initialized"
  70. },
  71. "swarm.replicas": {
  72. "hint": "Number of container instances",
  73. "validation": "^[1-9][0-9]*$"
  74. },
  75. "service_port_http": {
  76. "hint": "e.g., 8080, 3000, 80",
  77. "description": "HTTP port mapping",
  78. "validation": "^[1-9][0-9]{0,4}$"
  79. },
  80. "service_port_https": {
  81. "hint": "e.g., 8443, 3443, 443",
  82. "description": "HTTPS port mapping",
  83. "validation": "^[1-9][0-9]{0,4}$"
  84. },
  85. "nginx_dashboard": {
  86. "description": "Enable Nginx status dashboard"
  87. },
  88. "nginx_dashboard_port_dashboard": {
  89. "hint": "e.g., 8081, 9090",
  90. "description": "Dashboard port",
  91. "validation": "^[1-9][0-9]{0,4}$"
  92. }
  93. }
  94. # Register the module
  95. registry.register(ComposeModule)