spec_v1_1.py 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. """Compose module schema version 1.1 - Enhanced with network_mode and improved swarm.
  2. Changes from 1.0:
  3. - network: Added network_mode (bridge/host/macvlan) with conditional macvlan fields
  4. - swarm: Added volume modes (local/mount/nfs) and conditional placement constraints
  5. - traefik_tls: Updated needs format from 'traefik' to 'traefik_enabled=true'
  6. """
  7. from collections import OrderedDict
  8. spec = OrderedDict(
  9. {
  10. "general": {
  11. "title": "General",
  12. "vars": {
  13. "service_name": {
  14. "description": "Service name",
  15. "type": "str",
  16. },
  17. "container_name": {
  18. "description": "Container name",
  19. "type": "str",
  20. },
  21. "container_hostname": {
  22. "description": "Container internal hostname",
  23. "type": "str",
  24. },
  25. "container_timezone": {
  26. "description": "Container timezone (e.g., Europe/Berlin)",
  27. "type": "str",
  28. "default": "UTC",
  29. },
  30. "user_uid": {
  31. "description": "User UID for container process",
  32. "type": "int",
  33. "default": 1000,
  34. },
  35. "user_gid": {
  36. "description": "User GID for container process",
  37. "type": "int",
  38. "default": 1000,
  39. },
  40. "container_loglevel": {
  41. "description": "Container log level",
  42. "type": "enum",
  43. "options": ["debug", "info", "warn", "error"],
  44. "default": "info",
  45. },
  46. "restart_policy": {
  47. "description": "Container restart policy",
  48. "type": "enum",
  49. "options": ["unless-stopped", "always", "on-failure", "no"],
  50. "default": "unless-stopped",
  51. },
  52. },
  53. },
  54. "network": {
  55. "title": "Network",
  56. "toggle": "network_enabled",
  57. "vars": {
  58. "network_enabled": {
  59. "description": "Enable custom network block",
  60. "type": "bool",
  61. "default": False,
  62. },
  63. "network_mode": {
  64. "description": "Docker network mode",
  65. "type": "enum",
  66. "options": ["bridge", "host", "macvlan"],
  67. "default": "bridge",
  68. "extra": "bridge=default Docker networking, host=use host network stack, macvlan=dedicated MAC address on physical network",
  69. },
  70. "network_name": {
  71. "description": "Docker network name",
  72. "type": "str",
  73. "default": "bridge",
  74. "needs": "network_mode=bridge,macvlan",
  75. },
  76. "network_external": {
  77. "description": "Use existing Docker network",
  78. "type": "bool",
  79. "default": True,
  80. "needs": "network_mode=bridge,macvlan",
  81. },
  82. "network_macvlan_ipv4_address": {
  83. "description": "Static IP address for container",
  84. "type": "str",
  85. "default": "192.168.1.253",
  86. "needs": "network_mode=macvlan",
  87. },
  88. "network_macvlan_parent_interface": {
  89. "description": "Host network interface name",
  90. "type": "str",
  91. "default": "eth0",
  92. "needs": "network_mode=macvlan",
  93. },
  94. "network_macvlan_subnet": {
  95. "description": "Network subnet in CIDR notation",
  96. "type": "str",
  97. "default": "192.168.1.0/24",
  98. "needs": "network_mode=macvlan",
  99. },
  100. "network_macvlan_gateway": {
  101. "description": "Network gateway IP address",
  102. "type": "str",
  103. "default": "192.168.1.1",
  104. "needs": "network_mode=macvlan",
  105. },
  106. },
  107. },
  108. "ports": {
  109. "title": "Ports",
  110. "toggle": "ports_enabled",
  111. "vars": {
  112. "ports_enabled": {
  113. "description": "Expose ports via 'ports' mapping",
  114. "type": "bool",
  115. "default": True,
  116. }
  117. },
  118. },
  119. "traefik": {
  120. "title": "Traefik",
  121. "toggle": "traefik_enabled",
  122. "description": "Traefik routes external traffic to your service.",
  123. "vars": {
  124. "traefik_enabled": {
  125. "description": "Enable Traefik reverse proxy integration",
  126. "type": "bool",
  127. "default": False,
  128. },
  129. "traefik_network": {
  130. "description": "Traefik network name",
  131. "type": "str",
  132. "default": "traefik",
  133. },
  134. "traefik_host": {
  135. "description": "Domain name for your service (e.g., app.example.com)",
  136. "type": "str",
  137. },
  138. "traefik_entrypoint": {
  139. "description": "HTTP entrypoint (non-TLS)",
  140. "type": "str",
  141. "default": "web",
  142. },
  143. },
  144. },
  145. "traefik_tls": {
  146. "title": "Traefik TLS/SSL",
  147. "toggle": "traefik_tls_enabled",
  148. "needs": "traefik_enabled=true",
  149. "description": "Enable HTTPS/TLS for Traefik with certificate management.",
  150. "vars": {
  151. "traefik_tls_enabled": {
  152. "description": "Enable HTTPS/TLS",
  153. "type": "bool",
  154. "default": True,
  155. },
  156. "traefik_tls_entrypoint": {
  157. "description": "TLS entrypoint",
  158. "type": "str",
  159. "default": "websecure",
  160. },
  161. "traefik_tls_certresolver": {
  162. "description": "Traefik certificate resolver name",
  163. "type": "str",
  164. "default": "cloudflare",
  165. },
  166. },
  167. },
  168. "swarm": {
  169. "title": "Docker Swarm",
  170. "toggle": "swarm_enabled",
  171. "description": "Deploy service in Docker Swarm mode.",
  172. "vars": {
  173. "swarm_enabled": {
  174. "description": "Enable Docker Swarm mode",
  175. "type": "bool",
  176. "default": False,
  177. },
  178. "swarm_placement_mode": {
  179. "description": "Swarm placement mode",
  180. "type": "enum",
  181. "options": ["replicated", "global"],
  182. "default": "replicated",
  183. "extra": "replicated=run specific number of tasks, global=run one task per node",
  184. },
  185. "swarm_replicas": {
  186. "description": "Number of replicas",
  187. "type": "int",
  188. "default": 1,
  189. "needs": "swarm_placement_mode=replicated",
  190. },
  191. "swarm_placement_host": {
  192. "description": "Target hostname for placement constraint",
  193. "type": "str",
  194. "default": "",
  195. "optional": True,
  196. "needs": "swarm_placement_mode=replicated",
  197. "extra": "Constrains service to run on specific node by hostname (optional)",
  198. },
  199. "swarm_volume_mode": {
  200. "description": "Swarm volume storage backend",
  201. "type": "enum",
  202. "options": ["local", "mount", "nfs"],
  203. "default": "local",
  204. "extra": "WARNING: 'local' only works on single-node deployments!",
  205. },
  206. "swarm_volume_mount_path": {
  207. "description": "Host path for bind mount",
  208. "type": "str",
  209. "default": "/mnt/storage",
  210. "needs": "swarm_volume_mode=mount",
  211. "extra": "Useful for shared/replicated storage",
  212. },
  213. "swarm_volume_nfs_server": {
  214. "description": "NFS server address",
  215. "type": "str",
  216. "default": "192.168.1.1",
  217. "needs": "swarm_volume_mode=nfs",
  218. "extra": "IP address or hostname of NFS server",
  219. },
  220. "swarm_volume_nfs_path": {
  221. "description": "NFS export path",
  222. "type": "str",
  223. "default": "/export",
  224. "needs": "swarm_volume_mode=nfs",
  225. "extra": "Path to NFS export on the server",
  226. },
  227. "swarm_volume_nfs_options": {
  228. "description": "NFS mount options",
  229. "type": "str",
  230. "default": "rw,nolock,soft",
  231. "needs": "swarm_volume_mode=nfs",
  232. "extra": "Comma-separated NFS mount options",
  233. },
  234. },
  235. },
  236. "database": {
  237. "title": "Database",
  238. "toggle": "database_enabled",
  239. "description": "Connect to external database (PostgreSQL or MySQL)",
  240. "vars": {
  241. "database_enabled": {
  242. "description": "Enable external database integration",
  243. "type": "bool",
  244. "default": False,
  245. },
  246. "database_type": {
  247. "description": "Database type",
  248. "type": "enum",
  249. "options": ["postgres", "mysql"],
  250. "default": "postgres",
  251. },
  252. "database_external": {
  253. "description": "Use an external database server?",
  254. "extra": "If 'no', a database container will be created in the compose project.",
  255. "type": "bool",
  256. "default": False,
  257. },
  258. "database_host": {
  259. "description": "Database host",
  260. "type": "str",
  261. "default": "database",
  262. },
  263. "database_port": {"description": "Database port", "type": "int"},
  264. "database_name": {
  265. "description": "Database name",
  266. "type": "str",
  267. },
  268. "database_user": {
  269. "description": "Database user",
  270. "type": "str",
  271. },
  272. "database_password": {
  273. "description": "Database password",
  274. "type": "str",
  275. "default": "",
  276. "sensitive": True,
  277. "autogenerated": True,
  278. },
  279. },
  280. },
  281. "email": {
  282. "title": "Email Server",
  283. "toggle": "email_enabled",
  284. "description": "Configure email server for notifications and user management.",
  285. "vars": {
  286. "email_enabled": {
  287. "description": "Enable email server configuration",
  288. "type": "bool",
  289. "default": False,
  290. },
  291. "email_host": {
  292. "description": "SMTP server hostname",
  293. "type": "str",
  294. },
  295. "email_port": {
  296. "description": "SMTP server port",
  297. "type": "int",
  298. "default": 587,
  299. },
  300. "email_username": {
  301. "description": "SMTP username",
  302. "type": "str",
  303. },
  304. "email_password": {
  305. "description": "SMTP password",
  306. "type": "str",
  307. "sensitive": True,
  308. },
  309. "email_from": {
  310. "description": "From email address",
  311. "type": "str",
  312. },
  313. "email_use_tls": {
  314. "description": "Use TLS encryption",
  315. "type": "bool",
  316. "default": True,
  317. },
  318. "email_use_ssl": {
  319. "description": "Use SSL encryption",
  320. "type": "bool",
  321. "default": False,
  322. },
  323. },
  324. },
  325. "authentik": {
  326. "title": "Authentik SSO",
  327. "toggle": "authentik_enabled",
  328. "description": "Integrate with Authentik for Single Sign-On authentication.",
  329. "vars": {
  330. "authentik_enabled": {
  331. "description": "Enable Authentik SSO integration",
  332. "type": "bool",
  333. "default": False,
  334. },
  335. "authentik_url": {
  336. "description": "Authentik base URL (e.g., https://auth.example.com)",
  337. "type": "str",
  338. },
  339. "authentik_slug": {
  340. "description": "Authentik application slug",
  341. "type": "str",
  342. },
  343. "authentik_client_id": {
  344. "description": "OAuth client ID from Authentik provider",
  345. "type": "str",
  346. },
  347. "authentik_client_secret": {
  348. "description": "OAuth client secret from Authentik provider",
  349. "type": "str",
  350. "sensitive": True,
  351. },
  352. },
  353. },
  354. }
  355. )