@omer-x/buttler 2.0.0-alpha.1 → 2.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +26 -18
- package/drizzle/20261126045852_service_internet_access/migration.sql +1 -0
- package/drizzle/20261126045852_service_internet_access/snapshot.json +581 -0
- package/drizzle/20261126062036_service_links/migration.sql +11 -0
- package/drizzle/20261126062036_service_links/snapshot.json +688 -0
- package/package.json +1 -3
- package/ui/.next/BUILD_ID +1 -1
- package/ui/.next/app-path-routes-manifest.json +1 -1
- package/ui/.next/build-manifest.json +14 -3
- package/ui/.next/prerender-manifest.json +115 -11
- package/ui/.next/required-server-files.json +1 -0
- package/ui/.next/routes-manifest.json +38 -6
- package/ui/.next/server/app/[locale]/(auth)/install/page/server-reference-manifest.json +18 -18
- package/ui/.next/server/app/[locale]/(auth)/install/page.js +15 -13
- package/ui/.next/server/app/[locale]/(auth)/install/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(auth)/install/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(auth)/login/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(auth)/login/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/page/server-reference-manifest.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/builds/page/server-reference-manifest.json +45 -25
- package/ui/.next/server/app/[locale]/(base)/services/[id]/builds/page.js +17 -15
- package/ui/.next/server/app/[locale]/(base)/services/[id]/builds/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/builds/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/links/page/app-paths-manifest.json +3 -0
- package/ui/.next/server/app/[locale]/(base)/services/[id]/links/page/build-manifest.json +22 -0
- package/ui/.next/server/app/[locale]/(base)/services/[id]/links/page/next-font-manifest.json +6 -0
- package/ui/.next/server/app/[locale]/(base)/services/[id]/links/page/react-loadable-manifest.json +1 -0
- package/ui/.next/server/app/[locale]/(base)/services/[id]/links/page/server-reference-manifest.json +225 -0
- package/ui/.next/server/app/[locale]/(base)/services/[id]/links/page.js +54 -0
- package/ui/.next/server/app/[locale]/(base)/services/[id]/links/page.js.nft.json +1 -0
- package/ui/.next/server/app/[locale]/(base)/services/[id]/links/page_client-reference-manifest.js +3 -0
- package/ui/.next/server/app/[locale]/(base)/services/[id]/logs/page/server-reference-manifest.json +45 -25
- package/ui/.next/server/app/[locale]/(base)/services/[id]/logs/page.js +17 -15
- package/ui/.next/server/app/[locale]/(base)/services/[id]/logs/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/logs/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/page/server-reference-manifest.json +45 -25
- package/ui/.next/server/app/[locale]/(base)/services/[id]/page.js +17 -15
- package/ui/.next/server/app/[locale]/(base)/services/[id]/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/settings/page/server-reference-manifest.json +53 -33
- package/ui/.next/server/app/[locale]/(base)/services/[id]/settings/page.js +18 -16
- package/ui/.next/server/app/[locale]/(base)/services/[id]/settings/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/[id]/settings/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/new/page/server-reference-manifest.json +33 -23
- package/ui/.next/server/app/[locale]/(base)/services/new/page.js +12 -10
- package/ui/.next/server/app/[locale]/(base)/services/new/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/new/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/page/server-reference-manifest.json +13 -3
- package/ui/.next/server/app/[locale]/(base)/services/page.js +6 -5
- package/ui/.next/server/app/[locale]/(base)/services/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/services/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/(base)/settings/page/server-reference-manifest.json +19 -19
- package/ui/.next/server/app/[locale]/(base)/settings/page.js +11 -9
- package/ui/.next/server/app/[locale]/(base)/settings/page.js.nft.json +1 -1
- package/ui/.next/server/app/[locale]/(base)/settings/page_client-reference-manifest.js +1 -1
- package/ui/.next/server/app/[locale]/install.meta +2 -2
- package/ui/.next/server/app/[locale]/install.segments/$d$locale/!KGF1dGgp/install/__PAGE__.segment.rsc +4 -4
- package/ui/.next/server/app/[locale]/install.segments/_full.segment.rsc +5 -5
- package/ui/.next/server/app/[locale]/install.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/login.meta +2 -2
- package/ui/.next/server/app/[locale]/login.segments/$d$locale/!KGF1dGgp/login/__PAGE__.segment.rsc +3 -3
- package/ui/.next/server/app/[locale]/login.segments/_full.segment.rsc +3 -3
- package/ui/.next/server/app/[locale]/login.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/services/[id]/builds.meta +2 -2
- package/ui/.next/server/app/[locale]/services/[id]/builds.segments/$d$locale/!KGJhc2Up/services/$d$id/builds/__PAGE__.segment.rsc +24 -22
- package/ui/.next/server/app/[locale]/services/[id]/builds.segments/_full.segment.rsc +8 -8
- package/ui/.next/server/app/[locale]/services/[id]/builds.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/services/[id]/links.html +0 -0
- package/ui/.next/server/app/[locale]/services/[id]/links.meta +57 -0
- package/ui/.next/server/app/[locale]/services/[id]/links.segments/$d$locale/!KGJhc2Up/services/$d$id/links/__PAGE__.segment.rsc +47 -0
- package/ui/.next/server/app/[locale]/services/[id]/links.segments/_full.segment.rsc +45 -0
- package/ui/.next/server/app/[locale]/services/[id]/links.segments/_tree.segment.rsc +9 -0
- package/ui/.next/server/app/[locale]/services/[id]/logs.meta +2 -2
- package/ui/.next/server/app/[locale]/services/[id]/logs.segments/$d$locale/!KGJhc2Up/services/$d$id/logs/__PAGE__.segment.rsc +25 -23
- package/ui/.next/server/app/[locale]/services/[id]/logs.segments/_full.segment.rsc +9 -9
- package/ui/.next/server/app/[locale]/services/[id]/logs.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/services/[id]/settings.meta +2 -2
- package/ui/.next/server/app/[locale]/services/[id]/settings.segments/$d$locale/!KGJhc2Up/services/$d$id/settings/__PAGE__.segment.rsc +25 -23
- package/ui/.next/server/app/[locale]/services/[id]/settings.segments/_full.segment.rsc +9 -9
- package/ui/.next/server/app/[locale]/services/[id]/settings.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/services/[id].meta +2 -2
- package/ui/.next/server/app/[locale]/services/[id].segments/$d$locale/!KGJhc2Up/services/$d$id/__PAGE__.segment.rsc +11 -9
- package/ui/.next/server/app/[locale]/services/[id].segments/_full.segment.rsc +27 -29
- package/ui/.next/server/app/[locale]/services/[id].segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/services/new.meta +2 -2
- package/ui/.next/server/app/[locale]/services/new.segments/$d$locale/!KGJhc2Up/services/new/__PAGE__.segment.rsc +6 -6
- package/ui/.next/server/app/[locale]/services/new.segments/_full.segment.rsc +27 -26
- package/ui/.next/server/app/[locale]/services/new.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/services.meta +2 -2
- package/ui/.next/server/app/[locale]/services.segments/$d$locale/!KGJhc2Up/services/__PAGE__.segment.rsc +34 -31
- package/ui/.next/server/app/[locale]/services.segments/_full.segment.rsc +40 -39
- package/ui/.next/server/app/[locale]/services.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale]/settings.meta +2 -2
- package/ui/.next/server/app/[locale]/settings.segments/$d$locale/!KGJhc2Up/settings/__PAGE__.segment.rsc +6 -6
- package/ui/.next/server/app/[locale]/settings.segments/_full.segment.rsc +6 -6
- package/ui/.next/server/app/[locale]/settings.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/[locale].meta +2 -2
- package/ui/.next/server/app/[locale].segments/$d$locale/!KGJhc2Up/__PAGE__.segment.rsc +5 -5
- package/ui/.next/server/app/[locale].segments/_full.segment.rsc +5 -5
- package/ui/.next/server/app/[locale].segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/_global-error/page.js +1 -1
- package/ui/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/ui/.next/server/app/_global-error.html +1 -1
- package/ui/.next/server/app/_global-error.rsc +1 -1
- package/ui/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/ui/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/ui/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/ui/.next/server/app/_not-found.html +1 -1
- package/ui/.next/server/app/_not-found.rsc +1 -1
- package/ui/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/ui/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/ui/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/ui/.next/server/app/api/services/[id]/logs/stream/route/server-reference-manifest.json +12 -2
- package/ui/.next/server/app/api/services/[id]/logs/stream/route.js +6 -6
- package/ui/.next/server/app/api/services/[id]/logs/stream/route.js.nft.json +1 -1
- package/ui/.next/server/app/api/sources/dockerhub/tags/route.js.nft.json +1 -1
- package/ui/.next/server/app/api/sources/github/branches/route.js +1 -1
- package/ui/.next/server/app/api/sources/github/branches/route.js.nft.json +1 -1
- package/ui/.next/server/app/api/sources/github/repos/route.js +1 -1
- package/ui/.next/server/app/api/sources/github/repos/route.js.nft.json +1 -1
- package/ui/.next/server/app/auth/cloudflare/route.js +9 -8
- package/ui/.next/server/app/auth/cloudflare/route.js.nft.json +1 -1
- package/ui/.next/server/app/auth/github/route.js.nft.json +1 -1
- package/ui/.next/server/app/auth/github-install/route.js.nft.json +1 -1
- package/ui/.next/server/app/auth/instance/route.js.nft.json +1 -1
- package/ui/.next/server/app/auth/setup/route.js.nft.json +1 -1
- package/ui/.next/server/app/en/install.html +1 -1
- package/ui/.next/server/app/en/install.meta +1 -1
- package/ui/.next/server/app/en/install.segments/$d$locale/!KGF1dGgp/install/__PAGE__.segment.rsc +2 -2
- package/ui/.next/server/app/en/install.segments/$d$locale.segment.rsc +3 -3
- package/ui/.next/server/app/en/install.segments/_full.segment.rsc +5 -5
- package/ui/.next/server/app/en/install.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/login.html +1 -1
- package/ui/.next/server/app/en/login.meta +1 -1
- package/ui/.next/server/app/en/login.segments/$d$locale/!KGF1dGgp/login/__PAGE__.segment.rsc +1 -1
- package/ui/.next/server/app/en/login.segments/$d$locale.segment.rsc +3 -3
- package/ui/.next/server/app/en/login.segments/_full.segment.rsc +4 -4
- package/ui/.next/server/app/en/login.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/services/[id]/builds.html +1 -1
- package/ui/.next/server/app/en/services/[id]/builds.meta +1 -1
- package/ui/.next/server/app/en/services/[id]/builds.segments/$d$locale/!KGJhc2Up/services/$d$id/builds/__PAGE__.segment.rsc +40 -38
- package/ui/.next/server/app/en/services/[id]/builds.segments/$d$locale/!KGJhc2Up.segment.rsc +30 -28
- package/ui/.next/server/app/en/services/[id]/builds.segments/$d$locale.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/[id]/builds.segments/_full.segment.rsc +59 -56
- package/ui/.next/server/app/en/services/[id]/builds.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/services/[id]/links.html +1 -0
- package/ui/.next/server/app/en/services/[id]/links.meta +58 -0
- package/ui/.next/server/app/en/services/[id]/links.segments/$d$locale/!KGJhc2Up/services/$d$id/links/__PAGE__.segment.rsc +50 -0
- package/ui/.next/server/app/en/services/[id]/links.segments/$d$locale/!KGJhc2Up.segment.rsc +36 -0
- package/ui/.next/server/app/en/services/[id]/links.segments/$d$locale.segment.rsc +24 -0
- package/ui/.next/server/app/en/services/[id]/links.segments/_full.segment.rsc +77 -0
- package/ui/.next/server/app/en/services/[id]/links.segments/_tree.segment.rsc +9 -0
- package/ui/.next/server/app/en/services/[id]/logs.html +1 -1
- package/ui/.next/server/app/en/services/[id]/logs.meta +1 -1
- package/ui/.next/server/app/en/services/[id]/logs.segments/$d$locale/!KGJhc2Up/services/$d$id/logs/__PAGE__.segment.rsc +41 -39
- package/ui/.next/server/app/en/services/[id]/logs.segments/$d$locale/!KGJhc2Up.segment.rsc +31 -29
- package/ui/.next/server/app/en/services/[id]/logs.segments/$d$locale.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/[id]/logs.segments/_full.segment.rsc +60 -57
- package/ui/.next/server/app/en/services/[id]/logs.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/services/[id]/settings.html +1 -1
- package/ui/.next/server/app/en/services/[id]/settings.meta +1 -1
- package/ui/.next/server/app/en/services/[id]/settings.segments/$d$locale/!KGJhc2Up/services/$d$id/settings/__PAGE__.segment.rsc +41 -39
- package/ui/.next/server/app/en/services/[id]/settings.segments/$d$locale/!KGJhc2Up.segment.rsc +31 -29
- package/ui/.next/server/app/en/services/[id]/settings.segments/$d$locale.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/[id]/settings.segments/_full.segment.rsc +41 -39
- package/ui/.next/server/app/en/services/[id]/settings.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/services/[id].html +1 -1
- package/ui/.next/server/app/en/services/[id].meta +1 -1
- package/ui/.next/server/app/en/services/[id].segments/$d$locale/!KGJhc2Up/services/$d$id/__PAGE__.segment.rsc +38 -36
- package/ui/.next/server/app/en/services/[id].segments/$d$locale/!KGJhc2Up.segment.rsc +30 -28
- package/ui/.next/server/app/en/services/[id].segments/$d$locale.segment.rsc +4 -4
- package/ui/.next/server/app/en/services/[id].segments/_full.segment.rsc +54 -54
- package/ui/.next/server/app/en/services/[id].segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/services/new.html +1 -1
- package/ui/.next/server/app/en/services/new.meta +1 -1
- package/ui/.next/server/app/en/services/new.segments/$d$locale/!KGJhc2Up/services/new/__PAGE__.segment.rsc +35 -34
- package/ui/.next/server/app/en/services/new.segments/$d$locale/!KGJhc2Up.segment.rsc +27 -26
- package/ui/.next/server/app/en/services/new.segments/$d$locale.segment.rsc +3 -3
- package/ui/.next/server/app/en/services/new.segments/_full.segment.rsc +55 -53
- package/ui/.next/server/app/en/services/new.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/services.html +1 -1
- package/ui/.next/server/app/en/services.meta +1 -1
- package/ui/.next/server/app/en/services.segments/$d$locale/!KGJhc2Up/services/__PAGE__.segment.rsc +33 -32
- package/ui/.next/server/app/en/services.segments/$d$locale/!KGJhc2Up.segment.rsc +26 -25
- package/ui/.next/server/app/en/services.segments/$d$locale.segment.rsc +3 -3
- package/ui/.next/server/app/en/services.segments/_full.segment.rsc +58 -57
- package/ui/.next/server/app/en/services.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en/settings.html +1 -1
- package/ui/.next/server/app/en/settings.meta +1 -1
- package/ui/.next/server/app/en/settings.segments/$d$locale/!KGJhc2Up/settings/__PAGE__.segment.rsc +2 -2
- package/ui/.next/server/app/en/settings.segments/$d$locale/!KGJhc2Up.segment.rsc +27 -26
- package/ui/.next/server/app/en/settings.segments/$d$locale.segment.rsc +3 -3
- package/ui/.next/server/app/en/settings.segments/_full.segment.rsc +32 -31
- package/ui/.next/server/app/en/settings.segments/_tree.segment.rsc +2 -2
- package/ui/.next/server/app/en.html +1 -1
- package/ui/.next/server/app/en.meta +4 -3
- package/ui/.next/server/app/en.segments/$d$locale/!KGJhc2Up/__PAGE__.segment.rsc +25 -44
- package/ui/.next/server/app/en.segments/$d$locale/!KGJhc2Up.segment.rsc +32 -0
- package/ui/.next/server/app/en.segments/$d$locale.segment.rsc +3 -3
- package/ui/.next/server/app/en.segments/_full.segment.rsc +29 -28
- package/ui/.next/server/app/en.segments/_tree.segment.rsc +4 -4
- package/ui/.next/server/app/webhooks/github/route.js +8 -8
- package/ui/.next/server/app/webhooks/github/route.js.nft.json +1 -1
- package/ui/.next/server/app-paths-manifest.json +1 -1
- package/ui/.next/server/chunks/[root-of-the-server]__013tvh0fuqyka._.js +3 -0
- package/ui/.next/server/chunks/{[root-of-the-server]__1lelc_ro6_mho._.js → [root-of-the-server]__0axr0p9f9qjo3._.js} +1 -1
- package/ui/.next/server/chunks/[root-of-the-server]__0b1qz1hj0p20c._.js +1 -1
- package/ui/.next/server/chunks/{[root-of-the-server]__1scxqky7parj6._.js → [root-of-the-server]__0emx9mcq5bpjq._.js} +2 -2
- package/ui/.next/server/chunks/{[root-of-the-server]__1rf_6saum-z_d._.js → [root-of-the-server]__0hgon_k2l_1kv._.js} +2 -2
- package/ui/.next/server/chunks/[root-of-the-server]__0qe_mikj7agcq._.js +3 -0
- package/ui/.next/server/chunks/{[root-of-the-server]__0t-09tfm5-unm._.js → [root-of-the-server]__1007u-potejqr._.js} +1 -1
- package/ui/.next/server/chunks/[root-of-the-server]__1099j5oihunj4._.js +3 -0
- package/ui/.next/server/chunks/[root-of-the-server]__16b_5up45wd06._.js +3 -0
- package/ui/.next/server/chunks/[root-of-the-server]__1m9jomjwom7eb._.js +3 -0
- package/ui/.next/server/chunks/[root-of-the-server]__1w3vh-httwncf._.js +2 -2
- package/ui/.next/server/chunks/_0-08w0j6upuro._.js +4 -4
- package/ui/.next/server/chunks/{_205giqmll3u97._.js → _0iv1xrv5s4qth._.js} +2 -2
- package/ui/.next/server/chunks/_0nlsx2mvtyhai._.js +3 -0
- package/ui/.next/server/chunks/_1ddptkvp76c-m._.js +1 -1
- package/ui/.next/server/chunks/_1nlr92m-cxatd._.js +1 -1
- package/ui/.next/server/chunks/_1ux2nt1zdyn0-._.js +4 -4
- package/ui/.next/server/chunks/_1xyz4i2jb2-s2._.js +3 -0
- package/ui/.next/server/chunks/src_0ehe0gc5xa4op._.js +3 -0
- package/ui/.next/server/chunks/src_1wc3qafci1k3-._.js +3 -0
- package/ui/.next/server/chunks/src_core_build_ts_1w4o1q_gv2fnz._.js +3 -3
- package/ui/.next/server/chunks/src_core_docker_ingress_ts_0k5y-exk0jujc._.js +1 -1
- package/ui/.next/server/chunks/src_core_docker_links_ts_1xdvepbsz4gi1._.js +3 -0
- package/ui/.next/server/chunks/src_core_docker_tunnel_ts_0a1cq4o2gv4cz._.js +1 -1
- package/ui/.next/server/chunks/src_core_docker_tunnel_ts_0joxbsi21ggvm._.js +3 -0
- package/ui/.next/server/chunks/src_core_nginx_ts_1bg68o99-jq87._.js +4 -4
- package/ui/.next/server/chunks/{src_core_settings_ts_1hcogi90bhvb7._.js → src_core_settings_ts_03r6mrmvaf3z9._.js} +1 -1
- package/ui/.next/server/chunks/{src_core_settings_ts_1mdt19mqp5pzi._.js → src_core_settings_ts_06epzja3innn1._.js} +1 -1
- package/ui/.next/server/chunks/src_database_index_ts_1vzqbmlp-k92u._.js +6 -6
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__034qjpl9j-0ci._.js +3 -0
- package/ui/.next/server/chunks/ssr/{[root-of-the-server]__0drv11-4w87e2._.js → [root-of-the-server]__0cws_i6hecx8i._.js} +2 -2
- package/ui/.next/server/chunks/ssr/{[root-of-the-server]__0ai9eb5tkexh4._.js → [root-of-the-server]__0lrw_bd_v-wq9._.js} +1 -1
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__0rkkxjp0vxzob._.js +3 -0
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__0tceu8thqwy0d._.js +3 -0
- package/ui/.next/server/chunks/ssr/{[root-of-the-server]__132clfs6nokf6._.js → [root-of-the-server]__0tnvefuofuctm._.js} +1 -1
- package/ui/.next/server/chunks/ssr/{[root-of-the-server]__1iy0cb7kzkjrq._.js → [root-of-the-server]__11f8nw5rjx5xy._.js} +1 -1
- package/ui/.next/server/chunks/ssr/{[root-of-the-server]__1fz83aiqt1p_g._.js → [root-of-the-server]__15um_js0-44w5._.js} +1 -1
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__19k3qfyr4zw2t._.js +4 -0
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__1_2uw8tv9c80k._.js +4 -0
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__1f2-_zy1hslsn._.js +4 -0
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__1nipqwqlhzrez._.js +4 -0
- package/ui/.next/server/chunks/ssr/_039tax-e0r5wx._.js +3 -0
- package/ui/.next/server/chunks/ssr/_03mjbc5iu4-0t._.js +1 -1
- package/ui/.next/server/chunks/ssr/_043r3p4uyglt8._.js +3 -0
- package/ui/.next/server/chunks/ssr/_045ukfxgkrnjs._.js +1 -1
- package/ui/.next/server/chunks/ssr/_04lfy3e4jplbm._.js +3 -0
- package/ui/.next/server/chunks/ssr/_0dku_2buhxhe1._.js +3 -0
- package/ui/.next/server/chunks/ssr/{_1j5g-1pklmyv3._.js → _0elrzkszc9mou._.js} +2 -2
- package/ui/.next/server/chunks/ssr/_0gm20eaq31snn._.js +3 -0
- package/ui/.next/server/chunks/ssr/_0l5h_g6g26cch._.js +1 -1
- package/ui/.next/server/chunks/ssr/_0nm-73v3d_j3o._.js +3 -0
- package/ui/.next/server/chunks/ssr/_0q_ty5-s_ojhi._.js +1 -1
- package/ui/.next/server/chunks/ssr/_0sid4-3pb734p._.js +1 -1
- package/ui/.next/server/chunks/ssr/_11hffrysj8ccd._.js +1 -1
- package/ui/.next/server/chunks/ssr/_14pr8k-21_dud._.js +1 -1
- package/ui/.next/server/chunks/ssr/_1975r9mjak44f._.js +1 -1
- package/ui/.next/server/chunks/ssr/_1bw46sadku4mx._.js +3 -0
- package/ui/.next/server/chunks/ssr/_1c9ja4120f5e7._.js +1 -1
- package/ui/.next/server/chunks/ssr/_1cwumh2lem642._.js +2 -2
- package/ui/.next/server/chunks/ssr/_1g8x3co_2gk2e._.js +3 -0
- package/ui/.next/server/chunks/ssr/_1gxrg8g_1z61n._.js +1 -1
- package/ui/.next/server/chunks/ssr/_1jvwyvy2mdunl._.js +1 -1
- package/ui/.next/server/chunks/ssr/_1l9hlfxdk4800._.js +3 -0
- package/ui/.next/server/chunks/ssr/{_0yfah9gezazo5._.js → _1s61535w_i_lb._.js} +2 -2
- package/ui/.next/server/chunks/ssr/{_19w_0onn2cdmy._.js → _1t7wd5lbghpsq._.js} +2 -2
- package/ui/.next/server/chunks/ssr/_1thsxvh0czdx1._.js +3 -0
- package/ui/.next/server/chunks/ssr/_1v-gh-ppdzk54._.js +3 -0
- package/ui/.next/server/chunks/ssr/_1vznrs2oqv125._.js +3 -0
- package/ui/.next/server/chunks/ssr/_next-internal_server_app_[locale]_(auth)_install_page_actions_0q608mh34etxn.js +1 -1
- package/ui/.next/server/chunks/ssr/dictionaries_en_json_[json]_cjs_1pkm_n6uii6ve._.js +1 -1
- package/ui/.next/server/chunks/ssr/node_modules_09h9wf5os0vez._.js +2 -2
- package/ui/.next/server/chunks/ssr/node_modules_0bh4y86fdvx3u._.js +2 -2
- package/ui/.next/server/chunks/ssr/node_modules_0difw-6bio6t9._.js +1 -1
- package/ui/.next/server/chunks/ssr/{node_modules_16kqn5r2-3r66._.js → node_modules_0j64ears5h1cj._.js} +2 -2
- package/ui/.next/server/chunks/ssr/node_modules_0m4futnh2n1n0._.js +2 -2
- package/ui/.next/server/chunks/ssr/node_modules_1gueex6ppv2u1._.js +3 -0
- package/ui/.next/server/chunks/ssr/{_0nnq48ip-8ji-._.js → node_modules_@omer-x_tailwind-ui-kit_dist_components_form_index_1scnp-x6u_00i.js} +2 -2
- package/ui/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_1659ld6risgus.js +3 -0
- package/ui/.next/server/chunks/ssr/{_08r9mb2mbnczy._.js → node_modules_zod_v4_classic_external_0_adu4p2yg38n.js} +4 -4
- package/ui/.next/server/chunks/ssr/{_0ymxsb_ki8zel._.js → node_modules_zod_v4_classic_external_0b6jkffik0qe3.js} +4 -4
- package/ui/.next/server/chunks/ssr/src_05sh4p2uehbos._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_10pz-333ne5s9._.js +3 -0
- package/ui/.next/server/chunks/ssr/src_1iyfq6dudriyk._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_1m2fl_nqj5nqs._.js +3 -0
- package/ui/.next/server/chunks/ssr/src_actions_cloudflare_ts_0fwbybngp80nf._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_actions_link_ts_13hqd7ogc36j3._.js +3 -0
- package/ui/.next/server/chunks/ssr/src_actions_service_ts_0leald8wxwln3._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_actions_setup_ts_1j3o9o1z2x8l-._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_actions_user_ts_15o74nrxk2-dn._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_app_[locale]_(base)_services_[id]_page_tsx_0hd62fq604aua._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_components_0dw7q_n_p1894._.js +1 -1
- package/ui/.next/server/chunks/ssr/{src_components_services_1ckwhi_x497s9._.js → src_components_services_0uvp3xb7qbmur._.js} +2 -2
- package/ui/.next/server/chunks/ssr/src_components_services_1xqd2ez36okp0._.js +3 -0
- package/ui/.next/server/chunks/ssr/src_components_services_InternetAccessChoice_tsx_1kgbpu0tzvndy._.js +3 -0
- package/ui/.next/server/chunks/ssr/src_core_04_5qe36g6q0g._.js +3 -0
- package/ui/.next/server/chunks/ssr/src_core_0nipraeusd7bv._.js +3 -0
- package/ui/.next/server/chunks/ssr/src_core_0w75t1-r5b57i._.js +3 -0
- package/ui/.next/server/chunks/ssr/src_core_build_ts_137f9fwr3qgv8._.js +3 -3
- package/ui/.next/server/chunks/ssr/src_core_cloudflare_domains_ts_1tx1rckprh9ks._.js +3 -0
- package/ui/.next/server/chunks/ssr/src_core_docker_1o4aldsy3-3_s._.js +3 -0
- package/ui/.next/server/chunks/ssr/src_core_docker_ingress_ts_0v7q2dx4d_gfp._.js +1 -1
- package/ui/.next/server/chunks/ssr/src_core_docker_tunnel_ts_1805lsnks1qba._.js +1 -1
- package/ui/.next/server/instrumentation.js +1 -1
- package/ui/.next/server/middleware-build-manifest.js +14 -3
- package/ui/.next/server/pages/404.html +1 -1
- package/ui/.next/server/pages/500.html +1 -1
- package/ui/.next/server/prefetch-hints.json +36 -2
- package/ui/.next/server/preview-props.json +3 -3
- package/ui/.next/server/server-reference-manifest.js +1 -1
- package/ui/.next/server/server-reference-manifest.json +202 -46
- package/ui/.next/static/63mGypIl9_o7HjkdjsR8q/_ssgManifest.js +1 -0
- package/ui/.next/static/chunks/05jnb1lfbb-j1.js +1 -0
- package/ui/.next/static/chunks/{1n7hyxug-qmmf.js → 0r6re9w59ezlu.js} +1 -1
- package/ui/.next/static/chunks/0ru9sh1o_ylb0.js +3 -0
- package/ui/.next/static/chunks/1_zs-121mlws0.js +1 -0
- package/ui/.next/static/chunks/1bb88ubtg9zhx.js +1 -0
- package/ui/.next/static/chunks/{08m3mlwdpjhqa.js → 1hltxf3jfbf02.js} +1 -1
- package/ui/.next/static/chunks/2ev4g9-mfre-4.js +1 -0
- package/ui/.next/static/chunks/2y6dkbb_cpkcg.css +1 -0
- package/ui/.next/static/chunks/3dj_pr0f1ky5c.js +1 -0
- package/ui/.next/static/chunks/3glt8s6g02u22.js +1 -0
- package/ui/.next/static/chunks/3pmo4svmlsjie.js +1 -0
- package/ui/.next/static/chunks/3rt54zhr0x-_1.js +1 -0
- package/ui/.next/static/chunks/434x1gu7o1zm6.js +1 -0
- package/ui/.next/static/chunks/{39r-cmc0-jpz9.js → 452ji7o2zwiwa.js} +1 -1
- package/ui/drizzle/20261105041530_awesome_spiral/migration.sql +6 -0
- package/ui/drizzle/20261105041530_awesome_spiral/snapshot.json +64 -0
- package/ui/drizzle/20261108004152_overconfident_gunslinger/migration.sql +6 -0
- package/ui/drizzle/20261108004152_overconfident_gunslinger/snapshot.json +117 -0
- package/ui/drizzle/20261109034417_nervous_namora/migration.sql +27 -0
- package/ui/drizzle/20261109034417_nervous_namora/snapshot.json +333 -0
- package/ui/drizzle/20261124013742_medical_rhodey/migration.sql +2 -0
- package/ui/drizzle/20261124013742_medical_rhodey/snapshot.json +353 -0
- package/ui/drizzle/20261124075450_wooden_moondragon/migration.sql +9 -0
- package/ui/drizzle/20261124075450_wooden_moondragon/snapshot.json +430 -0
- package/ui/drizzle/20261124131152_greedy_betty_ross/migration.sql +7 -0
- package/ui/drizzle/20261124131152_greedy_betty_ross/snapshot.json +498 -0
- package/ui/drizzle/20261125085214_blushing_the_liberteens/migration.sql +8 -0
- package/ui/drizzle/20261125085214_blushing_the_liberteens/snapshot.json +571 -0
- package/ui/drizzle/20261126045852_service_internet_access/migration.sql +1 -0
- package/ui/drizzle/20261126045852_service_internet_access/snapshot.json +581 -0
- package/ui/drizzle/20261126062036_service_links/migration.sql +11 -0
- package/ui/drizzle/20261126062036_service_links/snapshot.json +688 -0
- package/ui/package.json +0 -2
- package/ui/server.js +1 -1
- package/ui/src/core/build.test.ts +37 -1
- package/ui/src/core/build.ts +5 -1
- package/ui/src/core/cloudflare/domains.test.ts +1 -1
- package/ui/src/core/docker/ingress.test.ts +6 -6
- package/ui/src/core/docker/ingress.ts +4 -27
- package/ui/src/core/docker/internet.test.ts +88 -0
- package/ui/src/core/docker/internet.ts +59 -0
- package/ui/src/core/docker/labels.ts +2 -0
- package/ui/src/core/docker/links.test.ts +164 -0
- package/ui/src/core/docker/links.ts +170 -0
- package/ui/src/core/docker/networks.ts +41 -0
- package/ui/src/core/docker/status.test.ts +139 -2
- package/ui/src/core/docker/status.ts +71 -16
- package/ui/src/core/docker/tunnel.test.ts +3 -0
- package/ui/src/core/docker/tunnel.ts +2 -1
- package/ui/src/core/docker.ts +0 -26
- package/ui/src/core/env.ts +0 -1
- package/ui/.next/server/app/api/db/backup/route/app-paths-manifest.json +0 -3
- package/ui/.next/server/app/api/db/backup/route/build-manifest.json +0 -12
- package/ui/.next/server/app/api/db/backup/route/server-reference-manifest.json +0 -4
- package/ui/.next/server/app/api/db/backup/route.js +0 -15
- package/ui/.next/server/app/api/db/backup/route.js.nft.json +0 -1
- package/ui/.next/server/app/api/db/backup/route_client-reference-manifest.js +0 -3
- package/ui/.next/server/chunks/[root-of-the-server]__0q_y890--33_5._.js +0 -3
- package/ui/.next/server/chunks/[root-of-the-server]__12udgfypv-16z._.js +0 -3
- package/ui/.next/server/chunks/[root-of-the-server]__156dfvjma1155._.js +0 -3
- package/ui/.next/server/chunks/[root-of-the-server]__1tnosm88zpozo._.js +0 -3
- package/ui/.next/server/chunks/_0146k0if4moum._.js +0 -3
- package/ui/.next/server/chunks/_03halr20g-8bs._.js +0 -3
- package/ui/.next/server/chunks/_next-internal_server_app_api_db_backup_route_actions_0g6ljpmyzdttd.js +0 -3
- package/ui/.next/server/chunks/src_1blp7j39u7nfe._.js +0 -3
- package/ui/.next/server/chunks/src_1gxoul9hz0c2d._.js +0 -3
- package/ui/.next/server/chunks/src_core_docker_status_ts_0_sv17u6yx63t._.js +0 -3
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__05b3bu3znu9bo._.js +0 -4
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__0ktv4mwammozc._.js +0 -3
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__1jiq5wb0hvbag._.js +0 -4
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__1oyqb2s2p-4ad._.js +0 -4
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__1p_zg_jwhqsyk._.js +0 -4
- package/ui/.next/server/chunks/ssr/[root-of-the-server]__1pb7oi97dnmzg._.js +0 -3
- package/ui/.next/server/chunks/ssr/_01e3rinj2_l0i._.js +0 -3
- package/ui/.next/server/chunks/ssr/_03yw69lobi4lm._.js +0 -3
- package/ui/.next/server/chunks/ssr/_07ufozddb8s9r._.js +0 -4
- package/ui/.next/server/chunks/ssr/_0i5-qw-3yy6gn._.js +0 -3
- package/ui/.next/server/chunks/ssr/_12p0hrdhqcio6._.js +0 -3
- package/ui/.next/server/chunks/ssr/_1czfqaem07udj._.js +0 -57
- package/ui/.next/server/chunks/ssr/_1j_fg04_leqmf._.js +0 -3
- package/ui/.next/server/chunks/ssr/_1tcz5rcgonbsu._.js +0 -3
- package/ui/.next/server/chunks/ssr/node_modules_@omer-x_next-form-actions_dist_index_mjs_1c5mg0xduv-_v._.js +0 -3
- package/ui/.next/server/chunks/ssr/src_1oiyj5tki7jmf._.js +0 -3
- package/ui/.next/server/chunks/ssr/src_core_0xquh5wh6_5p0._.js +0 -3
- package/ui/.next/server/chunks/ssr/src_core_docker_builds_ts_189l3irnv_2va._.js +0 -3
- package/ui/.next/static/chunks/10m4ed4sinix2.js +0 -1
- package/ui/.next/static/chunks/20od0wichpr35.js +0 -1
- package/ui/.next/static/chunks/29ff4faj7vef6.js +0 -1
- package/ui/.next/static/chunks/2dd4k9ts17atr.css +0 -1
- package/ui/.next/static/chunks/2f8eqac26a_-k.js +0 -3
- package/ui/.next/static/chunks/32vuew10abq29.js +0 -1
- package/ui/.next/static/chunks/35uvm9kv04fdr.js +0 -1
- package/ui/.next/static/chunks/3htgsexlb92yb.js +0 -1
- package/ui/.next/static/v8Q5mbcaFRVQGsxQKUzYH/_ssgManifest.js +0 -1
- package/ui/src/core/backup.ts +0 -7
- package/ui/src/core/mega.ts +0 -15
- package/ui/src/core/provider.ts +0 -26
- /package/ui/.next/server/app/{api/db/backup/route.js.map → [locale]/(base)/services/[id]/links/page.js.map} +0 -0
- /package/ui/.next/static/{v8Q5mbcaFRVQGsxQKUzYH → 63mGypIl9_o7HjkdjsR8q}/_buildManifest.js +0 -0
- /package/ui/.next/static/{v8Q5mbcaFRVQGsxQKUzYH → 63mGypIl9_o7HjkdjsR8q}/_clientMiddlewareManifest.js +0 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { docker } from "~/core/docker";
|
|
2
|
+
import { createQueue } from "~/core/queue";
|
|
3
|
+
import db from "~/database";
|
|
4
|
+
import type { ServiceLinkDTO } from "~/models/service-link";
|
|
5
|
+
import getServiceLinks from "~/operations/getServiceLinks";
|
|
6
|
+
import { isOwnContainer } from "./containers";
|
|
7
|
+
import { FORBIDDEN, NOT_FOUND, ignoreStatus } from "./errors";
|
|
8
|
+
import { BUTTLER_LINK_LABEL, BUTTLER_NETWORK_LABEL, BUTTLER_SERVICE_LABEL } from "./labels";
|
|
9
|
+
import { createButtlerNetwork } from "./networks";
|
|
10
|
+
import type Docker from "dockerode";
|
|
11
|
+
|
|
12
|
+
const LINK_NETWORK = "link";
|
|
13
|
+
|
|
14
|
+
type LinkNetwork = Pick<Docker.NetworkInspectInfo, "Id" | "Name">;
|
|
15
|
+
|
|
16
|
+
type Link = Pick<ServiceLinkDTO, "id" | "serviceAId" | "serviceBId">;
|
|
17
|
+
|
|
18
|
+
/** Changes never overlap, otherwise they could undo each other */
|
|
19
|
+
const enqueue = createQueue("link-queue");
|
|
20
|
+
|
|
21
|
+
export function getLinkNetworkName(linkId: string) {
|
|
22
|
+
return `buttler-link-${linkId}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Only returns the networks that are created by Buttler */
|
|
26
|
+
function listLinkNetworks(linkId?: string) {
|
|
27
|
+
return docker.listNetworks({
|
|
28
|
+
filters: {
|
|
29
|
+
label: [
|
|
30
|
+
`${BUTTLER_NETWORK_LABEL}=${LINK_NETWORK}`,
|
|
31
|
+
...linkId ? [`${BUTTLER_LINK_LABEL}=${linkId}`] : [],
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async function createLinkNetwork(linkId: string): Promise<LinkNetwork> {
|
|
38
|
+
const name = getLinkNetworkName(linkId);
|
|
39
|
+
const network = await createButtlerNetwork({
|
|
40
|
+
Name: name,
|
|
41
|
+
Driver: "bridge",
|
|
42
|
+
// Only the internet network of a service reaches the outside
|
|
43
|
+
Internal: true,
|
|
44
|
+
Labels: {
|
|
45
|
+
"com.docker.compose.project": "buttler",
|
|
46
|
+
[BUTTLER_NETWORK_LABEL]: LINK_NETWORK,
|
|
47
|
+
[BUTTLER_LINK_LABEL]: linkId,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
return { Id: network.id, Name: name };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getEndpoint(container: Docker.ContainerInfo, network: LinkNetwork) {
|
|
54
|
+
return container.NetworkSettings.Networks[network.Name] as Docker.EndpointSettings | undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function listContainers() {
|
|
58
|
+
return docker.listContainers({ all: true }).then(containers => {
|
|
59
|
+
return containers.filter(container => container.State !== "removing");
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Services reach each other by the name of the container, so they need no alias */
|
|
64
|
+
async function connectContainer(network: LinkNetwork, container: Docker.ContainerInfo) {
|
|
65
|
+
if (getEndpoint(container, network)?.NetworkID === network.Id) return;
|
|
66
|
+
// The container may be replaced in the meantime, the new one is connected by its own deployment
|
|
67
|
+
await ignoreStatus(docker.getNetwork(network.Id).connect({ Container: container.Id }), NOT_FOUND);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function connect(link: Link, containers: Docker.ContainerInfo[]) {
|
|
71
|
+
const network = (await listLinkNetworks(link.id)).at(0) ?? await createLinkNetwork(link.id);
|
|
72
|
+
const members = containers.filter(container => {
|
|
73
|
+
return isOwnContainer(container, link.serviceAId) || isOwnContainer(container, link.serviceBId);
|
|
74
|
+
});
|
|
75
|
+
for (const container of members) {
|
|
76
|
+
await connectContainer(network, container);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Only the containers of services are disconnected, the network is kept if others still use it */
|
|
81
|
+
async function removeNetworks(networks: LinkNetwork[], containers: Docker.ContainerInfo[]) {
|
|
82
|
+
for (const networkInfo of networks) {
|
|
83
|
+
const network = docker.getNetwork(networkInfo.Id);
|
|
84
|
+
for (const container of containers) {
|
|
85
|
+
if (!getEndpoint(container, networkInfo) || !container.Labels[BUTTLER_SERVICE_LABEL]) continue;
|
|
86
|
+
await ignoreStatus(network.disconnect({ Container: container.Id, Force: true }), NOT_FOUND);
|
|
87
|
+
}
|
|
88
|
+
await ignoreStatus(network.remove(), NOT_FOUND, FORBIDDEN);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function sync(linkId: string, links: Link[], containers: Docker.ContainerInfo[]) {
|
|
93
|
+
const link = links.find(({ id }) => id === linkId);
|
|
94
|
+
if (link) {
|
|
95
|
+
await connect(link, containers);
|
|
96
|
+
} else {
|
|
97
|
+
await removeNetworks(await listLinkNetworks(linkId), containers);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Connects the containers of a link if it's in SQLite, otherwise removes its network */
|
|
102
|
+
export function syncLinkNetwork(linkId: string): Promise<void> {
|
|
103
|
+
return enqueue(async () => {
|
|
104
|
+
// The link may have changed while waiting for other changes
|
|
105
|
+
const [
|
|
106
|
+
links,
|
|
107
|
+
containers,
|
|
108
|
+
] = await Promise.all([
|
|
109
|
+
getServiceLinks(db),
|
|
110
|
+
listContainers(),
|
|
111
|
+
]);
|
|
112
|
+
await sync(linkId, links, containers);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Connects the containers of a service to the networks of all of its links */
|
|
117
|
+
export function connectLinkNetworks(serviceId: string): Promise<void> {
|
|
118
|
+
return enqueue(async () => {
|
|
119
|
+
const [
|
|
120
|
+
links,
|
|
121
|
+
containers,
|
|
122
|
+
] = await Promise.all([
|
|
123
|
+
getServiceLinks(db, serviceId),
|
|
124
|
+
listContainers(),
|
|
125
|
+
]);
|
|
126
|
+
for (const link of links) {
|
|
127
|
+
await connect(link, containers);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Removes the networks of the links of a service that is about to be deleted with its links */
|
|
133
|
+
export function removeLinkNetworks(serviceId: string): Promise<void> {
|
|
134
|
+
return enqueue(async () => {
|
|
135
|
+
const [
|
|
136
|
+
links,
|
|
137
|
+
containers,
|
|
138
|
+
] = await Promise.all([
|
|
139
|
+
getServiceLinks(db, serviceId),
|
|
140
|
+
listContainers(),
|
|
141
|
+
]);
|
|
142
|
+
for (const link of links) {
|
|
143
|
+
await removeNetworks(await listLinkNetworks(link.id), containers);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Syncs the networks of all links, and removes the leftovers. A link that fails doesn't affect the others. */
|
|
149
|
+
export function syncLinkNetworks(): Promise<void> {
|
|
150
|
+
return enqueue(async () => {
|
|
151
|
+
const [
|
|
152
|
+
links,
|
|
153
|
+
networks,
|
|
154
|
+
containers,
|
|
155
|
+
] = await Promise.all([
|
|
156
|
+
getServiceLinks(db),
|
|
157
|
+
listLinkNetworks(),
|
|
158
|
+
listContainers(),
|
|
159
|
+
]);
|
|
160
|
+
const networkLinkIds = networks.flatMap(network => network.Labels?.[BUTTLER_LINK_LABEL] ?? []);
|
|
161
|
+
for (const linkId of new Set([...links.map(({ id }) => id), ...networkLinkIds])) {
|
|
162
|
+
try {
|
|
163
|
+
await sync(linkId, links, containers);
|
|
164
|
+
} catch (error) {
|
|
165
|
+
// eslint-disable-next-line no-console
|
|
166
|
+
console.error(`Failed to sync the network of link ${linkId}:`, error);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import os from "node:os";
|
|
2
|
+
import { docker } from "~/core/docker";
|
|
3
|
+
import { createQueue } from "~/core/queue";
|
|
4
|
+
import { findFreeSubnet } from "./subnets";
|
|
5
|
+
import type Docker from "dockerode";
|
|
6
|
+
|
|
7
|
+
/** Outside of the default pools of Docker (172.17.0.0/12, 192.168.0.0/16) and of common LANs */
|
|
8
|
+
export const BUTTLER_SUBNET_RANGE = "10.213.0.0/16";
|
|
9
|
+
|
|
10
|
+
/** Enough for 2 containers and the gateway */
|
|
11
|
+
export const BUTTLER_SUBNET_PREFIX = 29;
|
|
12
|
+
|
|
13
|
+
/** Networks are never created at the same time, otherwise they could pick the same subnet */
|
|
14
|
+
const enqueue = createQueue("network-subnet-queue");
|
|
15
|
+
|
|
16
|
+
async function listUsedSubnets() {
|
|
17
|
+
const networks = await docker.listNetworks();
|
|
18
|
+
// Docker doesn't check the networks of the host for explicit subnets
|
|
19
|
+
const hostAddresses = Object.values(os.networkInterfaces()).flatMap(addresses => addresses ?? []);
|
|
20
|
+
return [
|
|
21
|
+
...networks.flatMap(network => network.IPAM?.Config ?? []).map(config => config.Subnet),
|
|
22
|
+
...hostAddresses.map(address => address.cidr),
|
|
23
|
+
].filter(subnet => typeof subnet === "string");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Creates a network with the first free subnet of the range of Buttler, so the subnets of removed networks are reused */
|
|
27
|
+
export function createButtlerNetwork(options: Omit<Docker.NetworkCreateOptions, "IPAM">) {
|
|
28
|
+
return enqueue(async () => {
|
|
29
|
+
const subnet = findFreeSubnet(BUTTLER_SUBNET_RANGE, BUTTLER_SUBNET_PREFIX, await listUsedSubnets());
|
|
30
|
+
if (!subnet) {
|
|
31
|
+
throw new Error(`No free subnet left in ${BUTTLER_SUBNET_RANGE} for ${options.Name}`);
|
|
32
|
+
}
|
|
33
|
+
return docker.createNetwork({
|
|
34
|
+
...options,
|
|
35
|
+
IPAM: {
|
|
36
|
+
Driver: "default",
|
|
37
|
+
Config: [{ Subnet: subnet }],
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
2
|
import { BUTTLER_SERVICE_LABEL } from "./labels";
|
|
3
3
|
import {
|
|
4
|
+
ServiceDeletingError,
|
|
4
5
|
createServiceRuntimeState,
|
|
6
|
+
deployServiceContainer,
|
|
5
7
|
extractContainerIpAddresses,
|
|
6
8
|
extractContainerPorts,
|
|
7
9
|
findServiceContainer,
|
|
@@ -9,8 +11,11 @@ import {
|
|
|
9
11
|
getServiceRuntimeState,
|
|
10
12
|
getServicesRuntimeStates,
|
|
11
13
|
isServiceBuilding,
|
|
14
|
+
isServiceDeleting,
|
|
15
|
+
isServiceDeploying,
|
|
12
16
|
isServicePulling,
|
|
13
17
|
markServiceBuilding,
|
|
18
|
+
markServiceDeleting,
|
|
14
19
|
markServicePulling,
|
|
15
20
|
matchContainerForService,
|
|
16
21
|
parseContainerRuntimeStatus,
|
|
@@ -22,6 +27,7 @@ import {
|
|
|
22
27
|
import type Docker from "dockerode";
|
|
23
28
|
|
|
24
29
|
const mockContainer = {
|
|
30
|
+
id: "new-container",
|
|
25
31
|
start: vi.fn(),
|
|
26
32
|
stop: vi.fn(),
|
|
27
33
|
restart: vi.fn(),
|
|
@@ -46,6 +52,10 @@ const mockProvisionReverseProxy = vi.fn();
|
|
|
46
52
|
const mockStartGitHubService = vi.fn();
|
|
47
53
|
const mockGetBuildingServiceIds = vi.fn();
|
|
48
54
|
const mockSyncIngressNetwork = vi.fn();
|
|
55
|
+
const mockEnsureInternetNetwork = vi.fn();
|
|
56
|
+
const mockRemoveInternetNetwork = vi.fn();
|
|
57
|
+
const mockConnectLinkNetworks = vi.fn();
|
|
58
|
+
const mockHasInternetAccess = vi.fn();
|
|
49
59
|
|
|
50
60
|
vi.mock("~/core/docker", () => ({
|
|
51
61
|
docker: {
|
|
@@ -62,6 +72,20 @@ vi.mock("./ingress", () => ({
|
|
|
62
72
|
syncIngressNetwork: (...args: unknown[]) => mockSyncIngressNetwork(...args),
|
|
63
73
|
}));
|
|
64
74
|
|
|
75
|
+
vi.mock("./links", () => ({
|
|
76
|
+
connectLinkNetworks: (...args: unknown[]) => mockConnectLinkNetworks(...args),
|
|
77
|
+
}));
|
|
78
|
+
|
|
79
|
+
vi.mock("./internet", () => ({
|
|
80
|
+
ensureInternetNetwork: (...args: unknown[]) => mockEnsureInternetNetwork(...args),
|
|
81
|
+
removeInternetNetwork: (...args: unknown[]) => mockRemoveInternetNetwork(...args),
|
|
82
|
+
}));
|
|
83
|
+
|
|
84
|
+
vi.mock("~/database", () => ({ default: {} }));
|
|
85
|
+
vi.mock("~/operations/hasInternetAccess", () => ({
|
|
86
|
+
default: (...args: unknown[]) => mockHasInternetAccess(...args),
|
|
87
|
+
}));
|
|
88
|
+
|
|
65
89
|
vi.mock("./builds", () => ({
|
|
66
90
|
getBuildingServiceIds: () => mockGetBuildingServiceIds(),
|
|
67
91
|
}));
|
|
@@ -81,6 +105,8 @@ vi.mock("~/core/nginx", () => ({
|
|
|
81
105
|
describe("Docker status aggregator", () => {
|
|
82
106
|
beforeEach(() => {
|
|
83
107
|
vi.clearAllMocks();
|
|
108
|
+
mockEnsureInternetNetwork.mockImplementation((id: string) => Promise.resolve(`buttler-internet-${id}`));
|
|
109
|
+
mockHasInternetAccess.mockResolvedValue(true);
|
|
84
110
|
markServiceBuilding("srv-building", false);
|
|
85
111
|
markServiceBuilding("srv-b", false);
|
|
86
112
|
markServicePulling("srv-pulling", false);
|
|
@@ -122,6 +148,54 @@ describe("Docker status aggregator", () => {
|
|
|
122
148
|
});
|
|
123
149
|
});
|
|
124
150
|
|
|
151
|
+
describe("Deleting tracker", () => {
|
|
152
|
+
const service = { id: "srv-del", type: "dockerhub", repository: "nginx", branch: "latest" };
|
|
153
|
+
|
|
154
|
+
beforeEach(() => {
|
|
155
|
+
markServiceDeleting("srv-del", true);
|
|
156
|
+
return () => markServiceDeleting("srv-del", false);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("tracks deleting status accurately", () => {
|
|
160
|
+
expect(isServiceDeleting("srv-del")).toBe(true);
|
|
161
|
+
markServiceDeleting("srv-del", false);
|
|
162
|
+
expect(isServiceDeleting("srv-del")).toBe(false);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it.each([
|
|
166
|
+
["started", () => startServiceContainer(service)],
|
|
167
|
+
["restarted", () => restartServiceContainer(service)],
|
|
168
|
+
["pulled", () => pullAndDeployService(service)],
|
|
169
|
+
["deployed", () => deployServiceContainer(service, "nginx:latest")],
|
|
170
|
+
])("refuses to be %s", async (_, run) => {
|
|
171
|
+
await expect(run()).rejects.toThrow(ServiceDeletingError);
|
|
172
|
+
expect(mockDocker.createContainer).not.toHaveBeenCalled();
|
|
173
|
+
expect(mockContainer.stop).not.toHaveBeenCalled();
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
describe("Deploying tracker", () => {
|
|
178
|
+
it("tracks every deploy of a service until the last one ends", async () => {
|
|
179
|
+
mockDocker.listContainers.mockResolvedValue([]);
|
|
180
|
+
mockDocker.createContainer.mockResolvedValue(mockContainer);
|
|
181
|
+
let release = () => undefined as void;
|
|
182
|
+
mockSyncIngressNetwork
|
|
183
|
+
.mockResolvedValueOnce(undefined)
|
|
184
|
+
.mockReturnValueOnce(new Promise<void>(resolve => {
|
|
185
|
+
release = resolve;
|
|
186
|
+
}));
|
|
187
|
+
const service = { id: "srv-dep", type: "dockerhub", repository: "nginx", branch: "latest" };
|
|
188
|
+
const first = deployServiceContainer(service, "nginx:latest");
|
|
189
|
+
const second = deployServiceContainer(service, "nginx:latest");
|
|
190
|
+
expect(isServiceDeploying("srv-dep")).toBe(true);
|
|
191
|
+
await first;
|
|
192
|
+
expect(isServiceDeploying("srv-dep")).toBe(true);
|
|
193
|
+
release();
|
|
194
|
+
await second;
|
|
195
|
+
expect(isServiceDeploying("srv-dep")).toBe(false);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
|
|
125
199
|
describe("parseContainerRuntimeStatus", () => {
|
|
126
200
|
it("returns stopped when container is undefined", () => {
|
|
127
201
|
expect(parseContainerRuntimeStatus(undefined)).toBe("stopped");
|
|
@@ -214,6 +288,11 @@ describe("Docker status aggregator", () => {
|
|
|
214
288
|
Names: ["/named-app"],
|
|
215
289
|
Labels: {},
|
|
216
290
|
},
|
|
291
|
+
{
|
|
292
|
+
Id: "c-3",
|
|
293
|
+
Names: ["/buttler-service-srv-3"],
|
|
294
|
+
Labels: {},
|
|
295
|
+
},
|
|
217
296
|
] as unknown as Docker.ContainerInfo[];
|
|
218
297
|
|
|
219
298
|
it("matches by label", () => {
|
|
@@ -230,9 +309,14 @@ describe("Docker status aggregator", () => {
|
|
|
230
309
|
expect(matched?.Id).toBe("c-nginx");
|
|
231
310
|
});
|
|
232
311
|
|
|
233
|
-
it("matches by
|
|
312
|
+
it("matches by the service ID name", () => {
|
|
313
|
+
const matched = matchContainerForService({ id: "srv-3", name: "Unlabeled" }, containers);
|
|
314
|
+
expect(matched?.Id).toBe("c-3");
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
it("does not match a container that only has the name of the service", () => {
|
|
234
318
|
const matched = matchContainerForService({ id: "srv-unlabeled", name: "named-app" }, containers);
|
|
235
|
-
expect(matched
|
|
319
|
+
expect(matched).toBeUndefined();
|
|
236
320
|
});
|
|
237
321
|
|
|
238
322
|
it("returns undefined if no match", () => {
|
|
@@ -417,6 +501,59 @@ describe("Docker status aggregator", () => {
|
|
|
417
501
|
expect(connection).toBeLessThan(start);
|
|
418
502
|
});
|
|
419
503
|
|
|
504
|
+
it("startServiceContainer creates the container on its internet network instead of the default bridge", async () => {
|
|
505
|
+
mockDocker.listContainers.mockResolvedValue([]);
|
|
506
|
+
mockImage.inspect.mockResolvedValue({});
|
|
507
|
+
await startServiceContainer({ id: "srv-dh", type: "dockerhub", repository: "redis", branch: "alpine" });
|
|
508
|
+
expect(mockDocker.createContainer).toHaveBeenCalledWith(expect.objectContaining({
|
|
509
|
+
HostConfig: expect.objectContaining({ NetworkMode: "buttler-internet-srv-dh" }),
|
|
510
|
+
NetworkingConfig: { EndpointsConfig: { "buttler-internet-srv-dh": {} } },
|
|
511
|
+
}));
|
|
512
|
+
expect(mockRemoveInternetNetwork).not.toHaveBeenCalled();
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
it("startServiceContainer takes a container without internet access off its network before it's started", async () => {
|
|
516
|
+
mockDocker.listContainers.mockResolvedValue([]);
|
|
517
|
+
mockImage.inspect.mockResolvedValue({});
|
|
518
|
+
mockHasInternetAccess.mockResolvedValue(false);
|
|
519
|
+
await startServiceContainer({ id: "srv-dh", type: "dockerhub", repository: "redis", branch: "alpine" });
|
|
520
|
+
expect(mockRemoveInternetNetwork).toHaveBeenCalledWith("srv-dh", "new-container");
|
|
521
|
+
const [removal] = mockRemoveInternetNetwork.mock.invocationCallOrder;
|
|
522
|
+
const [start] = mockContainer.start.mock.invocationCallOrder;
|
|
523
|
+
expect(removal).toBeLessThan(start);
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
it("startServiceContainer connects the new container to its links before it's started", async () => {
|
|
527
|
+
mockDocker.listContainers.mockResolvedValue([]);
|
|
528
|
+
mockImage.inspect.mockResolvedValue({});
|
|
529
|
+
await startServiceContainer({ id: "srv-dh", type: "dockerhub", repository: "redis", branch: "alpine" });
|
|
530
|
+
expect(mockConnectLinkNetworks).toHaveBeenCalledWith("srv-dh");
|
|
531
|
+
const [, connection] = mockConnectLinkNetworks.mock.invocationCallOrder;
|
|
532
|
+
const [creation] = mockDocker.createContainer.mock.invocationCallOrder;
|
|
533
|
+
const [start] = mockContainer.start.mock.invocationCallOrder;
|
|
534
|
+
expect(connection).toBeGreaterThan(creation);
|
|
535
|
+
expect(connection).toBeLessThan(start);
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
it("startServiceContainer keeps the old container if a link network can't be created", async () => {
|
|
539
|
+
mockDocker.listContainers.mockResolvedValue([]);
|
|
540
|
+
mockImage.inspect.mockResolvedValue({});
|
|
541
|
+
mockConnectLinkNetworks.mockRejectedValueOnce(new Error("no subnet"));
|
|
542
|
+
await expect(startServiceContainer({ id: "srv-dh", type: "dockerhub", repository: "redis", branch: "alpine" }))
|
|
543
|
+
.rejects.toThrow("no subnet");
|
|
544
|
+
expect(mockDocker.createContainer).not.toHaveBeenCalled();
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
it("startServiceContainer keeps the old container if the internet network can't be created", async () => {
|
|
548
|
+
mockDocker.listContainers.mockResolvedValue([]);
|
|
549
|
+
mockImage.inspect.mockResolvedValue({});
|
|
550
|
+
mockEnsureInternetNetwork.mockRejectedValueOnce(new Error("no subnet"));
|
|
551
|
+
await expect(startServiceContainer({ id: "srv-dh", type: "dockerhub", repository: "redis", branch: "alpine" }))
|
|
552
|
+
.rejects.toThrow("no subnet");
|
|
553
|
+
expect(mockContainer.remove).not.toHaveBeenCalled();
|
|
554
|
+
expect(mockDocker.createContainer).not.toHaveBeenCalled();
|
|
555
|
+
});
|
|
556
|
+
|
|
420
557
|
it("startServiceContainer keeps the old container if the ingress network can't be created", async () => {
|
|
421
558
|
mockDocker.listContainers.mockResolvedValue([]);
|
|
422
559
|
mockImage.inspect.mockResolvedValue({});
|
|
@@ -2,10 +2,15 @@ import { docker } from "~/core/docker";
|
|
|
2
2
|
import { getServiceImageTag } from "~/core/dockerhub";
|
|
3
3
|
import { type ServiceEnvironmentVariable, getRuntimeVariables } from "~/core/environment-variables";
|
|
4
4
|
import { getSharedState } from "~/core/shared-state";
|
|
5
|
+
import db from "~/database";
|
|
5
6
|
import { TUNNEL_SERVICE_NAME } from "~/operations/getTunnelService";
|
|
7
|
+
import hasInternetAccess from "~/operations/hasInternetAccess";
|
|
6
8
|
import { getBuildingServiceIds } from "./builds";
|
|
9
|
+
import { REVERSE_PROXY_CONTAINER_NAME, isOwnContainer } from "./containers";
|
|
7
10
|
import { syncIngressNetwork } from "./ingress";
|
|
11
|
+
import { ensureInternetNetwork, removeInternetNetwork } from "./internet";
|
|
8
12
|
import { BUTTLER_SERVICE_LABEL } from "./labels";
|
|
13
|
+
import { connectLinkNetworks } from "./links";
|
|
9
14
|
import type Docker from "dockerode";
|
|
10
15
|
|
|
11
16
|
export type ContainerRuntimeStatus = "running" | "stopped" | "exited" | "building" | "pulling" | "restarting";
|
|
@@ -57,6 +62,38 @@ export function isServicePulling(serviceId: string): boolean {
|
|
|
57
62
|
return activePullServices.has(serviceId);
|
|
58
63
|
}
|
|
59
64
|
|
|
65
|
+
const deletingServices = getSharedState("deleting-services", () => new Set<string>());
|
|
66
|
+
// Counted, since the same service can be deployed by more than one request at once
|
|
67
|
+
const activeDeploys = getSharedState("active-deploys", () => new Map<string, number>());
|
|
68
|
+
|
|
69
|
+
export function markServiceDeleting(serviceId: string, isDeleting: boolean) {
|
|
70
|
+
if (isDeleting) {
|
|
71
|
+
deletingServices.add(serviceId);
|
|
72
|
+
} else {
|
|
73
|
+
deletingServices.delete(serviceId);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function isServiceDeleting(serviceId: string): boolean {
|
|
78
|
+
return deletingServices.has(serviceId);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function isServiceDeploying(serviceId: string): boolean {
|
|
82
|
+
return activeDeploys.has(serviceId);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export class ServiceDeletingError extends Error {
|
|
86
|
+
constructor(serviceId: string) {
|
|
87
|
+
super(`Service ${serviceId} is being deleted`);
|
|
88
|
+
this.name = "ServiceDeletingError";
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** A service that is being deleted must not be built, pulled, started or deployed, or it would lose its volumes */
|
|
93
|
+
export function assertServiceNotDeleting(serviceId: string) {
|
|
94
|
+
if (isServiceDeleting(serviceId)) throw new ServiceDeletingError(serviceId);
|
|
95
|
+
}
|
|
96
|
+
|
|
60
97
|
export function parseContainerRuntimeStatus(container?: Docker.ContainerInfo): ContainerRuntimeStatus {
|
|
61
98
|
if (!container) return "stopped";
|
|
62
99
|
|
|
@@ -104,23 +141,11 @@ export function matchContainerForService(
|
|
|
104
141
|
if (byLabel) return byLabel;
|
|
105
142
|
|
|
106
143
|
if (service.type === "system" && service.name === "Reverse Proxy Server") {
|
|
107
|
-
const reverseProxy = containers.find(c => c.Names.
|
|
144
|
+
const reverseProxy = containers.find(c => c.Names.includes(`/${REVERSE_PROXY_CONTAINER_NAME}`));
|
|
108
145
|
if (reverseProxy) return reverseProxy;
|
|
109
146
|
}
|
|
110
147
|
|
|
111
|
-
|
|
112
|
-
const byServiceIdName = containers.find(c => c.Names.some(n => n === `/${expectedName}` || n === expectedName));
|
|
113
|
-
if (byServiceIdName) return byServiceIdName;
|
|
114
|
-
|
|
115
|
-
if (service.name) {
|
|
116
|
-
const sanitizedName = service.name.toLowerCase().replace(/[^a-z0-9_-]/g, "-");
|
|
117
|
-
const byName = containers.find(c => c.Names.some(n => n === `/${service.name}` ||
|
|
118
|
-
n === `/${sanitizedName}` ||
|
|
119
|
-
n === `/buttler-${sanitizedName}`));
|
|
120
|
-
if (byName) return byName;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return undefined;
|
|
148
|
+
return containers.find(c => isOwnContainer(c, service.id));
|
|
124
149
|
}
|
|
125
150
|
|
|
126
151
|
export function createServiceRuntimeState(
|
|
@@ -253,6 +278,7 @@ export async function isImagePresentLocally(tag: string): Promise<boolean> {
|
|
|
253
278
|
}
|
|
254
279
|
|
|
255
280
|
export async function startServiceContainer(service: ServiceRef): Promise<void> {
|
|
281
|
+
assertServiceNotDeleting(service.id);
|
|
256
282
|
if (service.type === "system" && service.name === "Reverse Proxy Server") {
|
|
257
283
|
const { provisionReverseProxy } = await import("~/core/nginx");
|
|
258
284
|
await provisionReverseProxy();
|
|
@@ -308,6 +334,7 @@ export async function startServiceContainer(service: ServiceRef): Promise<void>
|
|
|
308
334
|
|
|
309
335
|
/** Pulls the image of a Docker Hub service and replaces its container, which keeps running until the image is ready */
|
|
310
336
|
export async function pullAndDeployService(service: ServiceRef): Promise<void> {
|
|
337
|
+
assertServiceNotDeleting(service.id);
|
|
311
338
|
// The service stays marked until the container is replaced, otherwise it would look idle in between
|
|
312
339
|
markServicePulling(service.id, true);
|
|
313
340
|
try {
|
|
@@ -325,8 +352,27 @@ export async function pullAndDeployService(service: ServiceRef): Promise<void> {
|
|
|
325
352
|
|
|
326
353
|
/** Replaces the container of a service (if there is any) with a new one that runs the given image */
|
|
327
354
|
export async function deployServiceContainer(service: ServiceRef, image: string): Promise<void> {
|
|
328
|
-
//
|
|
355
|
+
// The check and the mark are made at once, so a deletion either refuses this deploy or waits for it
|
|
356
|
+
assertServiceNotDeleting(service.id);
|
|
357
|
+
activeDeploys.set(service.id, (activeDeploys.get(service.id) ?? 0) + 1);
|
|
358
|
+
try {
|
|
359
|
+
await replaceServiceContainer(service, image);
|
|
360
|
+
} finally {
|
|
361
|
+
const count = (activeDeploys.get(service.id) ?? 1) - 1;
|
|
362
|
+
if (count > 0) {
|
|
363
|
+
activeDeploys.set(service.id, count);
|
|
364
|
+
} else {
|
|
365
|
+
activeDeploys.delete(service.id);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
async function replaceServiceContainer(service: ServiceRef, image: string) {
|
|
371
|
+
// If the networks can't be created, the old container keeps running
|
|
329
372
|
await syncIngressNetwork(service.id);
|
|
373
|
+
await connectLinkNetworks(service.id);
|
|
374
|
+
// A network given at creation replaces the default bridge network, where every container could reach the others
|
|
375
|
+
const internetNetwork = await ensureInternetNetwork(service.id);
|
|
330
376
|
|
|
331
377
|
const existingContainer = await findServiceContainer(service);
|
|
332
378
|
if (existingContainer) {
|
|
@@ -384,13 +430,21 @@ export async function deployServiceContainer(service: ServiceRef, image: string)
|
|
|
384
430
|
RestartPolicy: {
|
|
385
431
|
Name: "always",
|
|
386
432
|
},
|
|
433
|
+
NetworkMode: internetNetwork,
|
|
434
|
+
},
|
|
435
|
+
NetworkingConfig: {
|
|
436
|
+
EndpointsConfig: { [internetNetwork]: {} },
|
|
387
437
|
},
|
|
388
438
|
ExposedPorts: exposedPorts,
|
|
389
439
|
Tty: false,
|
|
390
440
|
});
|
|
391
441
|
|
|
392
|
-
// Joins the network of the new container. Networks that are given at creation would replace the default one.
|
|
393
442
|
await syncIngressNetwork(service.id);
|
|
443
|
+
await connectLinkNetworks(service.id);
|
|
444
|
+
// With NetworkMode "none" it could never join a network later, so it leaves the internet network before it starts
|
|
445
|
+
if (!await hasInternetAccess(db, service.id)) {
|
|
446
|
+
await removeInternetNetwork(service.id, container.id);
|
|
447
|
+
}
|
|
394
448
|
await container.start();
|
|
395
449
|
}
|
|
396
450
|
|
|
@@ -424,6 +478,7 @@ export async function stopServiceContainer(service: ServiceIdentity): Promise<vo
|
|
|
424
478
|
}
|
|
425
479
|
|
|
426
480
|
export async function restartServiceContainer(service: ServiceRef): Promise<void> {
|
|
481
|
+
assertServiceNotDeleting(service.id);
|
|
427
482
|
if (service.type === "system" && service.name === "Reverse Proxy Server") {
|
|
428
483
|
const { provisionReverseProxy } = await import("~/core/nginx");
|
|
429
484
|
await provisionReverseProxy();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os from "node:os";
|
|
1
2
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
3
|
import { connectProxyToTunnel, removeTunnelContainer, startTunnelContainer } from "./tunnel";
|
|
3
4
|
|
|
@@ -64,6 +65,7 @@ const newContainer = { start: vi.fn() };
|
|
|
64
65
|
describe("tunnel container", () => {
|
|
65
66
|
beforeEach(() => {
|
|
66
67
|
vi.resetAllMocks();
|
|
68
|
+
vi.spyOn(os, "networkInterfaces").mockReturnValue({});
|
|
67
69
|
mocks.listNetworks.mockResolvedValue([network]);
|
|
68
70
|
mocks.createNetwork.mockResolvedValue({ id: "net" });
|
|
69
71
|
mocks.listContainers.mockResolvedValue([proxy()]);
|
|
@@ -77,6 +79,7 @@ describe("tunnel container", () => {
|
|
|
77
79
|
Name: "buttler-tunnel",
|
|
78
80
|
Driver: "bridge",
|
|
79
81
|
Labels: { "com.docker.compose.project": "buttler", "buttler.network": "tunnel" },
|
|
82
|
+
IPAM: { Driver: "default", Config: [{ Subnet: "10.213.0.0/29" }] },
|
|
80
83
|
});
|
|
81
84
|
expect(mocks.connect).toHaveBeenCalledWith({ Container: "buttler-nginx" });
|
|
82
85
|
expect(mocks.createContainer).toHaveBeenCalledWith({
|
|
@@ -2,6 +2,7 @@ import { docker, pullImage } from "~/core/docker";
|
|
|
2
2
|
import { REVERSE_PROXY_CONTAINER_NAME } from "./containers";
|
|
3
3
|
import { FORBIDDEN, NOT_FOUND, NOT_MODIFIED, ignoreStatus } from "./errors";
|
|
4
4
|
import { BUTTLER_NETWORK_LABEL, BUTTLER_SERVICE_LABEL, BUTTLER_TUNNEL_LABEL } from "./labels";
|
|
5
|
+
import { createButtlerNetwork } from "./networks";
|
|
5
6
|
import type Docker from "dockerode";
|
|
6
7
|
|
|
7
8
|
export const TUNNEL_CONTAINER_NAME = "buttler-cloudflared";
|
|
@@ -28,7 +29,7 @@ async function findNetwork() {
|
|
|
28
29
|
async function ensureNetwork() {
|
|
29
30
|
const existing = await findNetwork();
|
|
30
31
|
if (existing) return { id: existing.Id, name: existing.Name };
|
|
31
|
-
const { id } = await
|
|
32
|
+
const { id } = await createButtlerNetwork({
|
|
32
33
|
Name: TUNNEL_NETWORK_NAME,
|
|
33
34
|
Driver: "bridge",
|
|
34
35
|
Labels: {
|
package/ui/src/core/docker.ts
CHANGED
|
@@ -211,24 +211,6 @@ export async function createVolume(name: string) {
|
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
export async function createNetwork(networkId: string, containerIds: string[] = []) {
|
|
215
|
-
const network = await docker.createNetwork({
|
|
216
|
-
Name: networkId,
|
|
217
|
-
Driver: "bridge",
|
|
218
|
-
CheckDuplicate: true,
|
|
219
|
-
Internal: false,
|
|
220
|
-
Attachable: true,
|
|
221
|
-
});
|
|
222
|
-
await Promise.all(containerIds.map(containerId => connectContainerToNetwork(containerId, network.id)));
|
|
223
|
-
return network;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export async function destroyNetwork(networkId: string, containerIds: string[] = []) {
|
|
227
|
-
const network = docker.getNetwork(networkId);
|
|
228
|
-
await Promise.all(containerIds.map(containerId => disconnectContainerFromNetwork(containerId, network.id)));
|
|
229
|
-
await network.remove();
|
|
230
|
-
}
|
|
231
|
-
|
|
232
214
|
async function connectContainerToNetwork(containerId: string, networkId: string) {
|
|
233
215
|
const network = docker.getNetwork(networkId);
|
|
234
216
|
await network.connect({
|
|
@@ -236,14 +218,6 @@ async function connectContainerToNetwork(containerId: string, networkId: string)
|
|
|
236
218
|
});
|
|
237
219
|
}
|
|
238
220
|
|
|
239
|
-
async function disconnectContainerFromNetwork(containerId: string, networkId: string) {
|
|
240
|
-
const network = docker.getNetwork(networkId);
|
|
241
|
-
await network.disconnect({
|
|
242
|
-
Container: containerId,
|
|
243
|
-
// Force: true, // is this necessary?
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
|
|
247
221
|
export async function getHostIp() {
|
|
248
222
|
const network = docker.getNetwork("bridge");
|
|
249
223
|
const inspection = await network.inspect();
|
package/ui/src/core/env.ts
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"devFiles": [],
|
|
3
|
-
"ampDevFiles": [],
|
|
4
|
-
"polyfillFiles": [],
|
|
5
|
-
"lowPriorityFiles": [],
|
|
6
|
-
"rootMainFiles": [],
|
|
7
|
-
"pages": {},
|
|
8
|
-
"ampFirstPages": [],
|
|
9
|
-
"rootMainFilesTree": {},
|
|
10
|
-
"pagesChunkGroupBootstrapParams": {},
|
|
11
|
-
"chunkLoadingGlobal": "TURBOPACK"
|
|
12
|
-
}
|