@rpcbase/cli 0.186.0 → 0.188.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 +14 -4
package/package.json
CHANGED
package/src/cmd-deploy/index.js
CHANGED
|
@@ -43,6 +43,14 @@ const sharedInfrastructureIncludePatterns = [
|
|
|
43
43
|
|
|
44
44
|
const sharedInfrastructureExcludePatterns = [
|
|
45
45
|
"/infrastructure/data/***",
|
|
46
|
+
"/infrastructure/mongot/config.yml",
|
|
47
|
+
"/infrastructure/mongot/passwordFile",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
const generatedInfrastructureExcludePatterns = [
|
|
51
|
+
"data/",
|
|
52
|
+
"mongot/config.yml",
|
|
53
|
+
"mongot/passwordFile",
|
|
46
54
|
]
|
|
47
55
|
|
|
48
56
|
const toArray = (value) => {
|
|
@@ -58,6 +66,8 @@ const resolveFrom = (baseDir, value) => (
|
|
|
58
66
|
path.isAbsolute(value) ? value : path.resolve(baseDir, value)
|
|
59
67
|
)
|
|
60
68
|
|
|
69
|
+
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"
|
|
70
|
+
|
|
61
71
|
const toRelativePattern = (baseDir, value) => {
|
|
62
72
|
const resolved = resolveFrom(baseDir, value)
|
|
63
73
|
const relative = path.relative(baseDir, resolved)
|
|
@@ -145,7 +155,7 @@ const prepareDeploySource = ({
|
|
|
145
155
|
const infrastructureRsyncCmd = [
|
|
146
156
|
"rsync -a",
|
|
147
157
|
"--delete",
|
|
148
|
-
buildRsyncFilterArgs({ excludes: baseExcludeList.concat(
|
|
158
|
+
buildRsyncFilterArgs({ excludes: baseExcludeList.concat(generatedInfrastructureExcludePatterns).concat(excludePatterns) }),
|
|
149
159
|
shellQuote(withTrailingSlash(infrastructureDir)),
|
|
150
160
|
shellQuote(withTrailingSlash(deployInfrastructureDir)),
|
|
151
161
|
].filter(Boolean).join(" ")
|
|
@@ -402,7 +412,7 @@ export const deploy = async (argv) => {
|
|
|
402
412
|
syncSharedEnvFiles(deployRoot, preparedDeploy.sharedEnvFileNames)
|
|
403
413
|
|
|
404
414
|
const infrastructureExcludeArgs = baseExcludeList
|
|
405
|
-
.concat(
|
|
415
|
+
.concat(generatedInfrastructureExcludePatterns)
|
|
406
416
|
.concat(deployExcludePatterns)
|
|
407
417
|
|
|
408
418
|
const infrastructureRsyncCmd = [
|
|
@@ -416,7 +426,7 @@ export const deploy = async (argv) => {
|
|
|
416
426
|
|
|
417
427
|
log(`Running: ${infrastructureRsyncCmd}`)
|
|
418
428
|
execSync(infrastructureRsyncCmd, { stdio: argv.verbose ? "inherit" : "ignore" })
|
|
419
|
-
await ssh(`cd ~/apps/${baseDeployDir}/infrastructure &&
|
|
429
|
+
await ssh(`cd ~/apps/${baseDeployDir}/infrastructure && ${installCommand}`)
|
|
420
430
|
console.log("Refreshing shared infrastructure before deploying the inactive app instance.")
|
|
421
431
|
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)
|
|
422
432
|
}
|
|
@@ -452,7 +462,7 @@ export const deploy = async (argv) => {
|
|
|
452
462
|
}
|
|
453
463
|
await runInstanceAction("down", activeInstance)
|
|
454
464
|
} else {
|
|
455
|
-
await ssh(`cd ~/apps/${deployDir}/infrastructure &&
|
|
465
|
+
await ssh(`cd ~/apps/${deployDir}/infrastructure && ${installCommand}`)
|
|
456
466
|
log("Restarting application...")
|
|
457
467
|
await ssh(`cd ~/apps/${deployDir}/infrastructure && node ctrl.js down prod`, true)
|
|
458
468
|
log("Application stopped. Starting it up again...")
|