compose.py 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. from collections import OrderedDict
  2. from ..core.module import Module
  3. from ..core.registry import registry
  4. spec = OrderedDict(
  5. {
  6. "general": {
  7. "title": "General",
  8. "vars": {
  9. "service_name": {
  10. "description": "Service name",
  11. "type": "str",
  12. },
  13. "container_name": {
  14. "description": "Container name",
  15. "type": "str",
  16. },
  17. "container_timezone": {
  18. "description": "Container timezone (e.g., Europe/Berlin)",
  19. "type": "str",
  20. "default": "UTC",
  21. },
  22. "container_loglevel": {
  23. "description": "Container log level",
  24. "type": "enum",
  25. "options": ["debug", "info", "warn", "error"],
  26. "default": "info",
  27. },
  28. "restart_policy": {
  29. "description": "Container restart policy",
  30. "type": "enum",
  31. "options": ["unless-stopped", "always", "on-failure", "no"],
  32. "default": "unless-stopped",
  33. },
  34. "container_hostname": {
  35. "description": "Container internal hostname",
  36. "type": "str",
  37. },
  38. },
  39. },
  40. "network": {
  41. "title": "Network",
  42. "prompt": "Enable custom network block?",
  43. "toggle": "network_enabled",
  44. "vars": {
  45. "network_enabled": {
  46. "description": "Enable custom network block",
  47. "type": "bool",
  48. "default": False,
  49. },
  50. "network_name": {
  51. "description": "Docker network name",
  52. "type": "str",
  53. "default": "bridge",
  54. },
  55. "network_external": {
  56. "description": "Use existing Docker network",
  57. "type": "bool",
  58. "default": True,
  59. },
  60. },
  61. },
  62. "ports": {
  63. "title": "Ports",
  64. "prompt": "Expose ports via 'ports' mapping?",
  65. "toggle": "ports_enabled",
  66. "vars": {
  67. "ports_enabled": {
  68. "description": "Expose ports via 'ports' mapping",
  69. "type": "bool",
  70. "default": False,
  71. }
  72. },
  73. },
  74. "traefik": {
  75. "title": "Traefik",
  76. "prompt": "Enable Traefik reverse proxy integration?",
  77. "toggle": "traefik_enabled",
  78. "description": "Traefik routes external traffic to your service.",
  79. "vars": {
  80. "traefik_enabled": {
  81. "description": "Enable Traefik reverse proxy integration",
  82. "type": "bool",
  83. "default": False,
  84. },
  85. "traefik_host": {
  86. "description": "Domain name for your service",
  87. "type": "hostname",
  88. },
  89. "traefik_entrypoint": {
  90. "description": "HTTP entrypoint (non-TLS)",
  91. "type": "str",
  92. "default": "web",
  93. },
  94. "traefik_tls_enabled": {
  95. "description": "Enable HTTPS/TLS",
  96. "type": "bool",
  97. "default": True,
  98. },
  99. "traefik_tls_entrypoint": {
  100. "description": "TLS entrypoint",
  101. "type": "str",
  102. "default": "websecure",
  103. },
  104. "traefik_tls_certresolver": {
  105. "description": "Traefik certificate resolver name",
  106. "type": "str",
  107. },
  108. },
  109. },
  110. "swarm": {
  111. "title": "Docker Swarm",
  112. "prompt": "Enable Docker Swarm deployment?",
  113. "toggle": "swarm_enabled",
  114. "description": "Deploy service in Docker Swarm mode with replicas.",
  115. "vars": {
  116. "swarm_enabled": {
  117. "description": "Enable Docker Swarm mode",
  118. "type": "bool",
  119. "default": False,
  120. },
  121. "swarm_replicas": {
  122. "description": "Number of replicas in Swarm",
  123. "type": "int",
  124. "default": 1,
  125. },
  126. },
  127. },
  128. "database": {
  129. "title": "Database",
  130. "prompt": "Configure external database connection?",
  131. "toggle": "database_enabled",
  132. "description": "Connect to external database (PostgreSQL, MySQL, MariaDB, etc.)",
  133. "vars": {
  134. "database_enabled": {
  135. "description": "Enable external database integration",
  136. "type": "bool",
  137. "default": False,
  138. },
  139. "database_host": {
  140. "description": "Database host",
  141. "type": "str",
  142. "default": "database",
  143. },
  144. "database_port": {
  145. "description": "Database port",
  146. "type": "int"
  147. },
  148. "database_name": {
  149. "description": "Database name",
  150. "type": "str",
  151. },
  152. "database_user": {
  153. "description": "Database user",
  154. "type": "str",
  155. },
  156. "database_password": {
  157. "description": "Database password",
  158. "type": "str",
  159. },
  160. },
  161. },
  162. "email": {
  163. "title": "Email Server",
  164. "prompt": "Configure email server for notifications and user management?",
  165. "toggle": "email_enabled",
  166. "description": "Used for notifications, sign-ups, password resets, and alerts.",
  167. "vars": {
  168. "email_enabled": {
  169. "description": "Enable email server configuration",
  170. "type": "bool",
  171. "default": False,
  172. },
  173. "email_host": {
  174. "description": "SMTP server hostname",
  175. "type": "str",
  176. },
  177. "email_port": {
  178. "description": "SMTP server port",
  179. "type": "int",
  180. "default": 587,
  181. },
  182. "email_username": {
  183. "description": "SMTP username",
  184. "type": "str",
  185. },
  186. "email_password": {
  187. "description": "SMTP password",
  188. "type": "str",
  189. },
  190. "email_from": {
  191. "description": "From email address",
  192. "type": "str",
  193. },
  194. "email_use_tls": {
  195. "description": "Use TLS encryption",
  196. "type": "bool",
  197. "default": True,
  198. },
  199. "email_use_ssl": {
  200. "description": "Use SSL encryption",
  201. "type": "bool",
  202. "default": False,
  203. },
  204. },
  205. },
  206. }
  207. )
  208. class ComposeModule(Module):
  209. """Docker Compose module."""
  210. name = "compose"
  211. description = "Manage Docker Compose configurations"
  212. registry.register(ComposeModule)