spec_v1_1.py 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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. "vars": {
  57. "network_mode": {
  58. "description": "Docker network mode",
  59. "type": "enum",
  60. "options": ["bridge", "host", "macvlan"],
  61. "default": "bridge",
  62. },
  63. "network_name": {
  64. "description": "Docker network name",
  65. "type": "str",
  66. "default": "bridge",
  67. "needs": "network_mode=bridge,macvlan",
  68. },
  69. "network_external": {
  70. "description": "Use existing Docker network (external)",
  71. "type": "bool",
  72. "default": False,
  73. "needs": "network_mode=bridge,macvlan",
  74. },
  75. "network_macvlan_ipv4_address": {
  76. "description": "Static IP address for container",
  77. "type": "str",
  78. "default": "192.168.1.253",
  79. "needs": "network_mode=macvlan",
  80. },
  81. "network_macvlan_parent_interface": {
  82. "description": "Host network interface name",
  83. "type": "str",
  84. "default": "eth0",
  85. "needs": "network_mode=macvlan",
  86. },
  87. "network_macvlan_subnet": {
  88. "description": "Network subnet in CIDR notation",
  89. "type": "str",
  90. "default": "192.168.1.0/24",
  91. "needs": "network_mode=macvlan",
  92. },
  93. "network_macvlan_gateway": {
  94. "description": "Network gateway IP address",
  95. "type": "str",
  96. "default": "192.168.1.1",
  97. "needs": "network_mode=macvlan",
  98. },
  99. },
  100. },
  101. "ports": {
  102. "title": "Ports",
  103. "toggle": "ports_enabled",
  104. "needs": "network_mode=bridge",
  105. "vars": {},
  106. },
  107. "traefik": {
  108. "title": "Traefik",
  109. "toggle": "traefik_enabled",
  110. "needs": "network_mode=bridge",
  111. "description": "Traefik routes external traffic to your service.",
  112. "vars": {
  113. "traefik_enabled": {
  114. "description": "Enable Traefik reverse proxy integration",
  115. "type": "bool",
  116. "default": False,
  117. },
  118. "traefik_network": {
  119. "description": "Traefik network name",
  120. "type": "str",
  121. "default": "traefik",
  122. },
  123. "traefik_host": {
  124. "description": "Domain name for your service (e.g., app.example.com)",
  125. "type": "str",
  126. },
  127. "traefik_entrypoint": {
  128. "description": "HTTP entrypoint (non-TLS)",
  129. "type": "str",
  130. "default": "web",
  131. },
  132. },
  133. },
  134. "traefik_tls": {
  135. "title": "Traefik TLS/SSL",
  136. "toggle": "traefik_tls_enabled",
  137. "needs": "traefik_enabled=true;network_mode=bridge",
  138. "description": "Enable HTTPS/TLS for Traefik with certificate management.",
  139. "vars": {
  140. "traefik_tls_enabled": {
  141. "description": "Enable HTTPS/TLS",
  142. "type": "bool",
  143. "default": True,
  144. },
  145. "traefik_tls_entrypoint": {
  146. "description": "TLS entrypoint",
  147. "type": "str",
  148. "default": "websecure",
  149. },
  150. "traefik_tls_certresolver": {
  151. "description": "Traefik certificate resolver name",
  152. "type": "str",
  153. "default": "cloudflare",
  154. },
  155. },
  156. },
  157. "swarm": {
  158. "title": "Docker Swarm",
  159. "needs": "network_mode=bridge",
  160. "toggle": "swarm_enabled",
  161. "description": "Deploy service in Docker Swarm mode.",
  162. "vars": {
  163. "swarm_enabled": {
  164. "description": "Enable Docker Swarm mode",
  165. "type": "bool",
  166. "default": False,
  167. },
  168. "swarm_placement_mode": {
  169. "description": "Swarm placement mode",
  170. "type": "enum",
  171. "options": ["replicated", "global"],
  172. "default": "replicated",
  173. },
  174. "swarm_replicas": {
  175. "description": "Number of replicas",
  176. "type": "int",
  177. "default": 1,
  178. "needs": "swarm_placement_mode=replicated",
  179. },
  180. "swarm_placement_host": {
  181. "description": "Target hostname for placement constraint",
  182. "type": "str",
  183. "default": "",
  184. "optional": True,
  185. "needs": "swarm_placement_mode=replicated",
  186. "extra": "Constrains service to run on specific node by hostname",
  187. },
  188. "swarm_volume_mode": {
  189. "description": "Swarm volume storage backend",
  190. "type": "enum",
  191. "options": ["local", "mount", "nfs"],
  192. "default": "local",
  193. "extra": "WARNING: 'local' only works on single-node deployments!",
  194. },
  195. "swarm_volume_mount_path": {
  196. "description": "Host path for bind mount",
  197. "type": "str",
  198. "default": "/mnt/storage",
  199. "needs": "swarm_volume_mode=mount",
  200. "extra": "Useful for shared/replicated storage",
  201. },
  202. "swarm_volume_nfs_server": {
  203. "description": "NFS server address",
  204. "type": "str",
  205. "default": "192.168.1.1",
  206. "needs": "swarm_volume_mode=nfs",
  207. "extra": "IP address or hostname of NFS server",
  208. },
  209. "swarm_volume_nfs_path": {
  210. "description": "NFS export path",
  211. "type": "str",
  212. "default": "/export",
  213. "needs": "swarm_volume_mode=nfs",
  214. "extra": "Path to NFS export on the server",
  215. },
  216. "swarm_volume_nfs_options": {
  217. "description": "NFS mount options",
  218. "type": "str",
  219. "default": "rw,nolock,soft",
  220. "needs": "swarm_volume_mode=nfs",
  221. "extra": "Comma-separated NFS mount options",
  222. },
  223. },
  224. },
  225. "database": {
  226. "title": "Database",
  227. "toggle": "database_enabled",
  228. "vars": {
  229. "database_type": {
  230. "description": "Database type",
  231. "type": "enum",
  232. "options": ["default", "sqlite", "postgres", "mysql"],
  233. "default": "default",
  234. },
  235. "database_external": {
  236. "description": "Use an external database server?",
  237. "extra": "skips creation of internal database container",
  238. "type": "bool",
  239. "default": False,
  240. },
  241. "database_host": {
  242. "description": "Database host",
  243. "type": "str",
  244. "default": "database",
  245. },
  246. "database_port": {"description": "Database port", "type": "int"},
  247. "database_name": {
  248. "description": "Database name",
  249. "type": "str",
  250. },
  251. "database_user": {
  252. "description": "Database user",
  253. "type": "str",
  254. },
  255. "database_password": {
  256. "description": "Database password",
  257. "type": "str",
  258. "default": "",
  259. "sensitive": True,
  260. "autogenerated": True,
  261. },
  262. },
  263. },
  264. "email": {
  265. "title": "Email Server",
  266. "toggle": "email_enabled",
  267. "description": "Configure email server for notifications and user management.",
  268. "vars": {
  269. "email_enabled": {
  270. "description": "Enable email server configuration",
  271. "type": "bool",
  272. "default": False,
  273. },
  274. "email_host": {
  275. "description": "SMTP server hostname",
  276. "type": "str",
  277. },
  278. "email_port": {
  279. "description": "SMTP server port",
  280. "type": "int",
  281. "default": 587,
  282. },
  283. "email_username": {
  284. "description": "SMTP username",
  285. "type": "str",
  286. },
  287. "email_password": {
  288. "description": "SMTP password",
  289. "type": "str",
  290. "sensitive": True,
  291. },
  292. "email_from": {
  293. "description": "From email address",
  294. "type": "str",
  295. },
  296. "email_use_tls": {
  297. "description": "Use TLS encryption",
  298. "type": "bool",
  299. "default": True,
  300. },
  301. "email_use_ssl": {
  302. "description": "Use SSL encryption",
  303. "type": "bool",
  304. "default": False,
  305. },
  306. },
  307. },
  308. "authentik": {
  309. "title": "Authentik SSO",
  310. "toggle": "authentik_enabled",
  311. "description": "Integrate with Authentik for Single Sign-On authentication.",
  312. "vars": {
  313. "authentik_enabled": {
  314. "description": "Enable Authentik SSO integration",
  315. "type": "bool",
  316. "default": False,
  317. },
  318. "authentik_url": {
  319. "description": "Authentik base URL (e.g., https://auth.example.com)",
  320. "type": "str",
  321. },
  322. "authentik_slug": {
  323. "description": "Authentik application slug",
  324. "type": "str",
  325. },
  326. "authentik_client_id": {
  327. "description": "OAuth client ID from Authentik provider",
  328. "type": "str",
  329. },
  330. "authentik_client_secret": {
  331. "description": "OAuth client secret from Authentik provider",
  332. "type": "str",
  333. "sensitive": True,
  334. },
  335. },
  336. },
  337. }
  338. )