compose.py 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. "toggle": "network_enabled",
  43. "vars": {
  44. "network_enabled": {
  45. "description": "Enable custom network block",
  46. "type": "bool",
  47. "default": False,
  48. },
  49. "network_name": {
  50. "description": "Docker network name",
  51. "type": "str",
  52. "default": "bridge",
  53. },
  54. "network_external": {
  55. "description": "Use existing Docker network",
  56. "type": "bool",
  57. "default": True,
  58. },
  59. },
  60. },
  61. "ports": {
  62. "title": "Ports",
  63. "toggle": "ports_enabled",
  64. "vars": {
  65. "ports_enabled": {
  66. "description": "Expose ports via 'ports' mapping",
  67. "type": "bool",
  68. "default": True,
  69. }
  70. },
  71. },
  72. "traefik": {
  73. "title": "Traefik",
  74. "toggle": "traefik_enabled",
  75. "description": "Traefik routes external traffic to your service.",
  76. "vars": {
  77. "traefik_enabled": {
  78. "description": "Enable Traefik reverse proxy integration",
  79. "type": "bool",
  80. "default": False,
  81. },
  82. "traefik_network": {
  83. "description": "Traefik network name",
  84. "type": "str",
  85. "default": "traefik",
  86. },
  87. "traefik_host": {
  88. "description": "Domain name for your service",
  89. "type": "hostname",
  90. },
  91. "traefik_entrypoint": {
  92. "description": "HTTP entrypoint (non-TLS)",
  93. "type": "str",
  94. "default": "web",
  95. },
  96. },
  97. },
  98. "traefik_tls": {
  99. "title": "Traefik TLS/SSL",
  100. "toggle": "traefik_tls_enabled",
  101. "needs": "traefik",
  102. "description": "Enable HTTPS/TLS for Traefik with certificate management.",
  103. "vars": {
  104. "traefik_tls_enabled": {
  105. "description": "Enable HTTPS/TLS",
  106. "type": "bool",
  107. "default": True,
  108. },
  109. "traefik_tls_entrypoint": {
  110. "description": "TLS entrypoint",
  111. "type": "str",
  112. "default": "websecure",
  113. },
  114. "traefik_tls_certresolver": {
  115. "description": "Traefik certificate resolver name",
  116. "type": "str",
  117. },
  118. },
  119. },
  120. "swarm": {
  121. "title": "Docker Swarm",
  122. "toggle": "swarm_enabled",
  123. "description": "Deploy service in Docker Swarm mode with replicas.",
  124. "vars": {
  125. "swarm_enabled": {
  126. "description": "Enable Docker Swarm mode",
  127. "type": "bool",
  128. "default": False,
  129. },
  130. "swarm_replicas": {
  131. "description": "Number of replicas in Swarm",
  132. "type": "int",
  133. "default": 1,
  134. },
  135. },
  136. },
  137. "database": {
  138. "title": "Database",
  139. "toggle": "database_enabled",
  140. "description": "Connect to external database (PostgreSQL, MySQL, MariaDB, etc.)",
  141. "vars": {
  142. "database_enabled": {
  143. "description": "Enable external database integration",
  144. "type": "bool",
  145. "default": False,
  146. },
  147. "database_type": {
  148. "description": "Database type",
  149. "type": "enum",
  150. "options": ["postgres", "mysql", "mariadb"],
  151. "default": "postgres",
  152. },
  153. "database_external": {
  154. "description": "Use an external database server?",
  155. "extra": "If 'no', a database container will be created in the compose project.",
  156. "type": "bool",
  157. "default": False,
  158. },
  159. "database_host": {
  160. "description": "Database host",
  161. "type": "str",
  162. "default": "database",
  163. },
  164. "database_port": {
  165. "description": "Database port",
  166. "type": "int"
  167. },
  168. "database_name": {
  169. "description": "Database name",
  170. "type": "str",
  171. },
  172. "database_user": {
  173. "description": "Database user",
  174. "type": "str",
  175. },
  176. "database_password": {
  177. "description": "Database password",
  178. "type": "str",
  179. "sensitive": True,
  180. },
  181. },
  182. },
  183. "email": {
  184. "title": "Email Server",
  185. "toggle": "email_enabled",
  186. "description": "Configure email server for notifications and user management.",
  187. "vars": {
  188. "email_enabled": {
  189. "description": "Enable email server configuration",
  190. "type": "bool",
  191. "default": False,
  192. },
  193. "email_host": {
  194. "description": "SMTP server hostname",
  195. "type": "str",
  196. },
  197. "email_port": {
  198. "description": "SMTP server port",
  199. "type": "int",
  200. "default": 587,
  201. },
  202. "email_username": {
  203. "description": "SMTP username",
  204. "type": "str",
  205. },
  206. "email_password": {
  207. "description": "SMTP password",
  208. "type": "str",
  209. "sensitive": True,
  210. },
  211. "email_from": {
  212. "description": "From email address",
  213. "type": "str",
  214. },
  215. "email_use_tls": {
  216. "description": "Use TLS encryption",
  217. "type": "bool",
  218. "default": True,
  219. },
  220. "email_use_ssl": {
  221. "description": "Use SSL encryption",
  222. "type": "bool",
  223. "default": False,
  224. }
  225. },
  226. },
  227. "authentik": {
  228. "title": "Authentik SSO",
  229. "toggle": "authentik_enabled",
  230. "description": "Integrate with Authentik for Single Sign-On authentication.",
  231. "vars": {
  232. "authentik_enabled": {
  233. "description": "Enable Authentik SSO integration",
  234. "type": "bool",
  235. "default": False,
  236. },
  237. "authentik_url": {
  238. "description": "Authentik base URL (e.g., https://auth.example.com)",
  239. "type": "str",
  240. },
  241. "authentik_slug": {
  242. "description": "Authentik application slug",
  243. "type": "str",
  244. },
  245. "authentik_client_id": {
  246. "description": "OAuth client ID from Authentik provider",
  247. "type": "str",
  248. },
  249. "authentik_client_secret": {
  250. "description": "OAuth client secret from Authentik provider",
  251. "type": "str",
  252. "sensitive": True,
  253. },
  254. },
  255. },
  256. }
  257. )
  258. class ComposeModule(Module):
  259. """Docker Compose module."""
  260. name = "compose"
  261. description = "Manage Docker Compose configurations"
  262. registry.register(ComposeModule)