@envsync-cloud/deploy 0.20.0 → 0.20.3
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/cli.js +17 -8
- package/dist/index.js +17 -8
- package/package.json +4 -3
package/dist/cli.js
CHANGED
|
@@ -2883,7 +2883,7 @@ function createApiDbUpgradeBackup(config, fromVersion, toVersion) {
|
|
|
2883
2883
|
"postgres:17",
|
|
2884
2884
|
"sh",
|
|
2885
2885
|
"-lc",
|
|
2886
|
-
`pg_dump -h
|
|
2886
|
+
`pg_dump -h postgres -U postgres -d envsync -Fc -f /backup/${fileName}`
|
|
2887
2887
|
]);
|
|
2888
2888
|
logSuccess(`API DB upgrade snapshot created at ${hostPath}`);
|
|
2889
2889
|
return hostPath;
|
|
@@ -2907,7 +2907,7 @@ function restoreApiDbUpgradeBackup(config, backupPath) {
|
|
|
2907
2907
|
"postgres:17",
|
|
2908
2908
|
"sh",
|
|
2909
2909
|
"-lc",
|
|
2910
|
-
`pg_restore --clean --if-exists --no-owner --no-privileges -h
|
|
2910
|
+
`pg_restore --clean --if-exists --no-owner --no-privileges -h postgres -U postgres -d envsync /backup/${fileName}`
|
|
2911
2911
|
]);
|
|
2912
2912
|
logSuccess(`API DB upgrade snapshot restored from ${backupPath}`);
|
|
2913
2913
|
}
|
|
@@ -3275,6 +3275,7 @@ function runApiMigrationJsonCommand(config, image, args) {
|
|
|
3275
3275
|
executedMigrations: []
|
|
3276
3276
|
};
|
|
3277
3277
|
}
|
|
3278
|
+
const migrateCli = args.map((arg) => JSON.stringify(arg)).join(" ");
|
|
3278
3279
|
const output = run(
|
|
3279
3280
|
"docker",
|
|
3280
3281
|
[
|
|
@@ -3287,11 +3288,14 @@ function runApiMigrationJsonCommand(config, image, args) {
|
|
|
3287
3288
|
"-e",
|
|
3288
3289
|
"SKIP_ROOT_ENV=1",
|
|
3289
3290
|
image,
|
|
3290
|
-
"
|
|
3291
|
-
"
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3291
|
+
"sh",
|
|
3292
|
+
"-lc",
|
|
3293
|
+
[
|
|
3294
|
+
"if [ -d /app/packages/envsync-api ]; then cd /app/packages/envsync-api; fi",
|
|
3295
|
+
`if [ -f scripts/migrate.enterprise.ts ]; then exec bun run scripts/migrate.enterprise.ts ${migrateCli} --json`,
|
|
3296
|
+
`elif [ -f scripts/migrate.ts ]; then exec bun run scripts/migrate.ts ${migrateCli} --json`,
|
|
3297
|
+
"else echo 'Migration CLI missing from API image (expected scripts/migrate.ts)' >&2; exit 1; fi"
|
|
3298
|
+
].join("; ")
|
|
3295
3299
|
],
|
|
3296
3300
|
{ quiet: true }
|
|
3297
3301
|
);
|
|
@@ -4255,7 +4259,12 @@ async function cmdDeploy() {
|
|
|
4255
4259
|
const rollbackTarget = preUpgradeHead ?? "zero";
|
|
4256
4260
|
try {
|
|
4257
4261
|
logWarn(`Candidate deploy failed after migration. Rolling schema back to ${rollbackTarget}.`);
|
|
4258
|
-
|
|
4262
|
+
try {
|
|
4263
|
+
runApiMigrationJsonCommand(config, config.images.api, ["rollback_to", rollbackTarget]);
|
|
4264
|
+
} catch {
|
|
4265
|
+
logWarn(`Rollback with ${config.images.api} failed; retrying with ${activeImageBeforeUpgrade}.`);
|
|
4266
|
+
runApiMigrationJsonCommand(config, activeImageBeforeUpgrade, ["rollback_to", rollbackTarget]);
|
|
4267
|
+
}
|
|
4259
4268
|
} catch (rollbackError) {
|
|
4260
4269
|
if (!snapshotPath) {
|
|
4261
4270
|
throw new Error(
|
package/dist/index.js
CHANGED
|
@@ -2745,7 +2745,7 @@ function createApiDbUpgradeBackup(config, fromVersion, toVersion) {
|
|
|
2745
2745
|
"postgres:17",
|
|
2746
2746
|
"sh",
|
|
2747
2747
|
"-lc",
|
|
2748
|
-
`pg_dump -h
|
|
2748
|
+
`pg_dump -h postgres -U postgres -d envsync -Fc -f /backup/${fileName}`
|
|
2749
2749
|
]);
|
|
2750
2750
|
logSuccess(`API DB upgrade snapshot created at ${hostPath}`);
|
|
2751
2751
|
return hostPath;
|
|
@@ -2769,7 +2769,7 @@ function restoreApiDbUpgradeBackup(config, backupPath) {
|
|
|
2769
2769
|
"postgres:17",
|
|
2770
2770
|
"sh",
|
|
2771
2771
|
"-lc",
|
|
2772
|
-
`pg_restore --clean --if-exists --no-owner --no-privileges -h
|
|
2772
|
+
`pg_restore --clean --if-exists --no-owner --no-privileges -h postgres -U postgres -d envsync /backup/${fileName}`
|
|
2773
2773
|
]);
|
|
2774
2774
|
logSuccess(`API DB upgrade snapshot restored from ${backupPath}`);
|
|
2775
2775
|
}
|
|
@@ -3137,6 +3137,7 @@ function runApiMigrationJsonCommand(config, image, args) {
|
|
|
3137
3137
|
executedMigrations: []
|
|
3138
3138
|
};
|
|
3139
3139
|
}
|
|
3140
|
+
const migrateCli = args.map((arg) => JSON.stringify(arg)).join(" ");
|
|
3140
3141
|
const output = run(
|
|
3141
3142
|
"docker",
|
|
3142
3143
|
[
|
|
@@ -3149,11 +3150,14 @@ function runApiMigrationJsonCommand(config, image, args) {
|
|
|
3149
3150
|
"-e",
|
|
3150
3151
|
"SKIP_ROOT_ENV=1",
|
|
3151
3152
|
image,
|
|
3152
|
-
"
|
|
3153
|
-
"
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3153
|
+
"sh",
|
|
3154
|
+
"-lc",
|
|
3155
|
+
[
|
|
3156
|
+
"if [ -d /app/packages/envsync-api ]; then cd /app/packages/envsync-api; fi",
|
|
3157
|
+
`if [ -f scripts/migrate.enterprise.ts ]; then exec bun run scripts/migrate.enterprise.ts ${migrateCli} --json`,
|
|
3158
|
+
`elif [ -f scripts/migrate.ts ]; then exec bun run scripts/migrate.ts ${migrateCli} --json`,
|
|
3159
|
+
"else echo 'Migration CLI missing from API image (expected scripts/migrate.ts)' >&2; exit 1; fi"
|
|
3160
|
+
].join("; ")
|
|
3157
3161
|
],
|
|
3158
3162
|
{ quiet: true }
|
|
3159
3163
|
);
|
|
@@ -4117,7 +4121,12 @@ async function cmdDeploy() {
|
|
|
4117
4121
|
const rollbackTarget = preUpgradeHead ?? "zero";
|
|
4118
4122
|
try {
|
|
4119
4123
|
logWarn(`Candidate deploy failed after migration. Rolling schema back to ${rollbackTarget}.`);
|
|
4120
|
-
|
|
4124
|
+
try {
|
|
4125
|
+
runApiMigrationJsonCommand(config, config.images.api, ["rollback_to", rollbackTarget]);
|
|
4126
|
+
} catch {
|
|
4127
|
+
logWarn(`Rollback with ${config.images.api} failed; retrying with ${activeImageBeforeUpgrade}.`);
|
|
4128
|
+
runApiMigrationJsonCommand(config, activeImageBeforeUpgrade, ["rollback_to", rollbackTarget]);
|
|
4129
|
+
}
|
|
4121
4130
|
} catch (rollbackError) {
|
|
4122
4131
|
if (!snapshotPath) {
|
|
4123
4132
|
throw new Error(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envsync-cloud/deploy",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.3",
|
|
4
4
|
"description": "OSS CLI for self-hosted EnvSync deployment on Docker Swarm",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,10 +42,11 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"chalk": "^5.6.2",
|
|
45
|
-
"yaml": "^1.10.2"
|
|
45
|
+
"yaml": "^1.10.2",
|
|
46
|
+
"zod": "^3.25.76"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
|
-
"@envsync-cloud/deploy-core": "
|
|
49
|
+
"@envsync-cloud/deploy-core": "0.20.3",
|
|
49
50
|
"tsup": "^8.5.0",
|
|
50
51
|
"typescript": "^5.9.2"
|
|
51
52
|
},
|