From b3968c1b3d67c21e422657952299093f4756cfff Mon Sep 17 00:00:00 2001 From: mwaiyee Date: Wed, 19 Aug 2026 09:44:39 +0800 Subject: [PATCH 1/6] update version on develop branch to 0.18.0 --- .github/workflows/d2e-demosetup-release.yml | 4 ++-- package.json | 2 +- scripts/cli.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/d2e-demosetup-release.yml b/.github/workflows/d2e-demosetup-release.yml index 595e163d4b..cff62731b5 100644 --- a/.github/workflows/d2e-demosetup-release.yml +++ b/.github/workflows/d2e-demosetup-release.yml @@ -6,13 +6,13 @@ on: workflow_dispatch: inputs: version: - default: "0.17.0-beta" + default: "0.18.0-beta" description: Enter version to use required: true type: string env: - DEFAULT_VERSION: "0.17.0-beta" + DEFAULT_VERSION: "0.18.0-beta" jobs: demosetup: diff --git a/package.json b/package.json index 8154039c94..76b7fa00be 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ohdsi/d2e", - "version": "0.17.0", + "version": "0.18.0", "description": "Data2Evidence Installer", "license": "Apache-2.0", "homepage": "https://d2e.sg", diff --git a/scripts/cli.ts b/scripts/cli.ts index eeb2cab5d5..ec845d9531 100644 --- a/scripts/cli.ts +++ b/scripts/cli.ts @@ -39,8 +39,8 @@ interface CliOptions { class D2ECli { version: string; - LATEST_DOCKER_TAG_NAME: string = "0.17.0-beta"; // Update this as needed - default_version: string = "0.17.0"; // Update this as needed default/base version + LATEST_DOCKER_TAG_NAME: string = "0.18.0-beta"; // Update this as needed + default_version: string = "0.18.0"; // Update this as needed default/base version CADDY__CONFIG: string; ENV_TYPE: string; DOCKER_LOG_LEVEL: string; From a9e63380bf59275ab55eb80a868c81bf286f69ac Mon Sep 17 00:00:00 2001 From: mwaiyee Date: Thu, 20 Aug 2026 15:49:45 +0800 Subject: [PATCH 2/6] Replace the staged atlas-db-init directory instead of only adding to it --- scripts/cli.ts | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/scripts/cli.ts b/scripts/cli.ts index ec845d9531..e580bf1730 100644 --- a/scripts/cli.ts +++ b/scripts/cli.ts @@ -91,21 +91,41 @@ class D2ECli { "services", "atlas-db-init" ); + if (!this.replace_staged_dir(atlasDbInitDir)) { + return; + } + for (const [name, content] of Object.entries(atlasDbInitScripts)) { + this.write_embedded_file(path.join(atlasDbInitDir, name), content); + } + } + + // Clear the staged directory before rewriting it, so its contents always + // match the embedded set exactly. webapi-init globs whatever it finds + // (`for f in /scripts/*.sql`) instead of reading a manifest, so a script a + // previous CLI version staged and no longer ships would still be executed -- + // and under ON_ERROR_STOP=1 one that no longer applies fails the whole init. + // Removing first makes stale scripts impossible rather than something to + // detect after the fact. + // + // Only the directory this CLI authors is removed. compose_dir is the repo + // root when the CLI runs from a checkout, so the `services/` above this holds + // the real service sources and must never be touched. + private replace_staged_dir(dir: string): boolean { try { - fs.mkdirSync(atlasDbInitDir, { recursive: true }); + fs.rmSync(dir, { recursive: true, force: true }); + fs.mkdirSync(dir, { recursive: true }); + return true; } catch (err: any) { if (err?.code === "EACCES" || err?.code === "EPERM") { console.warn( - `Warning: could not create ${atlasDbInitDir} (permission denied). ` + - `Skipping atlas-db-init staging; continuing with existing files.` + `Warning: could not replace ${dir} (permission denied). ` + + `It looks owned by another user (e.g. root from a release download). ` + + `Continuing with the existing files.` ); - return; + return false; } throw err; } - for (const [name, content] of Object.entries(atlasDbInitScripts)) { - this.write_embedded_file(path.join(atlasDbInitDir, name), content); - } } private write_embedded_file(dest: string, content: string): void { try { From b9457c9f5b82e296c64a8ca11a771ef164a03afc Mon Sep 17 00:00:00 2001 From: mwaiyee Date: Thu, 20 Aug 2026 15:51:23 +0800 Subject: [PATCH 3/6] update docker image ver --- scripts/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cli.ts b/scripts/cli.ts index e580bf1730..59b3e87332 100644 --- a/scripts/cli.ts +++ b/scripts/cli.ts @@ -39,7 +39,7 @@ interface CliOptions { class D2ECli { version: string; - LATEST_DOCKER_TAG_NAME: string = "0.18.0-beta"; // Update this as needed + LATEST_DOCKER_TAG_NAME: string = "0.18.1-beta"; // Update this as needed default_version: string = "0.18.0"; // Update this as needed default/base version CADDY__CONFIG: string; ENV_TYPE: string; From e5c2b9bb4134b1f862c49fb4e804b0ebf59cbd4d Mon Sep 17 00:00:00 2001 From: mwaiyee Date: Fri, 21 Aug 2026 17:25:22 +0800 Subject: [PATCH 4/6] seed update not required v0.18 --- docs/website/docs/2-admin_guide/5-setup/0-system-setup/cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/website/docs/2-admin_guide/5-setup/0-system-setup/cli.md b/docs/website/docs/2-admin_guide/5-setup/0-system-setup/cli.md index 40c59cc550..dce7357b56 100644 --- a/docs/website/docs/2-admin_guide/5-setup/0-system-setup/cli.md +++ b/docs/website/docs/2-admin_guide/5-setup/0-system-setup/cli.md @@ -94,7 +94,7 @@ Download the updated binary for your operating system and architecture using the In the d2e directory, open the `.env` file and make these changes: - Set `DOCKER_TAG_NAME` to the docker image tag for the new version. - Example: For version `0.12.0`, set `DOCKER_TAG_NAME=0.12.0-beta`. The format is `DOCKER_TAG_NAME=-beta`. -- Add `PLUGINS_SEED_UPDATE=true` to trigger a plugin upgrade on the next startup. +- Additional step for upgrades from versions earlier than v0.18: add `PLUGINS_SEED_UPDATE=true` to trigger a plugin upgrade on the next startup. - Verify the new version is active: From 8a2357efb0215379facac305fe17803e74d8da6b Mon Sep 17 00:00:00 2001 From: mwaiyee Date: Tue, 25 Aug 2026 17:34:42 +0800 Subject: [PATCH 5/6] Remove stale atlas-db-init by scripts when staging --- scripts/cli.ts | 56 ++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/scripts/cli.ts b/scripts/cli.ts index 3dbecb279f..3c997576ac 100644 --- a/scripts/cli.ts +++ b/scripts/cli.ts @@ -87,17 +87,10 @@ class D2ECli { // `./services/atlas-db-init:/usr/src/atlas-db-init` bind mount resolves. // These live at repo root but aren't present where the distributed CLI // runs, so we write the embedded copies here. - const atlasDbInitDir = path.join( - this.compose_dir, - "services", - "atlas-db-init" + this.stage_sql_dir( + path.join(this.compose_dir, "services", "atlas-db-init"), + atlasDbInitScripts ); - if (!this.replace_staged_dir(atlasDbInitDir)) { - return; - } - for (const [name, content] of Object.entries(atlasDbInitScripts)) { - this.write_embedded_file(path.join(atlasDbInitDir, name), content); - } this.stage_embedded_tree( path.join(this.compose_dir, "services", "trex", "migrations", "notebook"), notebookSchemaFiles @@ -128,33 +121,46 @@ class D2ECli { } } - // Clear the staged directory before rewriting it, so its contents always - // match the embedded set exactly. webapi-init globs whatever it finds - // (`for f in /scripts/*.sql`) instead of reading a manifest, so a script a - // previous CLI version staged and no longer ships would still be executed -- - // and under ON_ERROR_STOP=1 one that no longer applies fails the whole init. - // Removing first makes stale scripts impossible rather than something to - // detect after the fact. + // Drop the .sql files this CLI no longer ships before writing the current + // set. The bind mount hands trex the whole directory rather than a manifest, + // so a script a previous CLI version staged would still be applied after an + // upgrade -- and one that no longer applies fails the seeding. // - // Only the directory this CLI authors is removed. compose_dir is the repo - // root when the CLI runs from a checkout, so the `services/` above this holds - // the real service sources and must never be touched. - private replace_staged_dir(dir: string): boolean { + // Only individual .sql files are removed, never the directory: compose_dir is + // the repo root when the CLI runs from a checkout (and is the user's cwd + // entirely under the Bun build), where services/atlas-db-init holds the real + // git-tracked service sources. The prune is skipped in a checkout for the + // same reason -- there the embedded set is regenerated by `npm run build:ts`, + // which `npm start` does not run, so a script added but not yet re-embedded + // would look stale and be deleted. + private stage_sql_dir(dir: string, scripts: Record): void { + const from_checkout = fs.existsSync(path.join(this.compose_dir, ".git")); try { - fs.rmSync(dir, { recursive: true, force: true }); fs.mkdirSync(dir, { recursive: true }); - return true; + if (!from_checkout) { + for (const f of fs.readdirSync(dir)) { + if ( + f.endsWith(".sql") && + !Object.prototype.hasOwnProperty.call(scripts, f) + ) { + fs.rmSync(path.join(dir, f)); + } + } + } } catch (err: any) { if (err?.code === "EACCES" || err?.code === "EPERM") { console.warn( - `Warning: could not replace ${dir} (permission denied). ` + + `Warning: could not stage ${dir} (permission denied). ` + `It looks owned by another user (e.g. root from a release download). ` + `Continuing with the existing files.` ); - return false; + return; } throw err; } + for (const [name, content] of Object.entries(scripts)) { + this.write_embedded_file(path.join(dir, name), content); + } } private write_embedded_file(dest: string, content: string): void { try { From 8d43e31d2f8bee572544d61d23817932bee69c67 Mon Sep 17 00:00:00 2001 From: mwaiyee Date: Tue, 1 Sep 2026 09:16:39 +0800 Subject: [PATCH 6/6] update docker image ver --- scripts/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cli.ts b/scripts/cli.ts index 3c997576ac..06cd871c9a 100644 --- a/scripts/cli.ts +++ b/scripts/cli.ts @@ -40,7 +40,7 @@ interface CliOptions { class D2ECli { version: string; - LATEST_DOCKER_TAG_NAME: string = "0.18.1-beta"; // Update this as needed + LATEST_DOCKER_TAG_NAME: string = "0.18.2-beta"; // Update this as needed default_version: string = "0.18.0"; // Update this as needed default/base version CADDY__CONFIG: string; ENV_TYPE: string;