spec_v1_1.py 13 KB

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