compose.py 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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. "traefik_tls_enabled": {
  97. "description": "Enable HTTPS/TLS",
  98. "type": "bool",
  99. "default": True,
  100. },
  101. "traefik_tls_entrypoint": {
  102. "description": "TLS entrypoint",
  103. "type": "str",
  104. "default": "websecure",
  105. },
  106. "traefik_tls_certresolver": {
  107. "description": "Traefik certificate resolver name",
  108. "type": "str",
  109. },
  110. },
  111. },
  112. "swarm": {
  113. "title": "Docker Swarm",
  114. "toggle": "swarm_enabled",
  115. "description": "Deploy service in Docker Swarm mode with replicas.",
  116. "vars": {
  117. "swarm_enabled": {
  118. "description": "Enable Docker Swarm mode",
  119. "type": "bool",
  120. "default": False,
  121. },
  122. "swarm_replicas": {
  123. "description": "Number of replicas in Swarm",
  124. "type": "int",
  125. "default": 1,
  126. },
  127. },
  128. },
  129. "database": {
  130. "title": "Database",
  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"],
  143. "default": "postgres",
  144. },
  145. "database_external": {
  146. "description": "Use an external database server?",
  147. "extra": "If 'no', a database container will be created in the compose project.",
  148. "type": "bool",
  149. "default": False,
  150. },
  151. "database_host": {
  152. "description": "Database host",
  153. "type": "str",
  154. "default": "database",
  155. },
  156. "database_port": {
  157. "description": "Database port",
  158. "type": "int"
  159. },
  160. "database_name": {
  161. "description": "Database name",
  162. "type": "str",
  163. },
  164. "database_user": {
  165. "description": "Database user",
  166. "type": "str",
  167. },
  168. "database_password": {
  169. "description": "Database password",
  170. "type": "str",
  171. "sensitive": True,
  172. },
  173. },
  174. },
  175. "email": {
  176. "title": "Email Server",
  177. "toggle": "email_enabled",
  178. "description": "Configure email server for notifications and user management.",
  179. "vars": {
  180. "email_enabled": {
  181. "description": "Enable email server configuration",
  182. "type": "bool",
  183. "default": False,
  184. },
  185. "email_host": {
  186. "description": "SMTP server hostname",
  187. "type": "str",
  188. },
  189. "email_port": {
  190. "description": "SMTP server port",
  191. "type": "int",
  192. "default": 587,
  193. },
  194. "email_username": {
  195. "description": "SMTP username",
  196. "type": "str",
  197. },
  198. "email_password": {
  199. "description": "SMTP password",
  200. "type": "str",
  201. "sensitive": True,
  202. },
  203. "email_from": {
  204. "description": "From email address",
  205. "type": "str",
  206. },
  207. "email_use_tls": {
  208. "description": "Use TLS encryption",
  209. "type": "bool",
  210. "default": True,
  211. },
  212. "email_use_ssl": {
  213. "description": "Use SSL encryption",
  214. "type": "bool",
  215. "default": False,
  216. }
  217. },
  218. },
  219. "authentik": {
  220. "title": "Authentik SSO",
  221. "toggle": "authentik_enabled",
  222. "description": "Integrate with Authentik for Single Sign-On authentication.",
  223. "vars": {
  224. "authentik_enabled": {
  225. "description": "Enable Authentik SSO integration",
  226. "type": "bool",
  227. "default": False,
  228. },
  229. "authentik_url": {
  230. "description": "Authentik base URL (e.g., https://auth.example.com)",
  231. "type": "str",
  232. },
  233. "authentik_slug": {
  234. "description": "Authentik application slug",
  235. "type": "str",
  236. },
  237. "authentik_client_id": {
  238. "description": "OAuth client ID from Authentik provider",
  239. "type": "str",
  240. },
  241. "authentik_client_secret": {
  242. "description": "OAuth client secret from Authentik provider",
  243. "type": "str",
  244. "sensitive": True,
  245. },
  246. },
  247. },
  248. }
  249. )
  250. class ComposeModule(Module):
  251. """Docker Compose module."""
  252. name = "compose"
  253. description = "Manage Docker Compose configurations"
  254. registry.register(ComposeModule)