compose.py 7.0 KB

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