compose.py 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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. "swarm_placement_mode": {
  146. "description": "Swarm placement mode",
  147. "type": "enum",
  148. "options": ["global", "replicated"],
  149. "default": "replicated"
  150. },
  151. "swarm_placement_host": {
  152. "description": "Limit placement to specific node",
  153. "type": "str",
  154. }
  155. },
  156. },
  157. "database": {
  158. "title": "Database",
  159. "toggle": "database_enabled",
  160. "description": "Connect to external database (PostgreSQL or MySQL)",
  161. "vars": {
  162. "database_enabled": {
  163. "description": "Enable external database integration",
  164. "type": "bool",
  165. "default": False,
  166. },
  167. "database_type": {
  168. "description": "Database type",
  169. "type": "enum",
  170. "options": ["postgres", "mysql"],
  171. "default": "postgres",
  172. },
  173. "database_external": {
  174. "description": "Use an external database server?",
  175. "extra": "If 'no', a database container will be created in the compose project.",
  176. "type": "bool",
  177. "default": False,
  178. },
  179. "database_host": {
  180. "description": "Database host",
  181. "type": "str",
  182. "default": "database",
  183. },
  184. "database_port": {
  185. "description": "Database port",
  186. "type": "int"
  187. },
  188. "database_name": {
  189. "description": "Database name",
  190. "type": "str",
  191. },
  192. "database_user": {
  193. "description": "Database user",
  194. "type": "str",
  195. },
  196. "database_password": {
  197. "description": "Database password",
  198. "type": "str",
  199. "sensitive": True,
  200. },
  201. },
  202. },
  203. "email": {
  204. "title": "Email Server",
  205. "toggle": "email_enabled",
  206. "description": "Configure email server for notifications and user management.",
  207. "vars": {
  208. "email_enabled": {
  209. "description": "Enable email server configuration",
  210. "type": "bool",
  211. "default": False,
  212. },
  213. "email_host": {
  214. "description": "SMTP server hostname",
  215. "type": "str",
  216. },
  217. "email_port": {
  218. "description": "SMTP server port",
  219. "type": "int",
  220. "default": 587,
  221. },
  222. "email_username": {
  223. "description": "SMTP username",
  224. "type": "str",
  225. },
  226. "email_password": {
  227. "description": "SMTP password",
  228. "type": "str",
  229. "sensitive": True,
  230. },
  231. "email_from": {
  232. "description": "From email address",
  233. "type": "str",
  234. },
  235. "email_use_tls": {
  236. "description": "Use TLS encryption",
  237. "type": "bool",
  238. "default": True,
  239. },
  240. "email_use_ssl": {
  241. "description": "Use SSL encryption",
  242. "type": "bool",
  243. "default": False,
  244. }
  245. },
  246. },
  247. "authentik": {
  248. "title": "Authentik SSO",
  249. "toggle": "authentik_enabled",
  250. "description": "Integrate with Authentik for Single Sign-On authentication.",
  251. "vars": {
  252. "authentik_enabled": {
  253. "description": "Enable Authentik SSO integration",
  254. "type": "bool",
  255. "default": False,
  256. },
  257. "authentik_url": {
  258. "description": "Authentik base URL (e.g., https://auth.example.com)",
  259. "type": "str",
  260. },
  261. "authentik_slug": {
  262. "description": "Authentik application slug",
  263. "type": "str",
  264. },
  265. "authentik_client_id": {
  266. "description": "OAuth client ID from Authentik provider",
  267. "type": "str",
  268. },
  269. "authentik_client_secret": {
  270. "description": "OAuth client secret from Authentik provider",
  271. "type": "str",
  272. "sensitive": True,
  273. },
  274. },
  275. },
  276. }
  277. )
  278. class ComposeModule(Module):
  279. """Docker Compose module."""
  280. name = "compose"
  281. description = "Manage Docker Compose configurations"
  282. registry.register(ComposeModule)