@rpcbase/cli 0.185.0 → 0.187.0
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/package.json +1 -1
- package/src/cmd-deploy/index.js +20 -15
package/package.json
CHANGED
package/src/cmd-deploy/index.js
CHANGED
|
@@ -31,18 +31,18 @@ const getInstanceDeployDir = (baseDeployDir, instance) => `${baseDeployDir}-${in
|
|
|
31
31
|
const sleep = async (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
32
32
|
|
|
33
33
|
const sharedInfrastructureIncludePatterns = [
|
|
34
|
-
"infrastructure/compose.yml",
|
|
35
|
-
"infrastructure/compose.instances.yml",
|
|
36
|
-
"infrastructure/package.json",
|
|
37
|
-
"infrastructure/package-lock.json",
|
|
38
|
-
"infrastructure/ensure-*",
|
|
39
|
-
"infrastructure/mongot/***",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
34
|
+
"/infrastructure/compose.yml",
|
|
35
|
+
"/infrastructure/compose.instances.yml",
|
|
36
|
+
"/infrastructure/package.json",
|
|
37
|
+
"/infrastructure/package-lock.json",
|
|
38
|
+
"/infrastructure/ensure-*",
|
|
39
|
+
"/infrastructure/mongot/***",
|
|
40
|
+
"/.env",
|
|
41
|
+
"/.env.*",
|
|
42
42
|
]
|
|
43
43
|
|
|
44
44
|
const sharedInfrastructureExcludePatterns = [
|
|
45
|
-
"infrastructure/data/***",
|
|
45
|
+
"/infrastructure/data/***",
|
|
46
46
|
]
|
|
47
47
|
|
|
48
48
|
const toArray = (value) => {
|
|
@@ -58,6 +58,8 @@ const resolveFrom = (baseDir, value) => (
|
|
|
58
58
|
path.isAbsolute(value) ? value : path.resolve(baseDir, value)
|
|
59
59
|
)
|
|
60
60
|
|
|
61
|
+
const installCommand = "if [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then npm ci; elif [ -f package.json ]; then npm install --package-lock=false --no-audit --no-fund; fi"
|
|
62
|
+
|
|
61
63
|
const toRelativePattern = (baseDir, value) => {
|
|
62
64
|
const resolved = resolveFrom(baseDir, value)
|
|
63
65
|
const relative = path.relative(baseDir, resolved)
|
|
@@ -382,17 +384,18 @@ export const deploy = async (argv) => {
|
|
|
382
384
|
? sharedInfrastructureExcludePatterns.concat(deployExcludePatterns)
|
|
383
385
|
: deployExcludePatterns,
|
|
384
386
|
includePatterns: useBlueGreen
|
|
385
|
-
? sharedInfrastructureIncludePatterns.concat(preparedDeploy.sharedEnvFileNames)
|
|
387
|
+
? sharedInfrastructureIncludePatterns.concat(preparedDeploy.sharedEnvFileNames.map((name) => `/${name}`))
|
|
386
388
|
: undefined,
|
|
387
389
|
})
|
|
388
390
|
|
|
389
391
|
if (infrastructureChanged) {
|
|
390
392
|
if (useBlueGreen) {
|
|
391
393
|
if (argv.verbose) console.log(infrastructureDiff)
|
|
392
|
-
|
|
394
|
+
console.log("Shared infrastructure files changed; refreshing shared infrastructure before deploying the inactive app instance.")
|
|
395
|
+
} else {
|
|
396
|
+
console.log("Infrastructure compose files differ between local and remote (info only; deploy proceeds).")
|
|
397
|
+
if (argv.verbose) console.log(infrastructureDiff)
|
|
393
398
|
}
|
|
394
|
-
console.log("Infrastructure compose files differ between local and remote (info only; deploy proceeds).")
|
|
395
|
-
if (argv.verbose) console.log(infrastructureDiff)
|
|
396
399
|
}
|
|
397
400
|
}
|
|
398
401
|
|
|
@@ -415,7 +418,9 @@ export const deploy = async (argv) => {
|
|
|
415
418
|
|
|
416
419
|
log(`Running: ${infrastructureRsyncCmd}`)
|
|
417
420
|
execSync(infrastructureRsyncCmd, { stdio: argv.verbose ? "inherit" : "ignore" })
|
|
418
|
-
await ssh(`cd ~/apps/${baseDeployDir}/infrastructure &&
|
|
421
|
+
await ssh(`cd ~/apps/${baseDeployDir}/infrastructure && ${installCommand}`)
|
|
422
|
+
console.log("Refreshing shared infrastructure before deploying the inactive app instance.")
|
|
423
|
+
await ssh(`cd ~/apps/${baseDeployDir}/infrastructure && for f in ensure-*.js; do [ -f "$f" ] || continue; node "$f"; done && node ctrl.js up-infra prod`, true)
|
|
419
424
|
}
|
|
420
425
|
|
|
421
426
|
const excludeList = baseExcludeList
|
|
@@ -449,7 +454,7 @@ export const deploy = async (argv) => {
|
|
|
449
454
|
}
|
|
450
455
|
await runInstanceAction("down", activeInstance)
|
|
451
456
|
} else {
|
|
452
|
-
await ssh(`cd ~/apps/${deployDir}/infrastructure &&
|
|
457
|
+
await ssh(`cd ~/apps/${deployDir}/infrastructure && ${installCommand}`)
|
|
453
458
|
log("Restarting application...")
|
|
454
459
|
await ssh(`cd ~/apps/${deployDir}/infrastructure && node ctrl.js down prod`, true)
|
|
455
460
|
log("Application stopped. Starting it up again...")
|