compose.py 8.2 KB

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