@envsync-cloud/deploy 0.20.5 → 0.20.7

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.
Files changed (3) hide show
  1. package/dist/cli.js +30 -14
  2. package/dist/index.js +31 -15
  3. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -1070,7 +1070,7 @@ ${renderEnvList({
1070
1070
  networks: [envsync]
1071
1071
  ${includeRuntimeInfra ? `
1072
1072
  minikms:
1073
- image: ghcr.io/envsync-cloud/minikms:sha-735dfe8
1073
+ image: ghcr.io/envsync-cloud/minikms:sha-9ffbf53
1074
1074
  environment:
1075
1075
  ${renderEnvList({
1076
1076
  MINIKMS_ROOT_KEY: runtimeEnv.MINIKMS_ROOT_KEY,
@@ -1146,11 +1146,7 @@ ${renderEnvList({
1146
1146
  ${apiLicenseVolume}
1147
1147
  networks: [envsync]
1148
1148
  healthcheck:
1149
- test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:4000/health"]
1150
- interval: 10s
1151
- timeout: 5s
1152
- retries: 8
1153
- start_period: 60s
1149
+ disable: true
1154
1150
  deploy:
1155
1151
  replicas: ${slotHasApiDeployment(deployment.slots.blue) ? 1 : 0}
1156
1152
 
@@ -1165,11 +1161,7 @@ ${renderEnvList({
1165
1161
  ${apiLicenseVolume}
1166
1162
  networks: [envsync]
1167
1163
  healthcheck:
1168
- test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:4000/health"]
1169
- interval: 10s
1170
- timeout: 5s
1171
- retries: 8
1172
- start_period: 60s
1164
+ disable: true
1173
1165
  deploy:
1174
1166
  replicas: ${slotHasApiDeployment(deployment.slots.green) ? 1 : 0}` : ""}${netutilsService}${vpnResult?.serviceBlock ?? ""}
1175
1167
 
@@ -3059,6 +3051,11 @@ function runOpenFgaMigrate(config, runtimeEnv) {
3059
3051
  ]);
3060
3052
  logSuccess("OpenFGA datastore migrations completed");
3061
3053
  }
3054
+ var MINIKMS_MIGRATE_SQL = [
3055
+ "psql -h minikms_db -U postgres -d minikms -f /migrations/001_initial_schema.sql",
3056
+ "psql -h minikms_db -U postgres -d minikms -f /migrations/002_vault_storage.sql",
3057
+ "psql -h minikms_db -U postgres -d minikms -f /migrations/003_escrow_recovery.sql"
3058
+ ].join(" && ");
3062
3059
  function runMiniKmsMigrate(config, runtimeEnv) {
3063
3060
  logStep("Running miniKMS datastore migrations");
3064
3061
  if (currentOptions.dryRun) {
@@ -3075,7 +3072,7 @@ function runMiniKmsMigrate(config, runtimeEnv) {
3075
3072
  "postgres:17",
3076
3073
  "sh",
3077
3074
  "-lc",
3078
- "psql -h minikms_db -U postgres -d minikms -f /migrations/001_initial_schema.sql && psql -h minikms_db -U postgres -d minikms -f /migrations/002_vault_storage.sql"
3075
+ MINIKMS_MIGRATE_SQL
3079
3076
  ]);
3080
3077
  return;
3081
3078
  }
@@ -3091,7 +3088,7 @@ function runMiniKmsMigrate(config, runtimeEnv) {
3091
3088
  "postgres:17",
3092
3089
  "sh",
3093
3090
  "-lc",
3094
- "psql -h minikms_db -U postgres -d minikms -f /migrations/001_initial_schema.sql && psql -h minikms_db -U postgres -d minikms -f /migrations/002_vault_storage.sql"
3091
+ MINIKMS_MIGRATE_SQL
3095
3092
  ]);
3096
3093
  logSuccess("miniKMS datastore migrations completed");
3097
3094
  }
@@ -3631,6 +3628,25 @@ function apiHealth(services, stackName) {
3631
3628
  if (blue === "healthy" || green === "healthy") return "healthy";
3632
3629
  return "degraded";
3633
3630
  }
