@geekmidas/cli 10.0.0-alpha.82 → 10.0.0-alpha.83
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/dist/{LegacyStateStore-Ceq7A_75.mjs → LegacyStateStore-DFO3aJgs.mjs} +2 -2
- package/dist/{LegacyStateStore-Ceq7A_75.mjs.map → LegacyStateStore-DFO3aJgs.mjs.map} +1 -1
- package/dist/{LegacyStateStore-Z-EKUGSX.cjs → LegacyStateStore-iUWVxrXU.cjs} +2 -2
- package/dist/{LegacyStateStore-Z-EKUGSX.cjs.map → LegacyStateStore-iUWVxrXU.cjs.map} +1 -1
- package/dist/{LocalStateStore-Bocb8dmZ.cjs → LocalStateStore-BsFHdSeA.cjs} +2 -2
- package/dist/{LocalStateStore-Bocb8dmZ.cjs.map → LocalStateStore-BsFHdSeA.cjs.map} +1 -1
- package/dist/{LocalStateStore-C72bwpG2.mjs → LocalStateStore-DIfuh0Z1.mjs} +2 -2
- package/dist/{LocalStateStore-C72bwpG2.mjs.map → LocalStateStore-DIfuh0Z1.mjs.map} +1 -1
- package/dist/{S3StateStore-C9upSW5o.mjs → S3StateStore-DR2f78Dj.mjs} +2 -2
- package/dist/{S3StateStore-C9upSW5o.mjs.map → S3StateStore-DR2f78Dj.mjs.map} +1 -1
- package/dist/{S3StateStore-35YfcdL_.cjs → S3StateStore-ytvpIiv8.cjs} +2 -2
- package/dist/{S3StateStore-35YfcdL_.cjs.map → S3StateStore-ytvpIiv8.cjs.map} +1 -1
- package/dist/{SSMStateStore-dOmFO6g1.mjs → SSMStateStore-BZ3XL0Mr.mjs} +2 -2
- package/dist/{SSMStateStore-dOmFO6g1.mjs.map → SSMStateStore-BZ3XL0Mr.mjs.map} +1 -1
- package/dist/{SSMStateStore-W-Ps22AQ.cjs → SSMStateStore-C1JruCD9.cjs} +2 -2
- package/dist/{SSMStateStore-W-Ps22AQ.cjs.map → SSMStateStore-C1JruCD9.cjs.map} +1 -1
- package/dist/{add-1T3y6E4M.cjs → add-Bwddb4KD.cjs} +3 -3
- package/dist/{add-1T3y6E4M.cjs.map → add-Bwddb4KD.cjs.map} +1 -1
- package/dist/{add-DnYHJOap.mjs → add-DkBEZ5_s.mjs} +3 -3
- package/dist/{add-DnYHJOap.mjs.map → add-DkBEZ5_s.mjs.map} +1 -1
- package/dist/{bundler-DlKdxCGh.mjs → bundler-B8TGsunu.mjs} +5 -5
- package/dist/{bundler-DlKdxCGh.mjs.map → bundler-B8TGsunu.mjs.map} +1 -1
- package/dist/{bundler-YNvLdvlh.cjs → bundler-BkH1kPEX.cjs} +5 -5
- package/dist/{bundler-YNvLdvlh.cjs.map → bundler-BkH1kPEX.cjs.map} +1 -1
- package/dist/{cli-qMszGvDu.mjs → cli-BgDd4cZB.mjs} +3 -3
- package/dist/{cli-qMszGvDu.mjs.map → cli-BgDd4cZB.mjs.map} +1 -1
- package/dist/{cli-CWee1-wU.cjs → cli-DO7DQqCq.cjs} +3 -3
- package/dist/{cli-CWee1-wU.cjs.map → cli-DO7DQqCq.cjs.map} +1 -1
- package/dist/{compose-D4sD4Lgr.mjs → compose-BPJ9bUKp.mjs} +3 -3
- package/dist/{compose-D4sD4Lgr.mjs.map → compose-BPJ9bUKp.mjs.map} +1 -1
- package/dist/{compose-qnDyPJNp.cjs → compose-CGyxYe-h.cjs} +3 -3
- package/dist/{compose-qnDyPJNp.cjs.map → compose-CGyxYe-h.cjs.map} +1 -1
- package/dist/{config-L_6NivCp.d.mts → config-BBFiH4qk.d.mts} +2 -2
- package/dist/{config-L_6NivCp.d.mts.map → config-BBFiH4qk.d.mts.map} +1 -1
- package/dist/{config-Mr4rcXFC.d.cts → config-DMdzdO5u.d.cts} +2 -2
- package/dist/{config-Mr4rcXFC.d.cts.map → config-DMdzdO5u.d.cts.map} +1 -1
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +2 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +1 -1
- package/dist/deploy/public.cjs +6 -6
- package/dist/deploy/public.d.cts +1 -1
- package/dist/deploy/public.d.mts +1 -1
- package/dist/deploy/public.mjs +6 -6
- package/dist/{deploy-C00DAKOt.mjs → deploy-0XpZDYAr.mjs} +5 -5
- package/dist/{deploy-C00DAKOt.mjs.map → deploy-0XpZDYAr.mjs.map} +1 -1
- package/dist/{deploy-CXP2fXvK.cjs → deploy-BlZx6J5x.cjs} +5 -5
- package/dist/{deploy-CXP2fXvK.cjs.map → deploy-BlZx6J5x.cjs.map} +1 -1
- package/dist/{dokploy-B3zoCmJb.mjs → dokploy-Crh4uDmP.mjs} +2 -2
- package/dist/{dokploy-B3zoCmJb.mjs.map → dokploy-Crh4uDmP.mjs.map} +1 -1
- package/dist/{dokploy-BHcSmghb.cjs → dokploy-rjXmkuwH.cjs} +2 -2
- package/dist/{dokploy-BHcSmghb.cjs.map → dokploy-rjXmkuwH.cjs.map} +1 -1
- package/dist/{encryption-DPFljXtM.mjs → encryption-0eo9aY_H.mjs} +3 -3
- package/dist/{encryption-DPFljXtM.mjs.map → encryption-0eo9aY_H.mjs.map} +1 -1
- package/dist/{encryption-DLin89I_.cjs → encryption-CxTfRx4h.cjs} +3 -3
- package/dist/{encryption-DLin89I_.cjs.map → encryption-CxTfRx4h.cjs.map} +1 -1
- package/dist/{engine-BS3iX9Mu.cjs → engine-CMzSebbs.cjs} +4 -4
- package/dist/{engine-BS3iX9Mu.cjs.map → engine-CMzSebbs.cjs.map} +1 -1
- package/dist/{engine-CgzgIg-_.mjs → engine-DxWswfXe.mjs} +4 -4
- package/dist/{engine-CgzgIg-_.mjs.map → engine-DxWswfXe.mjs.map} +1 -1
- package/dist/{github-D8KVmNRg.cjs → github-Dukt5cJe.cjs} +3 -3
- package/dist/{github-D8KVmNRg.cjs.map → github-Dukt5cJe.cjs.map} +1 -1
- package/dist/{github-DL4zwJsR.mjs → github-HOfOpFI_.mjs} +3 -3
- package/dist/{github-DL4zwJsR.mjs.map → github-HOfOpFI_.mjs.map} +1 -1
- package/dist/{index-DTEPwLml.d.cts → index-DFrbhRwg.d.cts} +6 -2
- package/dist/{index-C0UmP_lg.d.mts.map → index-DFrbhRwg.d.cts.map} +1 -1
- package/dist/{index-C0UmP_lg.d.mts → index-Wuqpf316.d.mts} +6 -2
- package/dist/{index-DTEPwLml.d.cts.map → index-Wuqpf316.d.mts.map} +1 -1
- package/dist/index.cjs +427 -111
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +427 -111
- package/dist/index.mjs.map +1 -1
- package/dist/{migrate-CCejlgU0.mjs → migrate-1dGEzuJ-.mjs} +3 -3
- package/dist/{migrate-CCejlgU0.mjs.map → migrate-1dGEzuJ-.mjs.map} +1 -1
- package/dist/{migrate-BdKhIJgT.cjs → migrate-Bemd4tkz.cjs} +3 -3
- package/dist/{migrate-BdKhIJgT.cjs.map → migrate-Bemd4tkz.cjs.map} +1 -1
- package/dist/{migrate-DIjG8-QR.cjs → migrate-BgPWVnAZ.cjs} +3 -3
- package/dist/{migrate-DIjG8-QR.cjs.map → migrate-BgPWVnAZ.cjs.map} +1 -1
- package/dist/{migrate-Cd3kcI7o.mjs → migrate-C14NNbFx.mjs} +3 -3
- package/dist/{migrate-Cd3kcI7o.mjs.map → migrate-C14NNbFx.mjs.map} +1 -1
- package/dist/openapi.cjs +1 -1
- package/dist/openapi.mjs +1 -1
- package/dist/{resolve-ApSUK_HB.cjs → resolve-DCTcD823.cjs} +3 -3
- package/dist/{resolve-ApSUK_HB.cjs.map → resolve-DCTcD823.cjs.map} +1 -1
- package/dist/{resolve-DY9TaVeV.mjs → resolve-y1PkSZrF.mjs} +3 -3
- package/dist/{resolve-DY9TaVeV.mjs.map → resolve-y1PkSZrF.mjs.map} +1 -1
- package/dist/{rollback-CdGhCk1d.cjs → rollback-BVQFDjxr.cjs} +5 -5
- package/dist/{rollback-CdGhCk1d.cjs.map → rollback-BVQFDjxr.cjs.map} +1 -1
- package/dist/{rollback-DXU6cr7q.mjs → rollback-CwVhG_xa.mjs} +5 -5
- package/dist/{rollback-DXU6cr7q.mjs.map → rollback-CwVhG_xa.mjs.map} +1 -1
- package/dist/{seeds-DbyqaXW4.mjs → seeds-BoKQ74Od.mjs} +3 -3
- package/dist/{seeds-DbyqaXW4.mjs.map → seeds-BoKQ74Od.mjs.map} +1 -1
- package/dist/{seeds-BLzrSwEr.cjs → seeds-Ccju3zGl.cjs} +3 -3
- package/dist/{seeds-BLzrSwEr.cjs.map → seeds-Ccju3zGl.cjs.map} +1 -1
- package/dist/{sniffer-ByWtH28i.mjs → sniffer-6oYI-MpT.mjs} +6 -6
- package/dist/{sniffer-ByWtH28i.mjs.map → sniffer-6oYI-MpT.mjs.map} +1 -1
- package/dist/{sniffer-BjG-1mlD.cjs → sniffer-DeyYI9Iv.cjs} +6 -6
- package/dist/{sniffer-BjG-1mlD.cjs.map → sniffer-DeyYI9Iv.cjs.map} +1 -1
- package/dist/stages-CHF9RFog.mjs +174 -0
- package/dist/stages-CHF9RFog.mjs.map +1 -0
- package/dist/stages-CwrYVX9u.cjs +174 -0
- package/dist/stages-CwrYVX9u.cjs.map +1 -0
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.mjs +1 -1
- package/dist/workspace/index.cjs +2 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +2 -2
- package/dist/{workspace-Bp8FEkF-.cjs → workspace-4i6Jwsoa.cjs} +22 -2
- package/dist/{workspace-Bp8FEkF-.cjs.map → workspace-4i6Jwsoa.cjs.map} +1 -1
- package/dist/{workspace-BBdqmkch.mjs → workspace-DD9mtPy8.mjs} +11 -3
- package/dist/{workspace-BBdqmkch.mjs.map → workspace-DD9mtPy8.mjs.map} +1 -1
- package/package.json +15 -15
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
2
|
const require_credentials = require("./credentials-BVs7mrtw.cjs");
|
|
3
3
|
const require_sandbox = require("./sandbox-CL--ZDui.cjs");
|
|
4
|
-
const require_workspace = require("./workspace-
|
|
4
|
+
const require_workspace = require("./workspace-4i6Jwsoa.cjs");
|
|
5
5
|
const require_config = require("./config.cjs");
|
|
6
|
-
const require_seeds = require("./seeds-
|
|
7
|
-
const require_sniffer = require("./sniffer-
|
|
8
|
-
const require_engine = require("./engine-
|
|
6
|
+
const require_seeds = require("./seeds-Ccju3zGl.cjs");
|
|
7
|
+
const require_sniffer = require("./sniffer-DeyYI9Iv.cjs");
|
|
8
|
+
const require_engine = require("./engine-CMzSebbs.cjs");
|
|
9
9
|
let node_path = require("node:path");
|
|
10
10
|
//#region src/target/dokploy/rollback.ts
|
|
11
11
|
/**
|
|
@@ -158,4 +158,4 @@ Object.defineProperty(exports, "rollback_exports", {
|
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
160
|
|
|
161
|
-
//# sourceMappingURL=rollback-
|
|
161
|
+
//# sourceMappingURL=rollback-BVQFDjxr.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollback-
|
|
1
|
+
{"version":3,"file":"rollback-BVQFDjxr.cjs","names":["storedCredentials","LocalSandbox","findWorkspaceRoot","resolve","withSandbox","loadWorkspaceConfig","createStateStore","DeployJournal","createEmptyState","dokployApi","verifySettings","restoreImage"],"sources":["../src/target/dokploy/rollback.ts"],"sourcesContent":["/**\n * `gkm deploy:rollback`: a stage's apps put back on the release before the\n * one they run, by hand — for a release that passed its checks and turned out\n * wrong anyway.\n *\n * One app by default, because an app is what usually broke: rolling the API\n * back over a site fix that shipped beside it undoes the fix too. `atomic`\n * rolls back every app that has a release to go back to, for apps that only\n * work together — an API and the site built against its newer contract.\n *\n * It restores images and nothing else. The environment an app runs with is\n * the stage's, resolved on every deploy, and migrations are forward-only: a\n * migration that the older code cannot run against is undone by a new\n * migration, never by a rollback.\n */\n\nimport { resolve } from 'node:path';\nimport { findWorkspaceRoot, loadWorkspaceConfig } from '../../config';\nimport {\n\ttype CredentialProvider,\n\tstoredCredentials,\n} from '../../deploy/credentials';\nimport { DeployJournal } from '../../deploy/journal';\nimport { createStateStore } from '../../deploy/StateStore';\nimport {\n\tcreateEmptyState,\n\ttype ReleasedImage,\n\trecordRollback,\n} from '../../deploy/state';\nimport { LocalSandbox } from '../../sandbox/local';\nimport { type Sandbox, withSandbox } from '../../sandbox/sandbox';\nimport { assertDeployedStage } from '../../workspace/stages';\nimport { dokployApi, restoreImage, verifySettings } from './engine';\n\nexport interface RollbackInput {\n\t/** The project: the directory holding `gkm.config.ts`, or one inside it. */\n\tcwd: string;\n\tstage: string;\n\t/** The app to roll back. */\n\tapp?: string;\n\t/** Every app with an earlier release, instead of one. */\n\tatomic?: boolean;\n\t/** Defaults to the environment, then the logins `gkm login` stored. */\n\tcredentials?: CredentialProvider;\n\tsignal?: AbortSignal;\n\t/** Each progress line. Defaults to none. */\n\tlog?: (line: string) => void;\n\t/** Where the config is loaded. Defaults to a `LocalSandbox` on the project. */\n\tsandbox?: Sandbox;\n}\n\n/** One app rolled back. */\nexport interface RolledBack {\n\tapp: string;\n\tfrom: ReleasedImage;\n\tto: ReleasedImage;\n}\n\n/** Neither an app nor every app was asked for. */\nexport class RollbackNeedsApp extends Error {\n\tconstructor(\n\t\treadonly stage: string,\n\t\t/** The apps that have a release to go back to. */\n\t\treadonly apps: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`Say what to roll back: --app <name> for one app (${apps.join(', ') || 'none has an earlier release'}), ` +\n\t\t\t\t`or --atomic for every app of \"${stage}\" together.`,\n\t\t);\n\t\tthis.name = 'RollbackNeedsApp';\n\t}\n}\n\n/** An app has no release before the one it runs. */\nexport class NothingToRollBack extends Error {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly app: string,\n\t) {\n\t\tsuper(\n\t\t\t`\"${app}\" has no earlier release on \"${stage}\" to roll back to: it has been released once, ` +\n\t\t\t\t'or every earlier release was itself rolled back. Deploy the version you want instead.',\n\t\t);\n\t\tthis.name = 'NothingToRollBack';\n\t}\n}\n\n/** The stage was never deployed through Dokploy from this state. */\nexport class StageNeverDeployed extends Error {\n\tconstructor(readonly stage: string) {\n\t\tsuper(\n\t\t\t`\"${stage}\" has no deploy state, so there is nothing to roll back. ` +\n\t\t\t\t'Check the stage name, and that `state` in gkm.config.ts points at the store the deploys write to.',\n\t\t);\n\t\tthis.name = 'StageNeverDeployed';\n\t}\n}\n\n/**\n * Roll a stage's app — or, `atomic`, all of them — back to its previous\n * release, holding the stage's lock as a deploy does.\n */\nexport async function rollbackStage(\n\tinput: RollbackInput,\n): Promise<RolledBack[]> {\n\tconst signal = input.signal ?? new AbortController().signal;\n\tconst log = input.log ?? (() => {});\n\tconst credentials = input.credentials ?? storedCredentials();\n\tconst sandbox =\n\t\tinput.sandbox ??\n\t\tnew LocalSandbox({ root: findWorkspaceRoot(resolve(input.cwd)) });\n\n\treturn withSandbox(sandbox, async () => {\n\t\tconst { workspace } = await loadWorkspaceConfig(resolve(input.cwd), {\n\t\t\tsandbox,\n\t\t});\n\t\tassertDeployedStage(workspace.stages, input.stage);\n\n\t\tconst store = await createStateStore({\n\t\t\tconfig: workspace.state,\n\t\t\tworkspaceRoot: workspace.root,\n\t\t\tworkspaceName: workspace.name,\n\t\t});\n\t\tif (!(await store.read(input.stage))) {\n\t\t\tthrow new StageNeverDeployed(input.stage);\n\t\t}\n\n\t\tconst lock = await store.lock(input.stage, { operation: 'rollback' });\n\t\ttry {\n\t\t\tconst journal = await DeployJournal.open(store, input.stage, () =>\n\t\t\t\tcreateEmptyState(input.stage, '', ''),\n\t\t\t);\n\t\t\tconst { state } = journal;\n\t\t\tconst releases = state.releases ?? {};\n\t\t\tconst restorable = Object.keys(releases).filter(\n\t\t\t\t(app) => releases[app]!.previous,\n\t\t\t);\n\n\t\t\tlet apps: string[];\n\t\t\tif (input.atomic) {\n\t\t\t\tapps = restorable;\n\t\t\t\tif (apps.length === 0) {\n\t\t\t\t\tthrow new RollbackNeedsApp(input.stage, restorable);\n\t\t\t\t}\n\t\t\t} else if (input.app) {\n\t\t\t\tif (!releases[input.app]?.previous) {\n\t\t\t\t\tthrow new NothingToRollBack(input.stage, input.app);\n\t\t\t\t}\n\t\t\t\tapps = [input.app];\n\t\t\t} else {\n\t\t\t\tthrow new RollbackNeedsApp(input.stage, restorable);\n\t\t\t}\n\n\t\t\tconst { api } = await dokployApi(workspace, { credentials, signal });\n\t\t\tconst verify = verifySettings(workspace.deploy.dokploy?.verify);\n\t\t\tconst rolled: RolledBack[] = [];\n\n\t\t\tfor (const app of apps) {\n\t\t\t\tsignal.throwIfAborted();\n\t\t\t\tconst { current, previous } = releases[app]!;\n\t\t\t\tconst applicationId = state.applications[app];\n\t\t\t\tif (!previous || !applicationId) {\n\t\t\t\t\tthrow new NothingToRollBack(input.stage, app);\n\t\t\t\t}\n\n\t\t\t\tlog(`⏪ ${app}: ${current.ref} → ${previous.ref}`);\n\t\t\t\tawait restoreImage(api, {\n\t\t\t\t\tapplicationId,\n\t\t\t\t\timage: previous,\n\t\t\t\t\tregistryId: state.registryId,\n\t\t\t\t\tverify,\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\t\t\t\trecordRollback(state, app, previous);\n\t\t\t\tawait journal.save();\n\t\t\t\tlog(` ✓ ${app} is running ${previous.ref}`);\n\t\t\t\trolled.push({ app, from: current, to: previous });\n\t\t\t}\n\n\t\t\treturn rolled;\n\t\t} finally {\n\t\t\tawait lock.release();\n\t\t}\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,IAAa,mBAAb,cAAsC,MAAM;CAEjC;CAEA;CAHV,YACC,OAEA,MACC;EACD,MACC,oDAAoD,KAAK,KAAK,IAAI,KAAK,8BAA8B,mCACnE,MAAM,YACzC;EAPS,KAAA,QAAA;EAEA,KAAA,OAAA;EAMT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,oBAAb,cAAuC,MAAM;CAElC;CACA;CAFV,YACC,OACA,KACC;EACD,MACC,IAAI,IAAI,+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B70k3.mjs";
|
|
3
3
|
import { c as withSandbox } from "./sandbox-Dm247NGx.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { j as assertDeployedStage } from "./workspace-DD9mtPy8.mjs";
|
|
5
5
|
import { findWorkspaceRoot, loadWorkspaceConfig } from "./config.mjs";
|
|
6
|
-
import { _ as DeployJournal, a as createEmptyState, u as recordRollback } from "./seeds-
|
|
7
|
-
import { g as createStateStore } from "./sniffer-
|
|
8
|
-
import { i as dokployApi, l as restoreImage, p as verifySettings } from "./engine-
|
|
6
|
+
import { _ as DeployJournal, a as createEmptyState, u as recordRollback } from "./seeds-BoKQ74Od.mjs";
|
|
7
|
+
import { g as createStateStore } from "./sniffer-6oYI-MpT.mjs";
|
|
8
|
+
import { i as dokployApi, l as restoreImage, p as verifySettings } from "./engine-DxWswfXe.mjs";
|
|
9
9
|
import { resolve } from "node:path";
|
|
10
10
|
//#region src/target/dokploy/rollback.ts
|
|
11
11
|
/**
|
|
@@ -129,4 +129,4 @@ async function rollbackStage(input) {
|
|
|
129
129
|
//#endregion
|
|
130
130
|
export { rollback_exports as a, rollbackStage as i, RollbackNeedsApp as n, StageNeverDeployed as r, NothingToRollBack as t };
|
|
131
131
|
|
|
132
|
-
//# sourceMappingURL=rollback-
|
|
132
|
+
//# sourceMappingURL=rollback-CwVhG_xa.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollback-
|
|
1
|
+
{"version":3,"file":"rollback-CwVhG_xa.mjs","names":[],"sources":["../src/target/dokploy/rollback.ts"],"sourcesContent":["/**\n * `gkm deploy:rollback`: a stage's apps put back on the release before the\n * one they run, by hand — for a release that passed its checks and turned out\n * wrong anyway.\n *\n * One app by default, because an app is what usually broke: rolling the API\n * back over a site fix that shipped beside it undoes the fix too. `atomic`\n * rolls back every app that has a release to go back to, for apps that only\n * work together — an API and the site built against its newer contract.\n *\n * It restores images and nothing else. The environment an app runs with is\n * the stage's, resolved on every deploy, and migrations are forward-only: a\n * migration that the older code cannot run against is undone by a new\n * migration, never by a rollback.\n */\n\nimport { resolve } from 'node:path';\nimport { findWorkspaceRoot, loadWorkspaceConfig } from '../../config';\nimport {\n\ttype CredentialProvider,\n\tstoredCredentials,\n} from '../../deploy/credentials';\nimport { DeployJournal } from '../../deploy/journal';\nimport { createStateStore } from '../../deploy/StateStore';\nimport {\n\tcreateEmptyState,\n\ttype ReleasedImage,\n\trecordRollback,\n} from '../../deploy/state';\nimport { LocalSandbox } from '../../sandbox/local';\nimport { type Sandbox, withSandbox } from '../../sandbox/sandbox';\nimport { assertDeployedStage } from '../../workspace/stages';\nimport { dokployApi, restoreImage, verifySettings } from './engine';\n\nexport interface RollbackInput {\n\t/** The project: the directory holding `gkm.config.ts`, or one inside it. */\n\tcwd: string;\n\tstage: string;\n\t/** The app to roll back. */\n\tapp?: string;\n\t/** Every app with an earlier release, instead of one. */\n\tatomic?: boolean;\n\t/** Defaults to the environment, then the logins `gkm login` stored. */\n\tcredentials?: CredentialProvider;\n\tsignal?: AbortSignal;\n\t/** Each progress line. Defaults to none. */\n\tlog?: (line: string) => void;\n\t/** Where the config is loaded. Defaults to a `LocalSandbox` on the project. */\n\tsandbox?: Sandbox;\n}\n\n/** One app rolled back. */\nexport interface RolledBack {\n\tapp: string;\n\tfrom: ReleasedImage;\n\tto: ReleasedImage;\n}\n\n/** Neither an app nor every app was asked for. */\nexport class RollbackNeedsApp extends Error {\n\tconstructor(\n\t\treadonly stage: string,\n\t\t/** The apps that have a release to go back to. */\n\t\treadonly apps: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`Say what to roll back: --app <name> for one app (${apps.join(', ') || 'none has an earlier release'}), ` +\n\t\t\t\t`or --atomic for every app of \"${stage}\" together.`,\n\t\t);\n\t\tthis.name = 'RollbackNeedsApp';\n\t}\n}\n\n/** An app has no release before the one it runs. */\nexport class NothingToRollBack extends Error {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly app: string,\n\t) {\n\t\tsuper(\n\t\t\t`\"${app}\" has no earlier release on \"${stage}\" to roll back to: it has been released once, ` +\n\t\t\t\t'or every earlier release was itself rolled back. Deploy the version you want instead.',\n\t\t);\n\t\tthis.name = 'NothingToRollBack';\n\t}\n}\n\n/** The stage was never deployed through Dokploy from this state. */\nexport class StageNeverDeployed extends Error {\n\tconstructor(readonly stage: string) {\n\t\tsuper(\n\t\t\t`\"${stage}\" has no deploy state, so there is nothing to roll back. ` +\n\t\t\t\t'Check the stage name, and that `state` in gkm.config.ts points at the store the deploys write to.',\n\t\t);\n\t\tthis.name = 'StageNeverDeployed';\n\t}\n}\n\n/**\n * Roll a stage's app — or, `atomic`, all of them — back to its previous\n * release, holding the stage's lock as a deploy does.\n */\nexport async function rollbackStage(\n\tinput: RollbackInput,\n): Promise<RolledBack[]> {\n\tconst signal = input.signal ?? new AbortController().signal;\n\tconst log = input.log ?? (() => {});\n\tconst credentials = input.credentials ?? storedCredentials();\n\tconst sandbox =\n\t\tinput.sandbox ??\n\t\tnew LocalSandbox({ root: findWorkspaceRoot(resolve(input.cwd)) });\n\n\treturn withSandbox(sandbox, async () => {\n\t\tconst { workspace } = await loadWorkspaceConfig(resolve(input.cwd), {\n\t\t\tsandbox,\n\t\t});\n\t\tassertDeployedStage(workspace.stages, input.stage);\n\n\t\tconst store = await createStateStore({\n\t\t\tconfig: workspace.state,\n\t\t\tworkspaceRoot: workspace.root,\n\t\t\tworkspaceName: workspace.name,\n\t\t});\n\t\tif (!(await store.read(input.stage))) {\n\t\t\tthrow new StageNeverDeployed(input.stage);\n\t\t}\n\n\t\tconst lock = await store.lock(input.stage, { operation: 'rollback' });\n\t\ttry {\n\t\t\tconst journal = await DeployJournal.open(store, input.stage, () =>\n\t\t\t\tcreateEmptyState(input.stage, '', ''),\n\t\t\t);\n\t\t\tconst { state } = journal;\n\t\t\tconst releases = state.releases ?? {};\n\t\t\tconst restorable = Object.keys(releases).filter(\n\t\t\t\t(app) => releases[app]!.previous,\n\t\t\t);\n\n\t\t\tlet apps: string[];\n\t\t\tif (input.atomic) {\n\t\t\t\tapps = restorable;\n\t\t\t\tif (apps.length === 0) {\n\t\t\t\t\tthrow new RollbackNeedsApp(input.stage, restorable);\n\t\t\t\t}\n\t\t\t} else if (input.app) {\n\t\t\t\tif (!releases[input.app]?.previous) {\n\t\t\t\t\tthrow new NothingToRollBack(input.stage, input.app);\n\t\t\t\t}\n\t\t\t\tapps = [input.app];\n\t\t\t} else {\n\t\t\t\tthrow new RollbackNeedsApp(input.stage, restorable);\n\t\t\t}\n\n\t\t\tconst { api } = await dokployApi(workspace, { credentials, signal });\n\t\t\tconst verify = verifySettings(workspace.deploy.dokploy?.verify);\n\t\t\tconst rolled: RolledBack[] = [];\n\n\t\t\tfor (const app of apps) {\n\t\t\t\tsignal.throwIfAborted();\n\t\t\t\tconst { current, previous } = releases[app]!;\n\t\t\t\tconst applicationId = state.applications[app];\n\t\t\t\tif (!previous || !applicationId) {\n\t\t\t\t\tthrow new NothingToRollBack(input.stage, app);\n\t\t\t\t}\n\n\t\t\t\tlog(`⏪ ${app}: ${current.ref} → ${previous.ref}`);\n\t\t\t\tawait restoreImage(api, {\n\t\t\t\t\tapplicationId,\n\t\t\t\t\timage: previous,\n\t\t\t\t\tregistryId: state.registryId,\n\t\t\t\t\tverify,\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\t\t\t\trecordRollback(state, app, previous);\n\t\t\t\tawait journal.save();\n\t\t\t\tlog(` ✓ ${app} is running ${previous.ref}`);\n\t\t\t\trolled.push({ app, from: current, to: previous });\n\t\t\t}\n\n\t\t\treturn rolled;\n\t\t} finally {\n\t\t\tawait lock.release();\n\t\t}\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,IAAa,mBAAb,cAAsC,MAAM;CAEjC;CAEA;CAHV,YACC,OAEA,MACC;EACD,MACC,oDAAoD,KAAK,KAAK,IAAI,KAAK,8BAA8B,mCACnE,MAAM,YACzC;EAPS,KAAA,QAAA;EAEA,KA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vC,QAAQ,SAAS,IAAI,CAAE,QACzB;GAEA,IAAI;GACJ,IAAI,MAAM,QAAQ;IACjB,OAAO;IACP,IAAI,KAAK,WAAW,GACnB,MAAM,IAAI,iBAAiB,MAAM,OAAO,UAAU;GAEpD,OAAO,IAAI,MAAM,KAAK;IACrB,IAAI,CAAC,SAAS,MAAM,IAAI,EAAE,UACzB,MAAM,IAAI,kBAAkB,MAAM,OAAO,MAAM,GAAG;IAEnD,OAAO,CAAC,MAAM,GAAG;GAClB,OACC,MAAM,IAAI,iBAAiB,MAAM,OAAO,UAAU;GAGnD,MAAM,EAAE,QAAQ,MAAM,WAAW,WAAW;IAAE;IAAa;GAAO,CAAC;GACnE,MAAM,SAAS,eAAe,UAAU,OAAO,SAAS,MAAM;GAC9D,MAAM,SAAuB,CAAC;GAE9B,KAAK,MAAM,OAAO,MAAM;IACvB,OAAO,eAAe;IACtB,MAAM,EAAE,SAAS,aAAa,SAAS;IACvC,MAAM,gBAAgB,MAAM,aAAa;IACzC,IAAI,CAAC,YAAY,CAAC,eACjB,MAAM,IAAI,kBAAkB,MAAM,OAAO,GAAG;IAG7C,IAAI,KAAK,IAAI,IAAI,QAAQ,IAAI,KAAK,SAAS,KAAK;IAChD,MAAM,aAAa,KAAK;KACvB;KACA,OAAO;KACP,YAAY,MAAM;KAClB;KACA;IACD,CAAC;IACD,eAAe,OAAO,KAAK,QAAQ;IACnC,MAAM,QAAQ,KAAK;IACnB,IAAI,QAAQ,IAAI,cAAc,SAAS,KAAK;IAC5C,OAAO,KAAK;KAAE;KAAK,MAAM;KAAS,IAAI;IAAS,CAAC;GACjD;GAEA,OAAO;EACR,UAAU;GACT,MAAM,KAAK,QAAQ;EACpB;CACD,CAAC;AACF"}
|
|
@@ -2,10 +2,10 @@ import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
|
2
2
|
import { i as run$1, s as gkmHome } from "./run-BJLIerMM.mjs";
|
|
3
3
|
import { d as output, r as discover, u as ConstructGenerator } from "./discover-BPelzeGW.mjs";
|
|
4
4
|
import { t as appKey } from "./derive-B4vDpzgP.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { B as UnknownSecretsStoreProvider, L as LOGS_PORT, g as getPublicEnvPrefix, h as PUBLIC_ENV_PREFIXES, k as TEST_STAGE, r as allConstructGlobs } from "./workspace-DD9mtPy8.mjs";
|
|
6
6
|
import { ConfigNotFound, NotInAnApp, loadWorkspaceAppInfo, loadWorkspaceConfig } from "./config.mjs";
|
|
7
7
|
import { n as runtimeFor, r as generateTelemetryModule, s as telemetryArgs } from "./EndpointGenerator-DtnIGafh.mjs";
|
|
8
|
-
import { c as runtimeOf } from "./resolve-
|
|
8
|
+
import { c as runtimeOf } from "./resolve-y1PkSZrF.mjs";
|
|
9
9
|
import { a as DEFAULT_STORAGE, i as DEFAULT_EVENTS$1, n as readFakes, o as holdsEveryCache, r as DEFAULT_CACHE, t as SubscriberGenerator } from "./SubscriberGenerator-DQZeGkDW.mjs";
|
|
10
10
|
import { basename, dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
|
|
11
11
|
import { constants, existsSync, readFileSync } from "node:fs";
|
|
@@ -7453,4 +7453,4 @@ function reportPlannedSeeds(planned, log) {
|
|
|
7453
7453
|
//#endregion
|
|
7454
7454
|
export { postgresSuperuser as $, EMULATOR_ACCESS_KEY_ID as $t, UnknownDevService as A, projectName as An, appEnvKeys as At, WorkerGenerator as B, imageLayout as Bt, workerDockerfile as C, applicationName as Cn, postgresDatabaseNames as Ct, DevServicesNeedServerTarget as D, isOwnedBy as Dn, ensurePostgresLogin as Dt, DEV_SERVICES as E, imageRef as En, LEGACY_LOCAL_LOGIN as Et, parseDevServices as F, withCustomSecret as Fn, localRolePassword as Ft, FAKE_ENV as G, imageBuildCredentials as Gt, workerEntryDir as H, WORKER_PORT as Ht, reportDevServices as I, planFor as It, derivedContainers as J, eventsBackendFor as Jt, backendsOf as K, isImageBuild as Kt, requiredStageKeys as L, resourceName as Lt, devServicesUsed as M, maskPassword as Mn, networkEnv as Mt, externalServices as N, storage_exports as Nn, workerEnvKeys as Nt, ExternalServicesNotConfigured as O, markerOf as On, bucketClient as Ot, manifestServiceDeclarations as P, toEmbeddableSecrets as Pn, envFor as Pt, loadLocalCredentials as Q, composeFor as Qt, suppliedOnly as R, hostFor as Rt, ensureDockerignore as S, readKey as Sn, bucketPolicies as St, validateImageRef as T, imageName as Tn, quoteIdentifier as Tt, QueueGenerator as U, detectPackageManager as Ut, workerBundleName as V, TURBO_VERSION as Vt, CronGenerator as W, findBuildRoot as Wt, workspace_exports as X, storageBackendFor as Xt, reconcileWorkspace as Y, providerOf as Yt, LOCAL_RABBITMQ_USER as Z, CLUSTER_DATABASE as Zt, DeployJournal as _, store_exports as _n, LOCAL_CA_PATH as _t, createEmptyState as a, primaryPortKey as an, runsRedis as at, appDockerfile as b, keystoreProject as bn, applyPolicies as bt, isDnsVerified as c, findAvailablePort as cn, LOGS_SERVICE as ct, setApplicationId as d, loadPortState as dn, stackLogs as dt, DEFAULT_IMAGES as en, readLocalCredentials as et, setBackupState as f, loadSecretsForApp as fn, withLogsPassword as ft, setPostgresBackupId as g, storeFromConfig as gn, otelEnv as gt, setGeneratedSecret as h, secretsStoreFor as hn, resolveHost as ht, assertNoStaleSecrets as i, portsOf as in, redisService as it, assertExternalServices as j, initStageSecrets as jn, dockerfileOf as jt, STORAGE_KEY_PAIR as k, ownershipMarker as kn, pgClient as kt, recordRelease as l, isPortAvailable as ln, logsAccess as lt, setDnsVerification as m, isRemoteStore as mn, isMainFrontendApp as mt, reportDatabaseRuns as n, fakeKey as nn, REDIS_SERVICE as nt, getBackupState as o, createCredentialsPreload as on, stackRedis as ot, setDnsRecord as p, prepareEntryCredentials as pn, NoDomainForStage as pt, constructGlobs as q, cacheBackendFor as qt, reportPlannedSeeds as r, portKeys as rn, STACK_CACHE as rt, getGeneratedSecret as s, createEntryWrapper as sn, withRedisPassword as st, DeploySeedsFailed as t, describeServices as tn, withGeneratedSecrets as tt, recordRollback as u, loadEnvFiles as un, logsService as ut, DockerBuildFailed as v, FileSecretsStore as vn, forgetState as vt, workerDockerfileOf as w, deployIdentity as wn, postgresStatements as wt, dockerCommand as x, projectKey as xn, applyPostgres as xt, DockerPushFailed as y, getKeyPath as yn, applyBuckets as yt, workerUnits as z, composeBuildPaths as zt };
|
|
7455
7455
|
|
|
7456
|
-
//# sourceMappingURL=seeds-
|
|
7456
|
+
//# sourceMappingURL=seeds-BoKQ74Od.mjs.map
|