compose.py 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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_type": {
  140. "description": "Database type",
  141. "type": "enum",
  142. "options": ["postgres", "mysql", "mariadb", "sqlite"],
  143. "default": "postgres",
  144. },
  145. "database_host": {
  146. "description": "Database host",
  147. "type": "str",
  148. "default": "database",
  149. },
  150. "database_port": {
  151. "description": "Database port",
  152. "type": "int",
  153. "default": 5432,
  154. },
  155. "database_name": {
  156. "description": "Database name",
  157. "type": "str",
  158. },
  159. "database_user": {
  160. "description": "Database user",
  161. "type": "str",
  162. },
  163. "database_password": {
  164. "description": "Database password",
  165. "type": "str",
  166. },
  167. },
  168. },
  169. "email": {
  170. "title": "Email Server",
  171. "prompt": "Configure email server for notifications and user management?",
  172. "toggle": "email_enabled",
  173. "description": "Used for notifications, sign-ups, password resets, and alerts.",
  174. "vars": {
  175. "email_enabled": {
  176. "description": "Enable email server configuration",
  177. "type": "bool",
  178. "default": False,
  179. },
  180. "email_host": {
  181. "description": "SMTP server hostname",
  182. "type": "str",
  183. },
  184. "email_port": {
  185. "description": "SMTP server port",
  186. "type": "int",
  187. "default": 587,
  188. },
  189. "email_username": {
  190. "description": "SMTP username",
  191. "type": "str",
  192. },
  193. "email_password": {
  194. "description": "SMTP password",
  195. "type": "str",
  196. },
  197. "email_from": {
  198. "description": "From email address",
  199. "type": "str",
  200. },
  201. "email_use_tls": {
  202. "description": "Use TLS encryption",
  203. "type": "bool",
  204. "default": True,
  205. },
  206. "email_use_ssl": {
  207. "description": "Use SSL encryption",
  208. "type": "bool",
  209. "default": False,
  210. },
  211. },
  212. },
  213. }
  214. )
  215. class ComposeModule(Module):
  216. """Docker Compose module."""
  217. name = "compose"
  218. description = "Manage Docker Compose configurations"
  219. registry.register(ComposeModule)