3631
+ function probeApiSlotHttp(config, slot) {
3632
+ const host = `envsync_api_${slot}`;
3633
+ const output = tryRun(
3634
+ "docker",
3635
+ [
3636
+ "run",
3637
+ "--rm",
3638
+ "--network",
3639
+ stackNetworkName(config),
3640
+ "--entrypoint",
3641
+ "bun",
3642
+ config.images.api,
3643
+ "-e",
3644
+ `const r=await fetch("http://${host}:4000/health"); if(!r.ok) process.exit(1); console.log(await r.text());`
3645
+ ],
3646
+ { quiet: true }
3647
+ );
3648
+ return output.includes("ok");
3649
+ }
3634
3650
  function waitForApiSlotHealthy(config, slot, timeoutSeconds = 300) {
3635
3651
  if (currentOptions.dryRun) {
3636
3652
  logDryRun(`Would wait for API ${slot} slot readiness`);
@@ -3640,7 +3656,7 @@ function waitForApiSlotHealthy(config, slot, timeoutSeconds = 300) {
3640
3656
  const serviceName = slotStackServiceName(config, slot);
3641
3657
  while (Date.now() < deadline) {
3642
3658
  const services2 = listStackServices(config);
3643
- if (serviceHealth(services2, serviceName) === "healthy") {
3659
+ if (serviceHealth(services2, serviceName) === "healthy" && probeApiSlotHttp(config, slot)) {
3644
3660
  logSuccess(`API ${slot} slot is healthy`);
3645
3661
  return;
3646
3662
  }
package/dist/index.js CHANGED
@@ -1067,7 +1067,7 @@ ${renderEnvList({
1067
1067
  networks: [envsync]
1068
1068
  ${includeRuntimeInfra ? `
1069
1069
  minikms:
1070
- image: ghcr.io/envsync-cloud/minikms:sha-735dfe8
1070
+ image: ghcr.io/envsync-cloud/minikms:sha-9ffbf53
1071
1071
  environment:
1072
1072
  ${renderEnvList({
1073
1073
  MINIKMS_ROOT_KEY: runtimeEnv.MINIKMS_ROOT_KEY,
@@ -1143,11 +1143,7 @@ ${renderEnvList({
1143
1143
  ${apiLicenseVolume}
1144
1144
  networks: [envsync]
1145
1145
  healthcheck:
1146
- test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:4000/health"]
1147
- interval: 10s
1148
- timeout: 5s
1149
- retries: 8
1150
- start_period: 60s
1146
+ disable: true
1151
1147
  deploy:
1152
1148
  replicas: ${slotHasApiDeployment(deployment.slots.blue) ? 1 : 0}
1153
1149
 
@@ -1162,11 +1158,7 @@ ${renderEnvList({
1162
1158
  ${apiLicenseVolume}
1163
1159
  networks: [envsync]
1164
1160
  healthcheck:
1165
- test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:4000/health"]
1166
- interval: 10s
1167
- timeout: 5s
1168
- retries: 8
1169
- start_period: 60s
1161
+ disable: true
1170
1162
  deploy:
1171
1163
  replicas: ${slotHasApiDeployment(deployment.slots.green) ? 1 : 0}` : ""}${netutilsService}${vpnResult?.serviceBlock ?? ""}
1172
1164
 
@@ -2937,7 +2929,7 @@ function runMiniKmsMigrate(config, runtimeEnv) {
2937
2929
  "postgres:17",
2938
2930
  "sh",
2939
2931
  "-lc",
2940
- "psql -h minikms_db -U postgres -d minikms -f /migrations/001_initial_schema.sql && psql -h minikms_db -U postgres -d minikms -f /migrations/002_vault_storage.sql"
2932
+ MINIKMS_MIGRATE_SQL
2941
2933
  ]);
2942
2934
  return;
2943
2935
  }
@@ -2953,7 +2945,7 @@ function runMiniKmsMigrate(config, runtimeEnv) {
2953
2945
  "postgres:17",
2954
2946
  "sh",
2955
2947
  "-lc",
2956
- "psql -h minikms_db -U postgres -d minikms -f /migrations/001_initial_schema.sql && psql -h minikms_db -U postgres -d minikms -f /migrations/002_vault_storage.sql"
2948
+ MINIKMS_MIGRATE_SQL
2957
2949
  ]);
2958
2950
  logSuccess("miniKMS datastore migrations completed");
2959
2951
  }
@@ -3493,6 +3485,25 @@ function apiHealth(services, stackName) {
3493
3485
  if (blue === "healthy" || green === "healthy") return "healthy";
3494
3486
  return "degraded";
3495
3487
  }
3488
+ function probeApiSlotHttp(config, slot) {
3489
+ const host = `envsync_api_${slot}`;
3490
+ const output = tryRun(
3491
+ "docker",
3492
+ [
3493
+ "run",
3494
+ "--rm",
3495
+ "--network",
3496
+ stackNetworkName(config),
3497
+ "--entrypoint",
3498
+ "bun",
3499
+ config.images.api,
3500
+ "-e",
3501
+ `const r=await fetch("http://${host}:4000/health"); if(!r.ok) process.exit(1); console.log(await r.text());`
3502
+ ],
3503
+ { quiet: true }
3504
+ );
3505
+ return output.includes("ok");
3506
+ }
3496
3507
  function waitForApiSlotHealthy(config, slot, timeoutSeconds = 300) {
3497
3508
  if (currentOptions.dryRun) {
3498
3509
  logDryRun(`Would wait for API ${slot} slot readiness`);
@@ -3502,7 +3513,7 @@ function waitForApiSlotHealthy(config, slot, timeoutSeconds = 300) {
3502
3513
  const serviceName = slotStackServiceName(config, slot);
3503
3514
  while (Date.now() < deadline) {
3504
3515
  const services2 = listStackServices(config);
3505
- if (serviceHealth(services2, serviceName) === "healthy") {
3516
+ if (serviceHealth(services2, serviceName) === "healthy" && probeApiSlotHttp(config, slot)) {
3506
3517
  logSuccess(`API ${slot} slot is healthy`);
3507
3518
  return;
3508
3519
  }
@@ -5123,7 +5134,7 @@ async function main() {
5123
5134
  process.exit(1);
5124
5135
  }
5125
5136
  }
5126
- var NETUTILS_EXPOSE_ALL_START_PORT, NETUTILS_EXPOSE_ALL_PORTS, HOST_ROOT, ETC_ROOT, TRAEFIK_STATE_ROOT, DEPLOY_ROOT, RELEASES_ROOT, BACKUPS_ROOT, REPO_ROOT, DEPLOY_ENV, DEPLOY_YAML, WIREGUARD_ROOT, LICENSE_ROOT, SETUP_TOKEN_FILE, LICENSE_BUNDLE_FILE, LICENSE_CERT_FILE, LICENSE_KEY_FILE, LICENSE_ROOT_CA_FILE, LICENSE_FILE_MODE, LICENSE_DIR_MODE, VERSIONS_LOCK, STACK_FILE, BOOTSTRAP_BASE_STACK_FILE, BOOTSTRAP_STACK_FILE, TRAEFIK_DYNAMIC_FILE, KEYCLOAK_REALM_FILE, NGINX_WEB_CONF, NGINX_LANDING_CONF, NGINX_API_MAINTENANCE_CONF, NGINX_VPN_CONF, OTEL_AGENT_CONF, CLICKSTACK_CLICKHOUSE_CONF, INTERNAL_CONFIG_JSON, UPGRADE_BACKUPS_ROOT, WIREGUARD_STATE_FILE, WIREGUARD_PRIVATE_KEY_FILE, WIREGUARD_PUBLIC_KEY_FILE, WIREGUARD_CONFIG_FILE, DEPLOY_RENDER_PATHS, REMOVE_TARGETS, REMOVE_CONFIRMATION_TOKEN, STACK_VOLUMES, REQUIRED_BOOTSTRAP_ENV_KEYS, REQUIRED_CLICKSTACK_SAVED_SEARCHES, REQUIRED_CLICKSTACK_TAGS, CLICKSTACK_SELFHOST_TEAM_NAME, SEMVER_VERSION_RE, currentOptions, DEFAULT_SOURCE_REPO_URL, DEFAULT_ENTERPRISE_LICENSE_SERVER_URL, MANAGED_VERSIONED_IMAGE_PREFIXES;
5137
+ var NETUTILS_EXPOSE_ALL_START_PORT, NETUTILS_EXPOSE_ALL_PORTS, HOST_ROOT, ETC_ROOT, TRAEFIK_STATE_ROOT, DEPLOY_ROOT, RELEASES_ROOT, BACKUPS_ROOT, REPO_ROOT, DEPLOY_ENV, DEPLOY_YAML, WIREGUARD_ROOT, LICENSE_ROOT, SETUP_TOKEN_FILE, LICENSE_BUNDLE_FILE, LICENSE_CERT_FILE, LICENSE_KEY_FILE, LICENSE_ROOT_CA_FILE, LICENSE_FILE_MODE, LICENSE_DIR_MODE, VERSIONS_LOCK, STACK_FILE, BOOTSTRAP_BASE_STACK_FILE, BOOTSTRAP_STACK_FILE, TRAEFIK_DYNAMIC_FILE, KEYCLOAK_REALM_FILE, NGINX_WEB_CONF, NGINX_LANDING_CONF, NGINX_API_MAINTENANCE_CONF, NGINX_VPN_CONF, OTEL_AGENT_CONF, CLICKSTACK_CLICKHOUSE_CONF, INTERNAL_CONFIG_JSON, UPGRADE_BACKUPS_ROOT, WIREGUARD_STATE_FILE, WIREGUARD_PRIVATE_KEY_FILE, WIREGUARD_PUBLIC_KEY_FILE, WIREGUARD_CONFIG_FILE, DEPLOY_RENDER_PATHS, REMOVE_TARGETS, REMOVE_CONFIRMATION_TOKEN, STACK_VOLUMES, REQUIRED_BOOTSTRAP_ENV_KEYS, REQUIRED_CLICKSTACK_SAVED_SEARCHES, REQUIRED_CLICKSTACK_TAGS, CLICKSTACK_SELFHOST_TEAM_NAME, SEMVER_VERSION_RE, currentOptions, DEFAULT_SOURCE_REPO_URL, DEFAULT_ENTERPRISE_LICENSE_SERVER_URL, MANAGED_VERSIONED_IMAGE_PREFIXES, MINIKMS_MIGRATE_SQL;
5127
5138
  var init_cli = __esm({
5128
5139
  "src/cli.ts"() {
5129
5140
  "use strict";
@@ -5295,6 +5306,11 @@ var init_cli = __esm({
5295
5306
  web_oss: "ghcr.io/envsync-cloud/envsync-web-oss-static:",
5296
5307
  landing: "ghcr.io/envsync-cloud/envsync-landing-static:"
5297
5308
  };
5309
+ MINIKMS_MIGRATE_SQL = [
5310
+ "psql -h minikms_db -U postgres -d minikms -f /migrations/001_initial_schema.sql",
5311
+ "psql -h minikms_db -U postgres -d minikms -f /migrations/002_vault_storage.sql",
5312
+ "psql -h minikms_db -U postgres -d minikms -f /migrations/003_escrow_recovery.sql"
5313
+ ].join(" && ");
5298
5314
  main().catch((err) => {
5299
5315
  console.error(err instanceof Error ? err.message : err);
5300
5316
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envsync-cloud/deploy",
3
- "version": "0.20.5",
3
+ "version": "0.20.7",
4
4
  "description": "OSS CLI for self-hosted EnvSync deployment on Docker Swarm",
5
5
  "type": "module",
6
6
  "bin": {
@@ -46,7 +46,7 @@
46
46
  "zod": "^3.25.76"
47
47
  },
48
48
  "devDependencies": {
49
- "@envsync-cloud/deploy-core": "0.20.5",
49
+ "@envsync-cloud/deploy-core": "0.20.7",
50
50
  "tsup": "^8.5.0",
51
51
  "typescript": "^5.9.2"
52
52
  },