compose.py 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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_hostname": {
  18. "description": "Container internal hostname",
  19. "type": "str",
  20. },
  21. "container_timezone": {
  22. "description": "Container timezone (e.g., Europe/Berlin)",
  23. "type": "str",
  24. "default": "UTC",
  25. },
  26. "user_uid": {
  27. "description": "User UID for container process",
  28. "type": "int",
  29. "default": 1000,
  30. },
  31. "user_gid": {
  32. "description": "User GID for container process",
  33. "type": "int",
  34. "default": 1000,
  35. },
  36. "container_loglevel": {
  37. "description": "Container log level",
  38. "type": "enum",
  39. "options": ["debug", "info", "warn", "error"],
  40. "default": "info",
  41. },
  42. "restart_policy": {
  43. "description": "Container restart policy",
  44. "type": "enum",
  45. "options": ["unless-stopped", "always", "on-failure", "no"],
  46. "default": "unless-stopped",
  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 (e.g., app.example.com)",
  99. "type": "str",
  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. "default": "cloudflare",
  128. },
  129. },
  130. },
  131. "swarm": {
  132. "title": "Docker Swarm",
  133. "toggle": "swarm_enabled",
  134. "description": "Deploy service in Docker Swarm mode with replicas.",
  135. "vars": {
  136. "swarm_enabled": {
  137. "description": "Enable Docker Swarm mode",
  138. "type": "bool",
  139. "default": False,
  140. },
  141. "swarm_replicas": {
  142. "description": "Number of replicas in Swarm",
  143. "type": "int",
  144. "default": 1,
  145. },
  146. "swarm_placement_mode": {
  147. "description": "Swarm placement mode",
  148. "type": "enum",
  149. "options": ["global", "replicated"],
  150. "default": "replicated"
  151. },
  152. "swarm_placement_host": {
  153. "description": "Limit placement to specific node",
  154. "type": "str",
  155. }
  156. },
  157. },
  158. "database": {
  159. "title": "Database",
  160. "toggle": "database_enabled",
  161. "description": "Connect to external database (PostgreSQL or MySQL)",
  162. "vars": {
  163. "database_enabled": {
  164. "description": "Enable external database integration",
  165. "type": "bool",
  166. "default": False,
  167. },
  168. "database_type": {
  169. "description": "Database type",
  170. "type": "enum",
  171. "options": ["postgres", "mysql"],
  172. "default": "postgres",
  173. },
  174. "database_external": {
  175. "description": "Use an external database server?",
  176. "extra": "If 'no', a database container will be created in the compose project.",
  177. "type": "bool",
  178. "default": False,
  179. },
  180. "database_host": {
  181. "description": "Database host",
  182. "type": "str",
  183. "default": "database",
  184. },
  185. "database_port": {
  186. "description": "Database port",
  187. "type": "int"
  188. },
  189. "database_name": {
  190. "description": "Database name",
  191. "type": "str",
  192. },
  193. "database_user": {
  194. "description": "Database user",
  195. "type": "str",
  196. },
  197. "database_password": {
  198. "description": "Database password",
  199. "type": "str",
  200. "default": "",
  201. "sensitive": True,
  202. "autogenerated": True,
  203. },
  204. },
  205. },
  206. "email": {
  207. "title": "Email Server",
  208. "toggle": "email_enabled",
  209. "description": "Configure email server for notifications and user management.",
  210. "vars": {
  211. "email_enabled": {
  212. "description": "Enable email server configuration",
  213. "type": "bool",
  214. "default": False,
  215. },
  216. "email_host": {
  217. "description": "SMTP server hostname",
  218. "type": "str",
  219. },
  220. "email_port": {
  221. "description": "SMTP server port",
  222. "type": "int",
  223. "default": 587,
  224. },
  225. "email_username": {
  226. "description": "SMTP username",
  227. "type": "str",
  228. },
  229. "email_password": {
  230. "description": "SMTP password",
  231. "type": "str",
  232. "sensitive": True,
  233. },
  234. "email_from": {
  235. "description": "From email address",
  236. "type": "str",
  237. },
  238. "email_use_tls": {
  239. "description": "Use TLS encryption",
  240. "type": "bool",
  241. "default": True,
  242. },
  243. "email_use_ssl": {
  244. "description": "Use SSL encryption",
  245. "type": "bool",
  246. "default": False,
  247. }
  248. },
  249. },
  250. "authentik": {
  251. "title": "Authentik SSO",
  252. "toggle": "authentik_enabled",
  253. "description": "Integrate with Authentik for Single Sign-On authentication.",
  254. "vars": {
  255. "authentik_enabled": {
  256. "description": "Enable Authentik SSO integration",
  257. "type": "bool",
  258. "default": False,
  259. },
  260. "authentik_url": {
  261. "description": "Authentik base URL (e.g., https://auth.example.com)",
  262. "type": "str",
  263. },
  264. "authentik_slug": {
  265. "description": "Authentik application slug",
  266. "type": "str",
  267. },
  268. "authentik_client_id": {
  269. "description": "OAuth client ID from Authentik provider",
  270. "type": "str",
  271. },
  272. "authentik_client_secret": {
  273. "description": "OAuth client secret from Authentik provider",
  274. "type": "str",
  275. "sensitive": True,
  276. },
  277. },
  278. },
  279. }
  280. )
  281. class ComposeModule(Module):
  282. """Docker Compose module."""
  283. name = "compose"
  284. description = "Manage Docker Compose configurations"
  285. registry.register(ComposeModule)