@envsync-cloud/deploy 0.20.5 → 0.20.6

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 +22 -11
  2. package/dist/index.js +22 -11
  3. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -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
 
@@ -3631,6 +3623,25 @@ function apiHealth(services, stackName) {
3631
3623
  if (blue === "healthy" || green === "healthy") return "healthy";
3632
3624
  return "degraded";
3633
3625
  }
3626
+ function probeApiSlotHttp(config, slot) {
3627
+ const host = `envsync_api_${slot}`;
3628
+ const output = tryRun(
3629
+ "docker",
3630
+ [
3631
+ "run",
3632
+ "--rm",
3633
+ "--network",
3634
+ stackNetworkName(config),
3635
+ "--entrypoint",
3636
+ "bun",
3637
+ config.images.api,
3638
+ "-e",
3639
+ `const r=await fetch("http://${host}:4000/health"); if(!r.ok) process.exit(1); console.log(await r.text());`
3640
+ ],
3641
+ { quiet: true }
3642
+ );
3643
+ return output.includes("ok");
3644
+ }
3634
3645
  function waitForApiSlotHealthy(config, slot, timeoutSeconds = 300) {
3635
3646
  if (currentOptions.dryRun) {
3636
3647
  logDryRun(`Would wait for API ${slot} slot readiness`);
@@ -3640,7 +3651,7 @@ function waitForApiSlotHealthy(config, slot, timeoutSeconds = 300) {
3640
3651
  const serviceName = slotStackServiceName(config, slot);
3641
3652
  while (Date.now() < deadline) {
3642
3653
  const services2 = listStackServices(config);
3643
- if (serviceHealth(services2, serviceName) === "healthy") {
3654
+ if (serviceHealth(services2, serviceName) === "healthy" && probeApiSlotHttp(config, slot)) {
3644
3655
  logSuccess(`API ${slot} slot is healthy`);
3645
3656
  return;
3646
3657
  }
package/dist/index.js CHANGED
@@ -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
 
@@ -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
  }
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.6",
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.6",
50
50
  "tsup": "^8.5.0",
51
51
  "typescript": "^5.9.2"
52
52
  },