@geekmidas/cli 10.0.0-alpha.12 → 10.0.0-alpha.120
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/README.md +310 -377
- package/bin/adjacent-tsconfig.mjs +46 -8
- package/bin/gkm.mjs +11 -3
- package/bin/owning-tsconfig-jsx-register.mjs +18 -0
- package/bin/owning-tsconfig-jsx.mjs +108 -0
- package/dist/EndpointGenerator-BDa6pPgE.cjs +1090 -0
- package/dist/EndpointGenerator-BDa6pPgE.cjs.map +1 -0
- package/dist/EndpointGenerator-CP_z_E3e.mjs +1031 -0
- package/dist/EndpointGenerator-CP_z_E3e.mjs.map +1 -0
- package/dist/GoDaddyProvider-3C8U_tVu.cjs +388 -0
- package/dist/GoDaddyProvider-3C8U_tVu.cjs.map +1 -0
- package/dist/GoDaddyProvider-D0MQoOM4.mjs +388 -0
- package/dist/GoDaddyProvider-D0MQoOM4.mjs.map +1 -0
- package/dist/{HostingerProvider-BcyFRbqV.mjs → HostingerProvider-BNpS9aRJ.mjs} +29 -25
- package/dist/HostingerProvider-BNpS9aRJ.mjs.map +1 -0
- package/dist/{HostingerProvider-BOvsgATO.cjs → HostingerProvider-DR1iws1P.cjs} +29 -25
- package/dist/HostingerProvider-DR1iws1P.cjs.map +1 -0
- package/dist/LegacyStateStore-CRi7TosX.mjs +124 -0
- package/dist/LegacyStateStore-CRi7TosX.mjs.map +1 -0
- package/dist/LegacyStateStore-DHsoQGOo.cjs +124 -0
- package/dist/LegacyStateStore-DHsoQGOo.cjs.map +1 -0
- package/dist/LocalStateStore-BQXTkeoS.cjs +178 -0
- package/dist/LocalStateStore-BQXTkeoS.cjs.map +1 -0
- package/dist/LocalStateStore-Dkth0jXX.mjs +167 -0
- package/dist/LocalStateStore-Dkth0jXX.mjs.map +1 -0
- package/dist/OpenApiTsGenerator-CsrukCE-.mjs +536 -0
- package/dist/OpenApiTsGenerator-CsrukCE-.mjs.map +1 -0
- package/dist/OpenApiTsGenerator-FNhY7Ssz.cjs +541 -0
- package/dist/OpenApiTsGenerator-FNhY7Ssz.cjs.map +1 -0
- package/dist/{Route53Provider-CH9XH7bz.cjs → Route53Provider-Bllus2NR.cjs} +21 -22
- package/dist/Route53Provider-Bllus2NR.cjs.map +1 -0
- package/dist/{Route53Provider-C0xmer8U.mjs → Route53Provider-QXxjkZO1.mjs} +13 -13
- package/dist/Route53Provider-QXxjkZO1.mjs.map +1 -0
- package/dist/S3StateStore-DGKZgyKz.cjs +222 -0
- package/dist/S3StateStore-DGKZgyKz.cjs.map +1 -0
- package/dist/S3StateStore-pZZnLLBd.mjs +223 -0
- package/dist/S3StateStore-pZZnLLBd.mjs.map +1 -0
- package/dist/SSMStateStore-CZRMERDA.mjs +205 -0
- package/dist/SSMStateStore-CZRMERDA.mjs.map +1 -0
- package/dist/SSMStateStore-DzkyjQ5D.cjs +204 -0
- package/dist/SSMStateStore-DzkyjQ5D.cjs.map +1 -0
- package/dist/SubscriberGenerator-C8CPxrCK.cjs +592 -0
- package/dist/SubscriberGenerator-C8CPxrCK.cjs.map +1 -0
- package/dist/SubscriberGenerator-y3pncae_.mjs +533 -0
- package/dist/SubscriberGenerator-y3pncae_.mjs.map +1 -0
- package/dist/add-C0kXOsWS.mjs +717 -0
- package/dist/add-C0kXOsWS.mjs.map +1 -0
- package/dist/add-Df8cmz0H.cjs +719 -0
- package/dist/add-Df8cmz0H.cjs.map +1 -0
- package/dist/appPorts-BoXMwolc.mjs +249 -0
- package/dist/appPorts-BoXMwolc.mjs.map +1 -0
- package/dist/appPorts-IW-OZmRi.cjs +296 -0
- package/dist/appPorts-IW-OZmRi.cjs.map +1 -0
- package/dist/aws-8QQ8n-t6.mjs +89 -0
- package/dist/aws-8QQ8n-t6.mjs.map +1 -0
- package/dist/aws-DY9NqQIT.cjs +100 -0
- package/dist/aws-DY9NqQIT.cjs.map +1 -0
- package/dist/awsStore-Bx5nCFnS.mjs +121 -0
- package/dist/awsStore-Bx5nCFnS.mjs.map +1 -0
- package/dist/awsStore-u3ehhMoY.cjs +138 -0
- package/dist/awsStore-u3ehhMoY.cjs.map +1 -0
- package/dist/{backup-provisioner-DXXg6FIL.mjs → backup-provisioner-C8DnCmxK.mjs} +11 -8
- package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
- package/dist/{backup-provisioner-cE2PuCTb.cjs → backup-provisioner-oDEsPj02.cjs} +22 -20
- package/dist/backup-provisioner-oDEsPj02.cjs.map +1 -0
- package/dist/backups/runner.cjs +519 -0
- package/dist/backups/runner.cjs.map +1 -0
- package/dist/backups/runner.d.cts +102 -0
- package/dist/backups/runner.d.cts.map +1 -0
- package/dist/backups/runner.d.mts +102 -0
- package/dist/backups/runner.d.mts.map +1 -0
- package/dist/backups/runner.mjs +506 -0
- package/dist/backups/runner.mjs.map +1 -0
- package/dist/{bundler-Bux2iF-v.mjs → bundler-B-I4Du99.mjs} +35 -16
- package/dist/bundler-B-I4Du99.mjs.map +1 -0
- package/dist/{bundler-BMekgx7a.cjs → bundler-Dx_grUmc.cjs} +37 -19
- package/dist/bundler-Dx_grUmc.cjs.map +1 -0
- package/dist/cli-Cd9exatJ.cjs +71 -0
- package/dist/cli-Cd9exatJ.cjs.map +1 -0
- package/dist/cli-DL7GxGAe.mjs +71 -0
- package/dist/cli-DL7GxGAe.mjs.map +1 -0
- package/dist/compose-C43c03WZ.mjs +3284 -0
- package/dist/compose-C43c03WZ.mjs.map +1 -0
- package/dist/compose-Mdgea4Yt.cjs +3427 -0
- package/dist/compose-Mdgea4Yt.cjs.map +1 -0
- package/dist/config-D48erO2j.d.mts +269 -0
- package/dist/config-D48erO2j.d.mts.map +1 -0
- package/dist/config-DHDtsQrB.d.cts +269 -0
- package/dist/config-DHDtsQrB.d.cts.map +1 -0
- package/dist/config.cjs +421 -11
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +4 -120
- package/dist/config.d.mts +4 -120
- package/dist/config.mjs +405 -4
- package/dist/config.mjs.map +1 -0
- package/dist/credentialSchemas-B67WJOOm.cjs +272 -0
- package/dist/credentialSchemas-B67WJOOm.cjs.map +1 -0
- package/dist/credentialSchemas-DDOLRCLF.mjs +237 -0
- package/dist/credentialSchemas-DDOLRCLF.mjs.map +1 -0
- package/dist/credentials-B5N5yKk6.mjs +267 -0
- package/dist/credentials-B5N5yKk6.mjs.map +1 -0
- package/dist/credentials-Zqr3QQYB.cjs +350 -0
- package/dist/credentials-Zqr3QQYB.cjs.map +1 -0
- package/dist/databases-BPOgTn1u.mjs +522 -0
- package/dist/databases-BPOgTn1u.mjs.map +1 -0
- package/dist/databases-fOaoBInm.cjs +625 -0
- package/dist/databases-fOaoBInm.cjs.map +1 -0
- package/dist/define-6poNqm5O.mjs +106 -0
- package/dist/define-6poNqm5O.mjs.map +1 -0
- package/dist/define-crmMcXFS.cjs +153 -0
- package/dist/define-crmMcXFS.cjs.map +1 -0
- package/dist/deploy/public.cjs +212 -0
- package/dist/deploy/public.cjs.map +1 -0
- package/dist/deploy/public.d.cts +654 -0
- package/dist/deploy/public.d.cts.map +1 -0
- package/dist/deploy/public.d.mts +654 -0
- package/dist/deploy/public.d.mts.map +1 -0
- package/dist/deploy/public.mjs +145 -0
- package/dist/deploy/public.mjs.map +1 -0
- package/dist/deploy/sniffer-envkit-patch.cjs +18 -10
- package/dist/deploy/sniffer-envkit-patch.cjs.map +1 -1
- package/dist/deploy/sniffer-envkit-patch.d.cts +0 -2
- package/dist/deploy/sniffer-envkit-patch.d.cts.map +1 -1
- package/dist/deploy/sniffer-envkit-patch.d.mts +0 -2
- package/dist/deploy/sniffer-envkit-patch.d.mts.map +1 -1
- package/dist/deploy/sniffer-envkit-patch.mjs +10 -2
- package/dist/deploy/sniffer-envkit-patch.mjs.map +1 -1
- package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
- package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
- package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
- package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
- package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
- package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
- package/dist/deploy/sniffer-hooks.cjs +13 -7
- package/dist/deploy/sniffer-hooks.cjs.map +1 -1
- package/dist/deploy/sniffer-hooks.d.cts +1 -2
- package/dist/deploy/sniffer-hooks.d.cts.map +1 -1
- package/dist/deploy/sniffer-hooks.d.mts +1 -2
- package/dist/deploy/sniffer-hooks.d.mts.map +1 -1
- package/dist/deploy/sniffer-hooks.mjs +10 -3
- package/dist/deploy/sniffer-hooks.mjs.map +1 -1
- package/dist/deploy/sniffer-loader.cjs +16 -7
- package/dist/deploy/sniffer-loader.cjs.map +1 -1
- package/dist/deploy/sniffer-loader.d.cts +1 -1
- package/dist/deploy/sniffer-loader.d.mts +1 -1
- package/dist/deploy/sniffer-loader.mjs +14 -3
- package/dist/deploy/sniffer-loader.mjs.map +1 -1
- package/dist/deploy/sniffer-routes-worker.cjs +11 -11
- package/dist/deploy/sniffer-routes-worker.cjs.map +1 -1
- package/dist/deploy/sniffer-routes-worker.d.cts +1 -1
- package/dist/deploy/sniffer-routes-worker.d.mts +1 -1
- package/dist/deploy/sniffer-routes-worker.mjs +4 -4
- package/dist/deploy/sniffer-routes-worker.mjs.map +1 -1
- package/dist/deploy/sniffer-worker.cjs +15 -6
- package/dist/deploy/sniffer-worker.cjs.map +1 -1
- package/dist/deploy/sniffer-worker.d.cts +1 -3
- package/dist/deploy/sniffer-worker.d.cts.map +1 -1
- package/dist/deploy/sniffer-worker.d.mts +1 -3
- package/dist/deploy/sniffer-worker.d.mts.map +1 -1
- package/dist/deploy/sniffer-worker.mjs +15 -4
- package/dist/deploy/sniffer-worker.mjs.map +1 -1
- package/dist/deploy-BMM2hx-K.cjs +2401 -0
- package/dist/deploy-BMM2hx-K.cjs.map +1 -0
- package/dist/deploy-D5YhwDng.mjs +2328 -0
- package/dist/deploy-D5YhwDng.mjs.map +1 -0
- package/dist/derive-B4vDpzgP.mjs +150 -0
- package/dist/derive-B4vDpzgP.mjs.map +1 -0
- package/dist/derive-DAbo49sm.cjs +161 -0
- package/dist/derive-DAbo49sm.cjs.map +1 -0
- package/dist/discover-C5roJuc9.mjs +560 -0
- package/dist/discover-C5roJuc9.mjs.map +1 -0
- package/dist/discover-CSW_BMWa.d.cts +125 -0
- package/dist/discover-CSW_BMWa.d.cts.map +1 -0
- package/dist/discover-DozUKs8f.cjs +639 -0
- package/dist/discover-DozUKs8f.cjs.map +1 -0
- package/dist/discover-xtT7fgWg.d.mts +125 -0
- package/dist/discover-xtT7fgWg.d.mts.map +1 -0
- package/dist/dns-BIYf20p7.cjs +1057 -0
- package/dist/dns-BIYf20p7.cjs.map +1 -0
- package/dist/dns-agf2VCdV.mjs +926 -0
- package/dist/dns-agf2VCdV.mjs.map +1 -0
- package/dist/dokploy-2p4PK6ej.mjs +38 -0
- package/dist/dokploy-2p4PK6ej.mjs.map +1 -0
- package/dist/dokploy-BANMTroy.cjs +38 -0
- package/dist/dokploy-BANMTroy.cjs.map +1 -0
- package/dist/drivers-BjGDYfnC.mjs +195 -0
- package/dist/drivers-BjGDYfnC.mjs.map +1 -0
- package/dist/drivers-DbjiYpW6.cjs +224 -0
- package/dist/drivers-DbjiYpW6.cjs.map +1 -0
- package/dist/eas-CNi16SoO.cjs +337 -0
- package/dist/eas-CNi16SoO.cjs.map +1 -0
- package/dist/eas-iT2JDHCh.mjs +334 -0
- package/dist/eas-iT2JDHCh.mjs.map +1 -0
- package/dist/{emit-CIlvnDvV.mjs → emit-C1e8qD08.mjs} +13 -26
- package/dist/emit-C1e8qD08.mjs.map +1 -0
- package/dist/{emit-CUD1BWls.cjs → emit-Dmc1nvdS.cjs} +31 -57
- package/dist/emit-Dmc1nvdS.cjs.map +1 -0
- package/dist/encryption-DkXVbyZc.mjs +89 -0
- package/dist/encryption-DkXVbyZc.mjs.map +1 -0
- package/dist/encryption-d2lLtkYx.cjs +90 -0
- package/dist/encryption-d2lLtkYx.cjs.map +1 -0
- package/dist/engine-CatKW6E-.mjs +3089 -0
- package/dist/engine-CatKW6E-.mjs.map +1 -0
- package/dist/engine-DlEHexED.cjs +3202 -0
- package/dist/engine-DlEHexED.cjs.map +1 -0
- package/dist/errors-D8Gwp5kU.mjs +23 -0
- package/dist/errors-D8Gwp5kU.mjs.map +1 -0
- package/dist/errors-DMC4Umsb.cjs +34 -0
- package/dist/errors-DMC4Umsb.cjs.map +1 -0
- package/dist/github-BAeaC1Pl.cjs +833 -0
- package/dist/github-BAeaC1Pl.cjs.map +1 -0
- package/dist/github-DErsqKGN.mjs +832 -0
- package/dist/github-DErsqKGN.mjs.map +1 -0
- package/dist/googlePlay-BVcfFWRO.cjs +931 -0
- package/dist/googlePlay-BVcfFWRO.cjs.map +1 -0
- package/dist/googlePlay-BXJ5ZjMK.mjs +931 -0
- package/dist/googlePlay-BXJ5ZjMK.mjs.map +1 -0
- package/dist/identity-CBXr4wNi.mjs +129 -0
- package/dist/identity-CBXr4wNi.mjs.map +1 -0
- package/dist/identity-CbLfgQNT.cjs +182 -0
- package/dist/identity-CbLfgQNT.cjs.map +1 -0
- package/dist/{index-BzJ7QJ9c.d.mts → index-8OfpOtSI.d.cts} +39 -20
- package/dist/index-8OfpOtSI.d.cts.map +1 -0
- package/dist/{index-CfMjtdVC.d.cts → index-Dpji6Bxq.d.mts} +39 -20
- package/dist/index-Dpji6Bxq.d.mts.map +1 -0
- package/dist/index.cjs +14291 -11898
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +13938 -11560
- package/dist/index.mjs.map +1 -1
- package/dist/local-BwC2v2Y8.mjs +224 -0
- package/dist/local-BwC2v2Y8.mjs.map +1 -0
- package/dist/local-DNhnkugT.cjs +241 -0
- package/dist/local-DNhnkugT.cjs.map +1 -0
- package/dist/migrate-Bb1MmGHl.mjs +181 -0
- package/dist/migrate-Bb1MmGHl.mjs.map +1 -0
- package/dist/migrate-D79GI0XM.cjs +271 -0
- package/dist/migrate-D79GI0XM.cjs.map +1 -0
- package/dist/migrate-L4a273dY.cjs +181 -0
- package/dist/migrate-L4a273dY.cjs.map +1 -0
- package/dist/migrate-s4QizIoM.mjs +266 -0
- package/dist/migrate-s4QizIoM.mjs.map +1 -0
- package/dist/openapi.cjs +214 -10
- package/dist/openapi.cjs.map +1 -0
- package/dist/openapi.d.cts +38 -17
- package/dist/openapi.d.cts.map +1 -1
- package/dist/openapi.d.mts +38 -17
- package/dist/openapi.d.mts.map +1 -1
- package/dist/openapi.mjs +208 -5
- package/dist/openapi.mjs.map +1 -0
- package/dist/projectBucket-BBbQ1lHF.cjs +263 -0
- package/dist/projectBucket-BBbQ1lHF.cjs.map +1 -0
- package/dist/projectBucket-C_DN4WzF.mjs +222 -0
- package/dist/projectBucket-C_DN4WzF.mjs.map +1 -0
- package/dist/provider-BqpjG9QM.cjs +57 -0
- package/dist/provider-BqpjG9QM.cjs.map +1 -0
- package/dist/provider-CEOKk8NS.mjs +46 -0
- package/dist/provider-CEOKk8NS.mjs.map +1 -0
- package/dist/publish-CcTlmJT6.mjs +123 -0
- package/dist/publish-CcTlmJT6.mjs.map +1 -0
- package/dist/publish-ydscCYsW.cjs +124 -0
- package/dist/publish-ydscCYsW.cjs.map +1 -0
- package/dist/ready-BFFP838V.cjs +404 -0
- package/dist/ready-BFFP838V.cjs.map +1 -0
- package/dist/ready-BOfogqzr.mjs +375 -0
- package/dist/ready-BOfogqzr.mjs.map +1 -0
- package/dist/reconcile/public.cjs +3 -5
- package/dist/reconcile/public.d.cts +11 -87
- package/dist/reconcile/public.d.cts.map +1 -1
- package/dist/reconcile/public.d.mts +11 -87
- package/dist/reconcile/public.d.mts.map +1 -1
- package/dist/reconcile/public.mjs +3 -4
- package/dist/{reconcile-BI0tWkwz.mjs → reconcile--I7V4Klj.mjs} +4 -7
- package/dist/reconcile--I7V4Klj.mjs.map +1 -0
- package/dist/{reconcile-Bhw5fmKu.cjs → reconcile-CuCQBa5-.cjs} +5 -8
- package/dist/reconcile-CuCQBa5-.cjs.map +1 -0
- package/dist/resolve-BLp2trep.mjs +263 -0
- package/dist/resolve-BLp2trep.mjs.map +1 -0
- package/dist/resolve-BgL-brF9.cjs +316 -0
- package/dist/resolve-BgL-brF9.cjs.map +1 -0
- package/dist/rollback-2cyLXEH1.cjs +165 -0
- package/dist/rollback-2cyLXEH1.cjs.map +1 -0
- package/dist/rollback-DwqZ8zzj.mjs +136 -0
- package/dist/rollback-DwqZ8zzj.mjs.map +1 -0
- package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
- package/dist/{chunk-CUT6urMc.cjs → rolldown-runtime-C0BPl7ul.cjs} +23 -10
- package/dist/run-BJLIerMM.mjs +133 -0
- package/dist/run-BJLIerMM.mjs.map +1 -0
- package/dist/run-fVZ-rLnc.cjs +174 -0
- package/dist/run-fVZ-rLnc.cjs.map +1 -0
- package/dist/runtime-ACdfK59n.d.cts +82 -0
- package/dist/runtime-ACdfK59n.d.cts.map +1 -0
- package/dist/runtime-YyQuekxi.d.mts +82 -0
- package/dist/runtime-YyQuekxi.d.mts.map +1 -0
- package/dist/s3-CrPoA89T.cjs +215 -0
- package/dist/s3-CrPoA89T.cjs.map +1 -0
- package/dist/s3-DQXZdmCM.mjs +215 -0
- package/dist/s3-DQXZdmCM.mjs.map +1 -0
- package/dist/sandbox/config-worker.cjs +43 -0
- package/dist/sandbox/config-worker.cjs.map +1 -0
- package/dist/sandbox/config-worker.d.cts +1 -0
- package/dist/sandbox/config-worker.d.mts +1 -0
- package/dist/sandbox/config-worker.mjs +44 -0
- package/dist/sandbox/config-worker.mjs.map +1 -0
- package/dist/sandbox/credentials-worker.cjs +54 -0
- package/dist/sandbox/credentials-worker.cjs.map +1 -0
- package/dist/sandbox/credentials-worker.d.cts +1 -0
- package/dist/sandbox/credentials-worker.d.mts +1 -0
- package/dist/sandbox/credentials-worker.mjs +55 -0
- package/dist/sandbox/credentials-worker.mjs.map +1 -0
- package/dist/sandbox/discover-worker.cjs +50 -0
- package/dist/sandbox/discover-worker.cjs.map +1 -0
- package/dist/sandbox/discover-worker.d.cts +1 -0
- package/dist/sandbox/discover-worker.d.mts +1 -0
- package/dist/sandbox/discover-worker.mjs +51 -0
- package/dist/sandbox/discover-worker.mjs.map +1 -0
- package/dist/sandbox/migrate-worker.cjs +75 -0
- package/dist/sandbox/migrate-worker.cjs.map +1 -0
- package/dist/sandbox/migrate-worker.d.cts +1 -0
- package/dist/sandbox/migrate-worker.d.mts +1 -0
- package/dist/sandbox/migrate-worker.mjs +76 -0
- package/dist/sandbox/migrate-worker.mjs.map +1 -0
- package/dist/sandbox-C4g1eG31.d.mts +104 -0
- package/dist/sandbox-C4g1eG31.d.mts.map +1 -0
- package/dist/sandbox-CHv3OYXg.cjs +165 -0
- package/dist/sandbox-CHv3OYXg.cjs.map +1 -0
- package/dist/sandbox-CbVB7uOD.mjs +118 -0
- package/dist/sandbox-CbVB7uOD.mjs.map +1 -0
- package/dist/sandbox-CdKgQ3XU.d.cts +104 -0
- package/dist/sandbox-CdKgQ3XU.d.cts.map +1 -0
- package/dist/{workspace-DPV7FtAv.cjs → schemas-BCwKKA42.mjs} +958 -1816
- package/dist/schemas-BCwKKA42.mjs.map +1 -0
- package/dist/{workspace-CtnZnWsa.mjs → schemas-BQ_v0lEX.cjs} +1048 -1626
- package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
- package/dist/secretsManager-CQORubp9.mjs +97 -0
- package/dist/secretsManager-CQORubp9.mjs.map +1 -0
- package/dist/secretsManager-RAGcEDX1.cjs +108 -0
- package/dist/secretsManager-RAGcEDX1.cjs.map +1 -0
- package/dist/seeds-C2w4UqVP.cjs +9347 -0
- package/dist/seeds-C2w4UqVP.cjs.map +1 -0
- package/dist/seeds-Cwtv-U9-.mjs +8350 -0
- package/dist/seeds-Cwtv-U9-.mjs.map +1 -0
- package/dist/serverSetup-CKs4K9gD.cjs +630 -0
- package/dist/serverSetup-CKs4K9gD.cjs.map +1 -0
- package/dist/serverSetup-P68H5Lal.mjs +630 -0
- package/dist/serverSetup-P68H5Lal.mjs.map +1 -0
- package/dist/sniffer-8C4q6Szd.mjs +1825 -0
- package/dist/sniffer-8C4q6Szd.mjs.map +1 -0
- package/dist/sniffer-CF7wNxMo.cjs +1998 -0
- package/dist/sniffer-CF7wNxMo.cjs.map +1 -0
- package/dist/sst-B-Uz4cvm.cjs +464 -0
- package/dist/sst-B-Uz4cvm.cjs.map +1 -0
- package/dist/sst-C1pxbFEd.mjs +441 -0
- package/dist/sst-C1pxbFEd.mjs.map +1 -0
- package/dist/stage-BvM_u2z4.mjs +302 -0
- package/dist/stage-BvM_u2z4.mjs.map +1 -0
- package/dist/stage-DEQJGW3r.cjs +313 -0
- package/dist/stage-DEQJGW3r.cjs.map +1 -0
- package/dist/stages-Cb9rqRbN.mjs +190 -0
- package/dist/stages-Cb9rqRbN.mjs.map +1 -0
- package/dist/stages-D4SnG5yl.cjs +190 -0
- package/dist/stages-D4SnG5yl.cjs.map +1 -0
- package/dist/target/public.cjs +15 -0
- package/dist/target/public.d.cts +28 -0
- package/dist/target/public.d.cts.map +1 -0
- package/dist/target/public.d.mts +28 -0
- package/dist/target/public.d.mts.map +1 -0
- package/dist/target/public.mjs +4 -0
- package/dist/terminal-CW_dWeTe.mjs +85 -0
- package/dist/terminal-CW_dWeTe.mjs.map +1 -0
- package/dist/terminal-DJlqcW_U.cjs +85 -0
- package/dist/terminal-DJlqcW_U.cjs.map +1 -0
- package/dist/types-B6UXlEkf.d.cts +7650 -0
- package/dist/types-B6UXlEkf.d.cts.map +1 -0
- package/dist/types-HqVPddRK.d.mts +7649 -0
- package/dist/types-HqVPddRK.d.mts.map +1 -0
- package/dist/utils-D2Nk1Nv2.cjs +205 -0
- package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
- package/dist/utils-D_fxUqvU.mjs +156 -0
- package/dist/utils-D_fxUqvU.mjs.map +1 -0
- package/dist/vitest.cjs +65 -0
- package/dist/vitest.cjs.map +1 -0
- package/dist/vitest.d.cts +29 -0
- package/dist/vitest.d.cts.map +1 -0
- package/dist/vitest.d.mts +29 -0
- package/dist/vitest.d.mts.map +1 -0
- package/dist/vitest.mjs +65 -0
- package/dist/vitest.mjs.map +1 -0
- package/dist/workerRuntime-BXfhbe13.cjs +108 -0
- package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
- package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
- package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
- package/dist/workspace/index.cjs +8 -4
- package/dist/workspace/index.d.cts +3 -3
- package/dist/workspace/index.d.mts +3 -3
- package/dist/workspace/index.mjs +2 -3
- package/dist/workspace-BwqQnool.cjs +2806 -0
- package/dist/workspace-BwqQnool.cjs.map +1 -0
- package/dist/workspace-D1QbNd55.mjs +2394 -0
- package/dist/workspace-D1QbNd55.mjs.map +1 -0
- package/package.json +54 -22
- package/dist/CachedStateProvider-BEBl2wQT.cjs +0 -60
- package/dist/CachedStateProvider-BEBl2wQT.cjs.map +0 -1
- package/dist/CachedStateProvider-C-8wtlto.mjs +0 -3
- package/dist/CachedStateProvider-Co4n5Wvs.mjs +0 -54
- package/dist/CachedStateProvider-Co4n5Wvs.mjs.map +0 -1
- package/dist/CachedStateProvider-DqhGpzsm.cjs +0 -3
- package/dist/HostingerProvider-BOvsgATO.cjs.map +0 -1
- package/dist/HostingerProvider-BcyFRbqV.mjs.map +0 -1
- package/dist/LocalStateProvider-Bq-0C0sg.mjs +0 -42
- package/dist/LocalStateProvider-Bq-0C0sg.mjs.map +0 -1
- package/dist/LocalStateProvider-yjXZXZDM.cjs +0 -43
- package/dist/LocalStateProvider-yjXZXZDM.cjs.map +0 -1
- package/dist/Route53Provider-C0xmer8U.mjs.map +0 -1
- package/dist/Route53Provider-CH9XH7bz.cjs.map +0 -1
- package/dist/SSMStateProvider-CXtNgPfy.cjs +0 -66
- package/dist/SSMStateProvider-CXtNgPfy.cjs.map +0 -1
- package/dist/SSMStateProvider-DOZifZfE.mjs +0 -66
- package/dist/SSMStateProvider-DOZifZfE.mjs.map +0 -1
- package/dist/backup-provisioner-DXXg6FIL.mjs.map +0 -1
- package/dist/backup-provisioner-cE2PuCTb.cjs.map +0 -1
- package/dist/bundler-BMekgx7a.cjs.map +0 -1
- package/dist/bundler-Bux2iF-v.mjs.map +0 -1
- package/dist/chunk-Duj1WY3L.mjs +0 -7
- package/dist/config-DTsVjKZD.mjs +0 -402
- package/dist/config-DTsVjKZD.mjs.map +0 -1
- package/dist/config-RYR9j6EF.cjs +0 -462
- package/dist/config-RYR9j6EF.cjs.map +0 -1
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts.map +0 -1
- package/dist/credentials-B5zRHdAl.mjs +0 -141
- package/dist/credentials-B5zRHdAl.mjs.map +0 -1
- package/dist/credentials-BapzjyV5.cjs +0 -195
- package/dist/credentials-BapzjyV5.cjs.map +0 -1
- package/dist/credentials-DQRvPz2S.cjs +0 -2769
- package/dist/credentials-DQRvPz2S.cjs.map +0 -1
- package/dist/credentials-jMJC63qs.mjs +0 -2625
- package/dist/credentials-jMJC63qs.mjs.map +0 -1
- package/dist/discover-BYHQwQqu.mjs +0 -242
- package/dist/discover-BYHQwQqu.mjs.map +0 -1
- package/dist/discover-DmW9Bscc.cjs +0 -290
- package/dist/discover-DmW9Bscc.cjs.map +0 -1
- package/dist/dokploy-api-5cK2InBm.cjs +0 -3
- package/dist/dokploy-api-D2Ny4Jrc.mjs +0 -3
- package/dist/dokploy-api-pdaBryoY.mjs +0 -706
- package/dist/dokploy-api-pdaBryoY.mjs.map +0 -1
- package/dist/dokploy-api-zqKe9lHH.cjs +0 -718
- package/dist/dokploy-api-zqKe9lHH.cjs.map +0 -1
- package/dist/emit-CIlvnDvV.mjs.map +0 -1
- package/dist/emit-CUD1BWls.cjs.map +0 -1
- package/dist/encryption-D2pL3tHH.cjs +0 -54
- package/dist/encryption-D2pL3tHH.cjs.map +0 -1
- package/dist/encryption-YDsXXi6w.mjs +0 -3
- package/dist/encryption-_4zwjOAR.mjs +0 -42
- package/dist/encryption-_4zwjOAR.mjs.map +0 -1
- package/dist/encryption-sQ2Oxx0d.cjs +0 -4
- package/dist/fullstack-secrets-B6KBHf-g.mjs +0 -87
- package/dist/fullstack-secrets-B6KBHf-g.mjs.map +0 -1
- package/dist/fullstack-secrets-DL8v0y4D.cjs +0 -99
- package/dist/fullstack-secrets-DL8v0y4D.cjs.map +0 -1
- package/dist/generator-CNzBw7g5.cjs +0 -289
- package/dist/generator-CNzBw7g5.cjs.map +0 -1
- package/dist/generator-VE2JrFlY.mjs +0 -253
- package/dist/generator-VE2JrFlY.mjs.map +0 -1
- package/dist/github-BThvbf2W.cjs +0 -197
- package/dist/github-BThvbf2W.cjs.map +0 -1
- package/dist/github-DpMZurEK.mjs +0 -196
- package/dist/github-DpMZurEK.mjs.map +0 -1
- package/dist/index-BzJ7QJ9c.d.mts.map +0 -1
- package/dist/index-CfMjtdVC.d.cts.map +0 -1
- package/dist/keystore-C9rint2E.cjs +0 -101
- package/dist/keystore-C9rint2E.cjs.map +0 -1
- package/dist/keystore-TxeYM7an.mjs +0 -83
- package/dist/keystore-TxeYM7an.mjs.map +0 -1
- package/dist/openapi-Bs3-5q_r.mjs +0 -2021
- package/dist/openapi-Bs3-5q_r.mjs.map +0 -1
- package/dist/openapi-DWLTsYLL.cjs +0 -2075
- package/dist/openapi-DWLTsYLL.cjs.map +0 -1
- package/dist/openapi-react-query-Byltvm_7.mjs +0 -167
- package/dist/openapi-react-query-Byltvm_7.mjs.map +0 -1
- package/dist/openapi-react-query-CmJ1xDbn.cjs +0 -173
- package/dist/openapi-react-query-CmJ1xDbn.cjs.map +0 -1
- package/dist/openapi-react-query.cjs +0 -4
- package/dist/openapi-react-query.d.cts +0 -11
- package/dist/openapi-react-query.d.cts.map +0 -1
- package/dist/openapi-react-query.d.mts +0 -11
- package/dist/openapi-react-query.d.mts.map +0 -1
- package/dist/openapi-react-query.mjs +0 -4
- package/dist/reconcile-BI0tWkwz.mjs.map +0 -1
- package/dist/reconcile-Bhw5fmKu.cjs.map +0 -1
- package/dist/setup-BmLoNrDX.mjs +0 -12
- package/dist/setup-BrR1_xGy.cjs +0 -12
- package/dist/setup-BsNR2LBG.cjs +0 -467
- package/dist/setup-BsNR2LBG.cjs.map +0 -1
- package/dist/setup-D5-JMknk.mjs +0 -437
- package/dist/setup-D5-JMknk.mjs.map +0 -1
- package/dist/storage-B020InPW.mjs +0 -222
- package/dist/storage-B020InPW.mjs.map +0 -1
- package/dist/storage-CSNplaJn.cjs +0 -282
- package/dist/storage-CSNplaJn.cjs.map +0 -1
- package/dist/storage-DGBzMLZa.mjs +0 -4
- package/dist/storage-DlVol_oj.cjs +0 -8
- package/dist/sync-0ILCb-1S.cjs +0 -93
- package/dist/sync-0ILCb-1S.cjs.map +0 -1
- package/dist/sync-CzHXiR9c.mjs +0 -76
- package/dist/sync-CzHXiR9c.mjs.map +0 -1
- package/dist/sync-DYENfOt4.cjs +0 -4
- package/dist/sync-HAau6h_R.mjs +0 -3
- package/dist/types-DVIx8I1N.d.mts +0 -1950
- package/dist/types-DVIx8I1N.d.mts.map +0 -1
- package/dist/types-PMP_qXRY.d.cts +0 -1950
- package/dist/types-PMP_qXRY.d.cts.map +0 -1
- package/dist/workspace-Cji6lE8E.cjs +0 -10
- package/dist/workspace-CkJAtRIX.mjs +0 -9
- package/dist/workspace-CtnZnWsa.mjs.map +0 -1
- package/dist/workspace-DPV7FtAv.cjs.map +0 -1
|
@@ -0,0 +1,630 @@
|
|
|
1
|
+
const require_errors = require("./errors-DMC4Umsb.cjs");
|
|
2
|
+
const require_compose = require("./compose-Mdgea4Yt.cjs");
|
|
3
|
+
const require_workspace = require("./workspace-BwqQnool.cjs");
|
|
4
|
+
const require_seeds = require("./seeds-C2w4UqVP.cjs");
|
|
5
|
+
const require_config = require("./config.cjs");
|
|
6
|
+
const require_sniffer = require("./sniffer-CF7wNxMo.cjs");
|
|
7
|
+
const require_index = require("./index.cjs");
|
|
8
|
+
const require_github = require("./github-BAeaC1Pl.cjs");
|
|
9
|
+
let node_path = require("node:path");
|
|
10
|
+
let node_fs = require("node:fs");
|
|
11
|
+
let node_fs_promises = require("node:fs/promises");
|
|
12
|
+
let node_os = require("node:os");
|
|
13
|
+
let node_child_process = require("node:child_process");
|
|
14
|
+
//#region src/compose/serverScript.ts
|
|
15
|
+
/**
|
|
16
|
+
* What `gkm compose:server` runs on the server, as root (through the admin
|
|
17
|
+
* user's sudo). Plain bash, so `--dry-run` can print exactly what will run,
|
|
18
|
+
* and safe to run again: every step changes only what is missing or wrong.
|
|
19
|
+
*
|
|
20
|
+
* Arguments, in order: the admin user (the one running sudo), the deploy
|
|
21
|
+
* user, the SSH port, the deploy key's public line, and its comment.
|
|
22
|
+
*
|
|
23
|
+
* The last line it prints is `HOSTKEY=<fingerprint>` — the server's own
|
|
24
|
+
* ed25519 host key, which the command checks the network's against before
|
|
25
|
+
* pinning it for CI.
|
|
26
|
+
*/
|
|
27
|
+
const SERVER_SCRIPT = String.raw`set -euo pipefail
|
|
28
|
+
export DEBIAN_FRONTEND=noninteractive
|
|
29
|
+
ADMIN="$1"; DEPLOY="$2"; SSH_PORT="$3"; PUB="$4"; COMMENT="$5"
|
|
30
|
+
say() { echo " $*"; }
|
|
31
|
+
fail() { echo " ✗ $*" >&2; exit 1; }
|
|
32
|
+
|
|
33
|
+
. /etc/os-release
|
|
34
|
+
case "$ID" in
|
|
35
|
+
ubuntu | debian) ;;
|
|
36
|
+
*) fail "gkm sets up Ubuntu and Debian servers; this one is $ID." ;;
|
|
37
|
+
esac
|
|
38
|
+
|
|
39
|
+
# ── SSH: keys only, no root ────────────────────────────────────────────────
|
|
40
|
+
# Before password logins are turned off, the admin must have a key to come
|
|
41
|
+
# back with — otherwise this would lock them out.
|
|
42
|
+
ADMIN_HOME="$(getent passwd "$ADMIN" | cut -d: -f6)"
|
|
43
|
+
[ -s "$ADMIN_HOME/.ssh/authorized_keys" ] ||
|
|
44
|
+
fail "$ADMIN has no key in $ADMIN_HOME/.ssh/authorized_keys; turning off password logins would lock them out."
|
|
45
|
+
# First match wins in sshd_config, and 00- sorts before what a provider ships
|
|
46
|
+
# (cloud-init's 50-cloud-init.conf turns password logins back on).
|
|
47
|
+
cat > /etc/ssh/sshd_config.d/00-gkm-hardening.conf <<'EOF'
|
|
48
|
+
# Written by gkm compose:server.
|
|
49
|
+
PermitRootLogin no
|
|
50
|
+
PasswordAuthentication no
|
|
51
|
+
KbdInteractiveAuthentication no
|
|
52
|
+
EOF
|
|
53
|
+
# The deploy migrates through an SSH tunnel to the server's loopback.
|
|
54
|
+
cat > /etc/ssh/sshd_config.d/60-gkm-deploy.conf <<EOF
|
|
55
|
+
# Written by gkm compose:server.
|
|
56
|
+
Match User $DEPLOY
|
|
57
|
+
AllowTcpForwarding local
|
|
58
|
+
EOF
|
|
59
|
+
sshd -t
|
|
60
|
+
systemctl reload ssh 2>/dev/null || systemctl reload sshd
|
|
61
|
+
# What sshd actually does now, whatever else is in its config.
|
|
62
|
+
EFFECTIVE="$(sshd -T)"
|
|
63
|
+
for setting in 'permitrootlogin no' 'passwordauthentication no' 'kbdinteractiveauthentication no'; do
|
|
64
|
+
grep -qx "$setting" <<<"$EFFECTIVE" || fail "sshd still does not say '$setting'; another file in /etc/ssh overrides it."
|
|
65
|
+
done
|
|
66
|
+
FORWARD="$(sshd -T -C "user=$DEPLOY,host=localhost,addr=127.0.0.1" | sed -n 's/^allowtcpforwarding //p')"
|
|
67
|
+
case "$FORWARD" in
|
|
68
|
+
yes | all | local) ;;
|
|
69
|
+
*) fail "sshd does not let $DEPLOY forward ports (allowtcpforwarding $FORWARD)." ;;
|
|
70
|
+
esac
|
|
71
|
+
say "sshd: keys only, no root login; $DEPLOY may open local tunnels"
|
|
72
|
+
# Root is reached through the admin's sudo, which this script is running
|
|
73
|
+
# under — so its password, the one a provider mails out, can go.
|
|
74
|
+
passwd -l root >/dev/null
|
|
75
|
+
say "root's password locked; $ADMIN's sudo is the way to root"
|
|
76
|
+
|
|
77
|
+
# ── Firewall: SSH, HTTP, HTTPS ─────────────────────────────────────────────
|
|
78
|
+
command -v ufw >/dev/null || { apt-get update -qq && apt-get install -y -qq ufw >/dev/null; }
|
|
79
|
+
ufw default deny incoming >/dev/null
|
|
80
|
+
ufw default allow outgoing >/dev/null
|
|
81
|
+
ufw allow "$SSH_PORT/tcp" >/dev/null
|
|
82
|
+
ufw allow 80/tcp >/dev/null
|
|
83
|
+
ufw allow 443/tcp >/dev/null
|
|
84
|
+
ufw --force enable >/dev/null
|
|
85
|
+
say "firewall: $SSH_PORT, 80, 443 in; everything out"
|
|
86
|
+
EXTRA="$(ufw status | awk 'NR > 4 && $1 != "" { print $1 }' | grep -vxE "(($SSH_PORT|80|443)(/tcp)?|OpenSSH)" | sort -u || true)"
|
|
87
|
+
if [ -n "$EXTRA" ]; then
|
|
88
|
+
say "⚠ also open: $(echo $EXTRA). gkm uses none of them; close each with: sudo ufw delete allow <port>"
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# ── Updates and bans ───────────────────────────────────────────────────────
|
|
92
|
+
apt-get update -qq
|
|
93
|
+
apt-get install -y -qq unattended-upgrades fail2ban >/dev/null
|
|
94
|
+
cat > /etc/apt/apt.conf.d/20auto-upgrades <<'EOF'
|
|
95
|
+
APT::Periodic::Update-Package-Lists "1";
|
|
96
|
+
APT::Periodic::Unattended-Upgrade "1";
|
|
97
|
+
EOF
|
|
98
|
+
cat > /etc/fail2ban/jail.d/gkm.local <<EOF
|
|
99
|
+
# Written by gkm compose:server.
|
|
100
|
+
[sshd]
|
|
101
|
+
enabled = true
|
|
102
|
+
port = $SSH_PORT
|
|
103
|
+
EOF
|
|
104
|
+
systemctl enable --now unattended-upgrades fail2ban >/dev/null 2>&1
|
|
105
|
+
systemctl restart fail2ban
|
|
106
|
+
say "security updates install daily; fail2ban watches sshd"
|
|
107
|
+
|
|
108
|
+
# ── Docker, from Docker's own repository ───────────────────────────────────
|
|
109
|
+
if ! command -v docker >/dev/null || ! docker compose version >/dev/null 2>&1; then
|
|
110
|
+
say "installing Docker…"
|
|
111
|
+
apt-get install -y -qq ca-certificates curl >/dev/null
|
|
112
|
+
install -m 0755 -d /etc/apt/keyrings
|
|
113
|
+
curl -fsSL "https://download.docker.com/linux/$ID/gpg" -o /etc/apt/keyrings/docker.asc
|
|
114
|
+
chmod a+r /etc/apt/keyrings/docker.asc
|
|
115
|
+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/$ID $VERSION_CODENAME stable" \
|
|
116
|
+
> /etc/apt/sources.list.d/docker.list
|
|
117
|
+
apt-get update -qq
|
|
118
|
+
apt-get install -y -qq docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin >/dev/null
|
|
119
|
+
fi
|
|
120
|
+
systemctl enable --now docker >/dev/null 2>&1
|
|
121
|
+
say "docker $(docker version --format '{{.Server.Version}}')"
|
|
122
|
+
|
|
123
|
+
# ── The deploy user: no password, no sudo, in the docker group ─────────────
|
|
124
|
+
id "$DEPLOY" >/dev/null 2>&1 || adduser --disabled-password --gecos "" "$DEPLOY" >/dev/null
|
|
125
|
+
usermod -aG docker "$DEPLOY"
|
|
126
|
+
DEPLOY_HOME="$(getent passwd "$DEPLOY" | cut -d: -f6)"
|
|
127
|
+
install -d -m 700 -o "$DEPLOY" -g "$DEPLOY" "$DEPLOY_HOME/.ssh"
|
|
128
|
+
AUTH="$DEPLOY_HOME/.ssh/authorized_keys"
|
|
129
|
+
touch "$AUTH"
|
|
130
|
+
# One managed line: this key (or an earlier one by the same name) replaced,
|
|
131
|
+
# with nothing allowed but the commands and the tunnel the deploy uses.
|
|
132
|
+
KEYBODY="$(awk '{ print $2 }' <<<"$PUB")"
|
|
133
|
+
grep -v -F -e "$KEYBODY" -e " $COMMENT" "$AUTH" > "$AUTH.new" || true
|
|
134
|
+
echo "restrict,port-forwarding $PUB" >> "$AUTH.new"
|
|
135
|
+
mv "$AUTH.new" "$AUTH"
|
|
136
|
+
chown "$DEPLOY:$DEPLOY" "$AUTH"
|
|
137
|
+
chmod 600 "$AUTH"
|
|
138
|
+
say "user $DEPLOY (docker group), deploy key authorized with restrict,port-forwarding"
|
|
139
|
+
OTHERS="$(grep -v -F -e "$KEYBODY" "$AUTH" | grep -c . || true)"
|
|
140
|
+
if [ "$OTHERS" -gt 0 ]; then
|
|
141
|
+
say "⚠ $AUTH holds $OTHERS other key(s). Review: sudo cat $AUTH"
|
|
142
|
+
fi
|
|
143
|
+
|
|
144
|
+
echo "HOSTKEY=$(ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub | awk '{ print $2 }')"
|
|
145
|
+
`;
|
|
146
|
+
/**
|
|
147
|
+
* What runs as root to give a fresh server its admin — the guide's first
|
|
148
|
+
* step, for a server only root can log in to yet: a sudo user, with root's
|
|
149
|
+
* keys so the same key logs in. `adduser` asks for its password, which sudo
|
|
150
|
+
* will ask for.
|
|
151
|
+
*/
|
|
152
|
+
const ADMIN_SCRIPT = `set -euo pipefail
|
|
153
|
+
ADMIN="$1"
|
|
154
|
+
if ! id "$ADMIN" >/dev/null 2>&1; then
|
|
155
|
+
echo " creating $ADMIN — choose the password sudo will ask for:"
|
|
156
|
+
adduser --gecos "" "$ADMIN"
|
|
157
|
+
fi
|
|
158
|
+
usermod -aG sudo "$ADMIN"
|
|
159
|
+
HOME_DIR="$(getent passwd "$ADMIN" | cut -d: -f6)"
|
|
160
|
+
install -d -m 700 -o "$ADMIN" -g "$ADMIN" "$HOME_DIR/.ssh"
|
|
161
|
+
AUTH="$HOME_DIR/.ssh/authorized_keys"
|
|
162
|
+
touch "$AUTH"
|
|
163
|
+
# The keys alone: a provider's options on root's lines (a command="…" that
|
|
164
|
+
# says "log in as ubuntu") would stop the admin's login too. A server root
|
|
165
|
+
# logs in to with a password has none; ssh-copy-id brings the admin's.
|
|
166
|
+
{ grep -oE '(ssh|ecdsa|sk)-[^ ]+ [A-Za-z0-9+/=]+( .*)?$' /root/.ssh/authorized_keys 2>/dev/null || true; } |
|
|
167
|
+
while IFS= read -r key; do
|
|
168
|
+
grep -qxF "$key" "$AUTH" || echo "$key" >> "$AUTH"
|
|
169
|
+
done
|
|
170
|
+
chown "$ADMIN:$ADMIN" "$AUTH"
|
|
171
|
+
chmod 600 "$AUTH"
|
|
172
|
+
echo " $ADMIN is a sudo user, with root's SSH keys (if root had any)"
|
|
173
|
+
`;
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/compose/serverSetup.ts
|
|
176
|
+
/**
|
|
177
|
+
* `gkm compose:server` — make a VPS ready for a stage's compose deploys, from
|
|
178
|
+
* this machine, in one go.
|
|
179
|
+
*
|
|
180
|
+
* It logs in as the server's admin — a sudo user, never root — and, through
|
|
181
|
+
* sudo, sets the server up the way a production VPS should be: SSH by key
|
|
182
|
+
* only with root's login off, a firewall open on SSH, 80 and 443 alone,
|
|
183
|
+
* security updates installed daily, fail2ban on sshd, and Docker from
|
|
184
|
+
* Docker's own repository. It then creates the stage's deploy user (in the
|
|
185
|
+
* docker group, no sudo, no password) and authorizes a deploy key on it that
|
|
186
|
+
* may run commands and open the tunnel migrations use, nothing more.
|
|
187
|
+
*
|
|
188
|
+
* Off the server: it makes the deploy key pair here, pins the server's host
|
|
189
|
+
* key — checked against the fingerprint the server reports of itself — and
|
|
190
|
+
* gives both to the stage's GitHub environment as `DEPLOY_SSH_KEY` and
|
|
191
|
+
* `DEPLOY_KNOWN_HOSTS`, which the generated deploy workflow reads. Last, it
|
|
192
|
+
* logs in exactly as CI will, and checks Docker and the tunnel answer.
|
|
193
|
+
*
|
|
194
|
+
* A fresh server only root can log in to gets its admin first: as root —
|
|
195
|
+
* with root's key, or its password on a brand-new server — it creates the
|
|
196
|
+
* user, and `ssh-copy-id` puts your key on it when root had none to give.
|
|
197
|
+
* Root's password is locked once the admin's sudo works.
|
|
198
|
+
*
|
|
199
|
+
* Once it has, the stage's state records that it is done (`server:compose`,
|
|
200
|
+
* stamped with who and when) — nothing personal: the admin is whoever runs
|
|
201
|
+
* it, with their own key.
|
|
202
|
+
* Safe to run again: each step changes only what is missing or wrong.
|
|
203
|
+
*/
|
|
204
|
+
/** The stage's record of its server, as `compose:server` last set it up. */
|
|
205
|
+
const SERVER_RECORD = "server:compose";
|
|
206
|
+
/** The admin named is root, whose login this command turns off. */
|
|
207
|
+
var ComposeServerAdminIsRoot = class extends require_errors.GkmError {
|
|
208
|
+
constructor() {
|
|
209
|
+
super("The admin can't be root: setting up the server turns root's SSH login off. Name the sudo user you log in as (--admin <user>). A fresh server with only root gets one: run this again with the name it should have, and gkm offers to create it with root's key.");
|
|
210
|
+
this.name = "ComposeServerAdminIsRoot";
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
/** The admin named is the deploy user, which has no sudo. */
|
|
214
|
+
var ComposeServerAdminIsDeployUser = class extends require_errors.GkmError {
|
|
215
|
+
user;
|
|
216
|
+
constructor(user) {
|
|
217
|
+
super(`'${user}' is the stage's deploy user (deploy.compose.server), which gkm creates without sudo. Name the sudo user you log in as with --admin.`);
|
|
218
|
+
this.user = user;
|
|
219
|
+
this.name = "ComposeServerAdminIsDeployUser";
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
/** No key logs the admin in, and nothing was done to make one. */
|
|
223
|
+
var ComposeServerAdminUnreachable = class extends require_errors.GkmError {
|
|
224
|
+
target;
|
|
225
|
+
stderr;
|
|
226
|
+
constructor(target, stderr) {
|
|
227
|
+
super(`Could not log in as ${target} with a key (ssh said: ${stderr.trim() || "nothing"}). Check \`ssh ${target}\` works without a password — copy your key with \`ssh-copy-id ${target}\` — then run this again.`);
|
|
228
|
+
this.target = target;
|
|
229
|
+
this.stderr = stderr;
|
|
230
|
+
this.name = "ComposeServerAdminUnreachable";
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* The server was set up already, and this person cannot log in to it as
|
|
235
|
+
* the admin they named. Root's login and passwords are off there, so only
|
|
236
|
+
* an admin can let them in.
|
|
237
|
+
*/
|
|
238
|
+
var ComposeServerAccessNeeded = class extends require_errors.GkmError {
|
|
239
|
+
target;
|
|
240
|
+
setUpBy;
|
|
241
|
+
setUpOn;
|
|
242
|
+
constructor(target, setUpBy, setUpOn) {
|
|
243
|
+
super(`${target} can't log in with your key, and the server was set up by ${setUpBy} on ${setUpOn} — root and password logins are off there. Ask them, or another admin, to add your public key to ${target.split("@")[0]}'s ~/.ssh/authorized_keys (or create you a sudo user with it), then run this again.`);
|
|
244
|
+
this.target = target;
|
|
245
|
+
this.setUpBy = setUpBy;
|
|
246
|
+
this.setUpOn = setUpOn;
|
|
247
|
+
this.name = "ComposeServerAccessNeeded";
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
/** `ssh-keygen` could not make the deploy key pair. */
|
|
251
|
+
var DeployKeyNotMade = class extends require_errors.GkmError {
|
|
252
|
+
keyFile;
|
|
253
|
+
stderr;
|
|
254
|
+
constructor(keyFile, stderr) {
|
|
255
|
+
super(`Could not make the deploy key ${keyFile} (ssh-keygen said: ${stderr.trim() || "nothing"}). Pass another path with --key-file.`);
|
|
256
|
+
this.keyFile = keyFile;
|
|
257
|
+
this.stderr = stderr;
|
|
258
|
+
this.name = "DeployKeyNotMade";
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
/** The script on the server stopped before it finished. */
|
|
262
|
+
var ComposeServerSetupFailed = class extends require_errors.GkmError {
|
|
263
|
+
target;
|
|
264
|
+
code;
|
|
265
|
+
constructor(target, code) {
|
|
266
|
+
super(`Setting up ${target} stopped (exit ${code}); its output is above. Fix what it names and run this again — every step it already finished is left as it is.`);
|
|
267
|
+
this.target = target;
|
|
268
|
+
this.code = code;
|
|
269
|
+
this.name = "ComposeServerSetupFailed";
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
/** The host key the network shows is not the one the server holds. */
|
|
273
|
+
var ComposeServerHostKeyMismatch = class extends require_errors.GkmError {
|
|
274
|
+
host;
|
|
275
|
+
server;
|
|
276
|
+
scanned;
|
|
277
|
+
constructor(host, server, scanned) {
|
|
278
|
+
super(`${host}'s host key is ${server} on the server, but ${scanned || "nothing"} over the network. Something between here and the server answered for it, or the server is not the one you logged in to. Nothing was given to GitHub; find out why before running this again.`);
|
|
279
|
+
this.host = host;
|
|
280
|
+
this.server = server;
|
|
281
|
+
this.scanned = scanned;
|
|
282
|
+
this.name = "ComposeServerHostKeyMismatch";
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
/** The deploy key logged in, but cannot do what a deploy does. */
|
|
286
|
+
var ComposeServerCheckFailed = class extends require_errors.GkmError {
|
|
287
|
+
target;
|
|
288
|
+
check;
|
|
289
|
+
output;
|
|
290
|
+
constructor(target, check, output) {
|
|
291
|
+
super(check === "docker" ? `The deploy key can't run docker as ${target} (ssh said: ${output.trim() || "nothing"}).` : `The deploy key can't open a tunnel as ${target} (got: ${output.trim() || "nothing"}). Check its line in the deploy user's authorized_keys says restrict,port-forwarding, and that sshd allows it forwarding.`);
|
|
292
|
+
this.target = target;
|
|
293
|
+
this.check = check;
|
|
294
|
+
this.output = output;
|
|
295
|
+
this.name = "ComposeServerCheckFailed";
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
/** `'…'`, for a value in a command line the remote shell reads. */
|
|
299
|
+
function shellQuote(value) {
|
|
300
|
+
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* The remote command that runs `script` with `args`: written to a temporary
|
|
304
|
+
* file (so the script keeps the terminal for any password it asks), run,
|
|
305
|
+
* and removed. `sudo` for everything but root.
|
|
306
|
+
*/
|
|
307
|
+
function remoteCommand(script, args, sudo) {
|
|
308
|
+
return [
|
|
309
|
+
`f="$(mktemp)"`,
|
|
310
|
+
`echo ${Buffer.from(script).toString("base64")} | base64 -d > "$f"`,
|
|
311
|
+
`${sudo ? "sudo " : ""}bash "$f" ${args.map(shellQuote).join(" ")}; s=$?`,
|
|
312
|
+
`rm -f "$f"`,
|
|
313
|
+
"exit $s"
|
|
314
|
+
].join("; ");
|
|
315
|
+
}
|
|
316
|
+
function sshOptions(server) {
|
|
317
|
+
return [
|
|
318
|
+
"-o",
|
|
319
|
+
"ConnectTimeout=20",
|
|
320
|
+
"-p",
|
|
321
|
+
String(server.port)
|
|
322
|
+
];
|
|
323
|
+
}
|
|
324
|
+
/** How the admin (or root) logs in: the server's options and their key. */
|
|
325
|
+
function loginOptions(server, identity) {
|
|
326
|
+
return [...sshOptions(server), ...identity ? [
|
|
327
|
+
"-i",
|
|
328
|
+
identity,
|
|
329
|
+
"-o",
|
|
330
|
+
"IdentitiesOnly=yes"
|
|
331
|
+
] : []];
|
|
332
|
+
}
|
|
333
|
+
/** `user@host`, as `ssh` takes it. */
|
|
334
|
+
function at(user, host) {
|
|
335
|
+
return `${user}@${host}`;
|
|
336
|
+
}
|
|
337
|
+
/** The real runner: the system's programs. */
|
|
338
|
+
const systemRunner = (command, args, options = {}) => new Promise((resolve, reject) => {
|
|
339
|
+
const child = (0, node_child_process.spawn)(command, args, {
|
|
340
|
+
stdio: [
|
|
341
|
+
options.interactive ? "inherit" : "pipe",
|
|
342
|
+
"pipe",
|
|
343
|
+
options.interactive ? "inherit" : "pipe"
|
|
344
|
+
],
|
|
345
|
+
timeout: options.interactive ? void 0 : 6e4
|
|
346
|
+
});
|
|
347
|
+
let stdout = "";
|
|
348
|
+
let stderr = "";
|
|
349
|
+
child.stdout?.on("data", (chunk) => {
|
|
350
|
+
stdout += chunk.toString();
|
|
351
|
+
if (options.interactive) process.stdout.write(chunk);
|
|
352
|
+
});
|
|
353
|
+
child.stderr?.on("data", (chunk) => {
|
|
354
|
+
stderr += chunk.toString();
|
|
355
|
+
});
|
|
356
|
+
child.on("error", reject);
|
|
357
|
+
child.on("close", (code) => resolve({
|
|
358
|
+
code: code ?? 1,
|
|
359
|
+
stdout,
|
|
360
|
+
stderr
|
|
361
|
+
}));
|
|
362
|
+
if (child.stdin) child.stdin.end(options.input ?? "");
|
|
363
|
+
});
|
|
364
|
+
/** Whether `answer` is a yes, `fallback` when nothing was typed. */
|
|
365
|
+
function isYes(answer, fallback) {
|
|
366
|
+
const value = answer.trim().toLowerCase();
|
|
367
|
+
return value === "" ? fallback : value === "y" || value === "yes";
|
|
368
|
+
}
|
|
369
|
+
/** The SHA256 fingerprint of each key in `keys`, by `ssh-keygen -lf -`. */
|
|
370
|
+
async function fingerprints(run, keys) {
|
|
371
|
+
const { stdout } = await run("ssh-keygen", ["-lf", "-"], { input: keys });
|
|
372
|
+
return stdout.split("\n").map((line) => line.split(" ")[1]).filter((value) => Boolean(value));
|
|
373
|
+
}
|
|
374
|
+
/** The default deploy key pair for a stage. */
|
|
375
|
+
function defaultKeyFile(project, stage) {
|
|
376
|
+
return (0, node_path.join)((0, node_os.homedir)(), ".ssh", `gkm-${project}-${stage}`);
|
|
377
|
+
}
|
|
378
|
+
/** `gkm compose:server`. */
|
|
379
|
+
async function composeServerCommand(options, deps = {}) {
|
|
380
|
+
const run = deps.run ?? systemRunner;
|
|
381
|
+
const gh = deps.gh ?? require_github.ghCli;
|
|
382
|
+
const ask = deps.ask ?? ((question) => require_index.prompt(question, { instead: "Name the server user with --admin and pass --yes." }));
|
|
383
|
+
const github = options.github !== false;
|
|
384
|
+
const { stage } = options;
|
|
385
|
+
const cwd = (0, node_path.resolve)(options.cwd ?? process.cwd());
|
|
386
|
+
const { workspace } = await require_config.loadWorkspaceConfig(cwd);
|
|
387
|
+
require_workspace.assertDeployedStage(workspace.stages, stage);
|
|
388
|
+
const server = require_compose.composeServer({
|
|
389
|
+
stage,
|
|
390
|
+
local: false,
|
|
391
|
+
config: workspace.deploy?.compose?.server,
|
|
392
|
+
custom: (await (await require_seeds.secretsStoreFor(workspace, stage)).read(stage))?.custom
|
|
393
|
+
});
|
|
394
|
+
const state = deps.state ?? await require_sniffer.createStateStore({
|
|
395
|
+
config: workspace.state,
|
|
396
|
+
workspaceRoot: workspace.root,
|
|
397
|
+
workspaceName: workspace.name,
|
|
398
|
+
namespace: workspace.deploy?.namespace
|
|
399
|
+
});
|
|
400
|
+
const record = (await state.read(stage))?.resources[SERVER_RECORD];
|
|
401
|
+
const done = (record?.data)?.host === server.host ? record : void 0;
|
|
402
|
+
const identity = options.identity ? (0, node_path.resolve)(options.identity) : void 0;
|
|
403
|
+
const asAdmin = loginOptions(server, identity);
|
|
404
|
+
const sshUser = (await run("ssh", [
|
|
405
|
+
"-G",
|
|
406
|
+
...asAdmin,
|
|
407
|
+
server.host
|
|
408
|
+
])).stdout.match(/^user (\S+)$/m)?.[1] ?? "";
|
|
409
|
+
const admin = (options.admin ?? (sshUser && sshUser !== "root" ? sshUser : await ask(`The sudo user you log in to ${server.host} as (not root): `))).trim();
|
|
410
|
+
if (!admin || admin === "root") throw new ComposeServerAdminIsRoot();
|
|
411
|
+
if (admin === server.user) throw new ComposeServerAdminIsDeployUser(admin);
|
|
412
|
+
const keyFile = (0, node_path.resolve)(options.keyFile ?? defaultKeyFile(workspace.name, stage));
|
|
413
|
+
const comment = `gkm-${workspace.name}-${stage}-deploy`;
|
|
414
|
+
const repo = github ? options.repo ?? gh([
|
|
415
|
+
"repo",
|
|
416
|
+
"view",
|
|
417
|
+
"--json",
|
|
418
|
+
"nameWithOwner",
|
|
419
|
+
"-q",
|
|
420
|
+
".nameWithOwner"
|
|
421
|
+
]) : void 0;
|
|
422
|
+
const adminTarget = at(admin, server.host);
|
|
423
|
+
const deployTarget = at(server.user, server.host);
|
|
424
|
+
console.log(`\n🖥 Server for stage "${stage}"\n`);
|
|
425
|
+
console.log(` Server: ${server.host} (ssh port ${server.port})`);
|
|
426
|
+
console.log(` Admin: ${admin} — logs in with ${identity ?? "your SSH key"}, runs sudo${options.admin ? "" : " (your SSH login)"}`);
|
|
427
|
+
console.log(` Deploy user: ${server.user} — docker group, no sudo, no password`);
|
|
428
|
+
console.log(` Deploy key: ${keyFile}${(0, node_fs.existsSync)(keyFile) ? "" : " (new, made here)"}`);
|
|
429
|
+
console.log(` GitHub: ${repo ? `environment "${stage}" of ${repo}: DEPLOY_SSH_KEY, DEPLOY_KNOWN_HOSTS` : "left alone (--no-github)"}`);
|
|
430
|
+
if (done) console.log(`\n Already set up by ${require_seeds.describeActor(done.updatedBy)} on ${done.updatedAt.slice(0, 10)}; running again changes only what is missing or wrong.`);
|
|
431
|
+
console.log("\n On the server, through sudo:");
|
|
432
|
+
for (const step of [
|
|
433
|
+
"SSH: keys only, root's login off (and nothing else may turn passwords back on)",
|
|
434
|
+
`root's password locked — ${admin}'s sudo is the way to root`,
|
|
435
|
+
`firewall: ${server.port}, 80 and 443 in, everything out`,
|
|
436
|
+
"security updates installed daily (unattended-upgrades); fail2ban on sshd",
|
|
437
|
+
"Docker and its compose plugin, from Docker's repository",
|
|
438
|
+
`user ${server.user}, the deploy key authorized with restrict,port-forwarding`
|
|
439
|
+
]) console.log(` · ${step}`);
|
|
440
|
+
if (options.dryRun) {
|
|
441
|
+
console.log(`\n The script, run as: sudo bash setup.sh ${[
|
|
442
|
+
admin,
|
|
443
|
+
server.user,
|
|
444
|
+
String(server.port),
|
|
445
|
+
"<deploy key>",
|
|
446
|
+
comment
|
|
447
|
+
].map(shellQuote).join(" ")}\n`);
|
|
448
|
+
console.log(SERVER_SCRIPT.replace(/^/gm, " "));
|
|
449
|
+
console.log(" --dry-run: nothing changed.\n");
|
|
450
|
+
return {
|
|
451
|
+
server,
|
|
452
|
+
admin,
|
|
453
|
+
keyFile,
|
|
454
|
+
...repo ? { repo } : {}
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
if (!options.yes && !isYes(await ask(`\n Set up ${server.host}? [y/N] `), false)) {
|
|
458
|
+
console.log(" Nothing changed.\n");
|
|
459
|
+
return {
|
|
460
|
+
server,
|
|
461
|
+
admin,
|
|
462
|
+
keyFile,
|
|
463
|
+
...repo ? { repo } : {}
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
if (!(0, node_fs.existsSync)(keyFile)) {
|
|
467
|
+
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(keyFile), {
|
|
468
|
+
recursive: true,
|
|
469
|
+
mode: 448
|
|
470
|
+
});
|
|
471
|
+
const made = await run("ssh-keygen", [
|
|
472
|
+
"-t",
|
|
473
|
+
"ed25519",
|
|
474
|
+
"-N",
|
|
475
|
+
"",
|
|
476
|
+
"-C",
|
|
477
|
+
comment,
|
|
478
|
+
"-f",
|
|
479
|
+
keyFile
|
|
480
|
+
]);
|
|
481
|
+
if (made.code !== 0) throw new DeployKeyNotMade(keyFile, made.stderr);
|
|
482
|
+
console.log(`\n ✓ Made the deploy key ${keyFile}`);
|
|
483
|
+
}
|
|
484
|
+
const publicKey = (await (0, node_fs_promises.readFile)(`${keyFile}.pub`, "utf-8")).trim();
|
|
485
|
+
const probe = (user) => run("ssh", [
|
|
486
|
+
"-o",
|
|
487
|
+
"BatchMode=yes",
|
|
488
|
+
"-o",
|
|
489
|
+
"StrictHostKeyChecking=accept-new",
|
|
490
|
+
...asAdmin,
|
|
491
|
+
at(user, server.host),
|
|
492
|
+
"true"
|
|
493
|
+
]);
|
|
494
|
+
let login = await probe(admin);
|
|
495
|
+
if (login.code !== 0 && done) throw new ComposeServerAccessNeeded(adminTarget, require_seeds.describeActor(done.updatedBy), done.updatedAt.slice(0, 10));
|
|
496
|
+
if (login.code !== 0) {
|
|
497
|
+
const rootHasKey = (await probe("root")).code === 0;
|
|
498
|
+
if (isYes(await ask(rootHasKey ? `\n ${admin} can't log in with a key, but root can. Create ${admin} as a sudo user with root's keys? [Y/n] ` : `\n ${admin} can't log in with a key. Is this a new server, where ${admin} still has to be created? Log in as root with its password to create it [y/N] `), rootHasKey)) {
|
|
499
|
+
const created = await run("ssh", [
|
|
500
|
+
"-t",
|
|
501
|
+
...asAdmin,
|
|
502
|
+
at("root", server.host),
|
|
503
|
+
remoteCommand(ADMIN_SCRIPT, [admin], false)
|
|
504
|
+
], { interactive: true });
|
|
505
|
+
if (created.code !== 0) throw new ComposeServerSetupFailed(at("root", server.host), created.code);
|
|
506
|
+
login = await probe(admin);
|
|
507
|
+
}
|
|
508
|
+
if (login.code !== 0 && isYes(await ask(`\n ${admin} can't log in with a key. Copy yours there with ssh-copy-id (asks ${admin}'s password)? [Y/n] `), true)) {
|
|
509
|
+
const copied = await run("ssh-copy-id", [
|
|
510
|
+
...identity ? ["-i", identity] : [],
|
|
511
|
+
"-p",
|
|
512
|
+
String(server.port),
|
|
513
|
+
adminTarget
|
|
514
|
+
], { interactive: true });
|
|
515
|
+
if (copied.code !== 0) throw new ComposeServerAdminUnreachable(adminTarget, copied.stderr);
|
|
516
|
+
}
|
|
517
|
+
login = await probe(admin);
|
|
518
|
+
if (login.code !== 0) throw new ComposeServerAdminUnreachable(adminTarget, login.stderr);
|
|
519
|
+
}
|
|
520
|
+
console.log(` ✓ ${adminTarget} logs in with a key\n`);
|
|
521
|
+
const setup = await run("ssh", [
|
|
522
|
+
"-t",
|
|
523
|
+
...asAdmin,
|
|
524
|
+
adminTarget,
|
|
525
|
+
remoteCommand(SERVER_SCRIPT, [
|
|
526
|
+
admin,
|
|
527
|
+
server.user,
|
|
528
|
+
String(server.port),
|
|
529
|
+
publicKey,
|
|
530
|
+
comment
|
|
531
|
+
], true)
|
|
532
|
+
], { interactive: true });
|
|
533
|
+
if (setup.code !== 0) throw new ComposeServerSetupFailed(adminTarget, setup.code);
|
|
534
|
+
const serverFingerprint = setup.stdout.replaceAll("\r", "").match(/^HOSTKEY=(\S+)$/m)?.[1];
|
|
535
|
+
if (!serverFingerprint) throw new ComposeServerSetupFailed(adminTarget, setup.code);
|
|
536
|
+
const knownHosts = (await run("ssh-keyscan", [
|
|
537
|
+
"-t",
|
|
538
|
+
"ed25519",
|
|
539
|
+
"-p",
|
|
540
|
+
String(server.port),
|
|
541
|
+
server.host
|
|
542
|
+
])).stdout.split("\n").filter((line) => line.trim() && !line.startsWith("#")).join("\n");
|
|
543
|
+
const [scanned = ""] = await fingerprints(run, knownHosts);
|
|
544
|
+
if (scanned !== serverFingerprint) throw new ComposeServerHostKeyMismatch(server.host, serverFingerprint, scanned);
|
|
545
|
+
console.log(`\n ✓ Host key ${scanned}, as the server reports it`);
|
|
546
|
+
if (repo) {
|
|
547
|
+
gh([
|
|
548
|
+
"api",
|
|
549
|
+
"--method",
|
|
550
|
+
"PUT",
|
|
551
|
+
`repos/${repo}/environments/${stage}`
|
|
552
|
+
]);
|
|
553
|
+
gh([
|
|
554
|
+
"variable",
|
|
555
|
+
"set",
|
|
556
|
+
"DEPLOY_KNOWN_HOSTS",
|
|
557
|
+
"--env",
|
|
558
|
+
stage,
|
|
559
|
+
"--repo",
|
|
560
|
+
repo,
|
|
561
|
+
"--body",
|
|
562
|
+
knownHosts
|
|
563
|
+
]);
|
|
564
|
+
gh([
|
|
565
|
+
"secret",
|
|
566
|
+
"set",
|
|
567
|
+
"DEPLOY_SSH_KEY",
|
|
568
|
+
"--env",
|
|
569
|
+
stage,
|
|
570
|
+
"--repo",
|
|
571
|
+
repo
|
|
572
|
+
], await (0, node_fs_promises.readFile)(keyFile, "utf-8"));
|
|
573
|
+
console.log(` ✓ GitHub: environment "${stage}", DEPLOY_SSH_KEY and DEPLOY_KNOWN_HOSTS`);
|
|
574
|
+
}
|
|
575
|
+
const known = (0, node_path.join)((0, node_path.dirname)(keyFile), `.gkm-known-${workspace.name}-${stage}`);
|
|
576
|
+
await (0, node_fs_promises.writeFile)(known, `${knownHosts}\n`);
|
|
577
|
+
try {
|
|
578
|
+
const asCi = [
|
|
579
|
+
"-i",
|
|
580
|
+
keyFile,
|
|
581
|
+
"-o",
|
|
582
|
+
"IdentitiesOnly=yes",
|
|
583
|
+
"-o",
|
|
584
|
+
"BatchMode=yes",
|
|
585
|
+
"-o",
|
|
586
|
+
`UserKnownHostsFile=${known}`,
|
|
587
|
+
"-o",
|
|
588
|
+
"StrictHostKeyChecking=yes",
|
|
589
|
+
...sshOptions(server)
|
|
590
|
+
];
|
|
591
|
+
const docker = await run("ssh", [
|
|
592
|
+
...asCi,
|
|
593
|
+
deployTarget,
|
|
594
|
+
"docker",
|
|
595
|
+
"version",
|
|
596
|
+
"--format",
|
|
597
|
+
"{{.Server.Version}}"
|
|
598
|
+
]);
|
|
599
|
+
if (docker.code !== 0) throw new ComposeServerCheckFailed(deployTarget, "docker", docker.stderr);
|
|
600
|
+
console.log(` ✓ ${deployTarget} runs docker (engine ${docker.stdout.trim()})`);
|
|
601
|
+
const tunnel = await run("ssh", [
|
|
602
|
+
...asCi,
|
|
603
|
+
"-W",
|
|
604
|
+
`127.0.0.1:${server.port}`,
|
|
605
|
+
deployTarget
|
|
606
|
+
]);
|
|
607
|
+
if (!tunnel.stdout.startsWith("SSH-2.0")) throw new ComposeServerCheckFailed(deployTarget, "tunnel", tunnel.stdout.slice(0, 80) || tunnel.stderr);
|
|
608
|
+
console.log(` ✓ ${deployTarget} opens tunnels (migrations)`);
|
|
609
|
+
} finally {
|
|
610
|
+
await (0, node_fs_promises.rm)(known, { force: true });
|
|
611
|
+
}
|
|
612
|
+
await (await require_seeds.DeployJournal.open(state, stage, () => require_seeds.createComposeState(stage))).ready({
|
|
613
|
+
key: SERVER_RECORD,
|
|
614
|
+
type: "server",
|
|
615
|
+
data: { host: server.host }
|
|
616
|
+
}, server.host);
|
|
617
|
+
console.log(` ✓ Recorded in the "${stage}" state`);
|
|
618
|
+
console.log(`\n✅ ${server.host} is ready for "${stage}".${repo ? " CI deploys it with the key it was given." : ""} To deploy from here, load the key first: ssh-add ${keyFile}\n`);
|
|
619
|
+
return {
|
|
620
|
+
server,
|
|
621
|
+
admin,
|
|
622
|
+
keyFile,
|
|
623
|
+
knownHosts,
|
|
624
|
+
...repo ? { repo } : {}
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
//#endregion
|
|
628
|
+
exports.composeServerCommand = composeServerCommand;
|
|
629
|
+
|
|
630
|
+
//# sourceMappingURL=serverSetup-CKs4K9gD.cjs.map
|