compose.py 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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": True,
  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_network": {
  86. "description": "Traefik network name",
  87. "type": "str",
  88. "default": "traefik",
  89. },
  90. "traefik_host": {
  91. "description": "Domain name for your service",
  92. "type": "hostname",
  93. },
  94. "traefik_entrypoint": {
  95. "description": "HTTP entrypoint (non-TLS)",
  96. "type": "str",
  97. "default": "web",
  98. },
  99. "traefik_tls_enabled": {
  100. "description": "Enable HTTPS/TLS",
  101. "type": "bool",
  102. "default": True,
  103. },
  104. "traefik_tls_entrypoint": {
  105. "description": "TLS entrypoint",
  106. "type": "str",
  107. "default": "websecure",
  108. },
  109. "traefik_tls_certresolver": {
  110. "description": "Traefik certificate resolver name",
  111. "type": "str",
  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_host": {
  145. "description": "Database host",
  146. "type": "str",
  147. "default": "database",
  148. },
  149. "database_port": {
  150. "description": "Database port",
  151. "type": "int"
  152. },
  153. "database_name": {
  154. "description": "Database name",
  155. "type": "str",
  156. },
  157. "database_user": {
  158. "description": "Database user",
  159. "type": "str",
  160. },
  161. "database_password": {
  162. "description": "Database password",
  163. "type": "str",
  164. },
  165. },
  166. },
  167. "email": {
  168. "title": "Email Server",
  169. "prompt": "Configure email server for notifications and user management?",
  170. "toggle": "email_enabled",
  171. "description": "Used for notifications, sign-ups, password resets, and alerts.",
  172. "vars": {
  173. "email_enabled": {
  174. "description": "Enable email server configuration",
  175. "type": "bool",
  176. "default": False,
  177. },
  178. "email_host": {
  179. "description": "SMTP server hostname",
  180. "type": "str",
  181. },
  182. "email_port": {
  183. "description": "SMTP server port",
  184. "type": "int",
  185. "default": 587,
  186. },
  187. "email_username": {
  188. "description": "SMTP username",
  189. "type": "str",
  190. },
  191. "email_password": {
  192. "description": "SMTP password",
  193. "type": "str",
  194. },
  195. "email_from": {
  196. "description": "From email address",
  197. "type": "str",
  198. },
  199. "email_use_tls": {
  200. "description": "Use TLS encryption",
  201. "type": "bool",
  202. "default": True,
  203. },
  204. "email_use_ssl": {
  205. "description": "Use SSL encryption",
  206. "type": "bool",
  207. "default": False,
  208. },
  209. },
  210. },
  211. "authentik": {
  212. "title": "Authentik SSO",
  213. "prompt": "Configure Authentik SSO integration?",
  214. "toggle": "authentik_enabled",
  215. "description": "Single Sign-On using Authentik identity provider.",
  216. "vars": {
  217. "authentik_enabled": {
  218. "description": "Enable Authentik SSO integration",
  219. "type": "bool",
  220. "default": False,
  221. },
  222. "authentik_url": {
  223. "description": "Authentik base URL (e.g., https://auth.example.com)",
  224. "type": "str",
  225. },
  226. "authentik_slug": {
  227. "description": "Authentik application slug",
  228. "type": "str",
  229. },
  230. "authentik_client_id": {
  231. "description": "OAuth client ID from Authentik provider",
  232. "type": "str",
  233. },
  234. "authentik_client_secret": {
  235. "description": "OAuth client secret from Authentik provider",
  236. "type": "str",
  237. },
  238. },
  239. },
  240. }
  241. )
  242. class ComposeModule(Module):
  243. """Docker Compose module."""
  244. name = "compose"
  245. description = "Manage Docker Compose configurations"
  246. registry.register(ComposeModule)