spec_v1_2.py 15 KB

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