@rpcbase/cli 0.184.0 → 0.186.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 +16 -13
- package/src/cmd-deploy/private-api.js +0 -10
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) => {
|
|
@@ -382,17 +382,18 @@ export const deploy = async (argv) => {
|
|
|
382
382
|
? sharedInfrastructureExcludePatterns.concat(deployExcludePatterns)
|
|
383
383
|
: deployExcludePatterns,
|
|
384
384
|
includePatterns: useBlueGreen
|
|
385
|
-
? sharedInfrastructureIncludePatterns.concat(preparedDeploy.sharedEnvFileNames)
|
|
385
|
+
? sharedInfrastructureIncludePatterns.concat(preparedDeploy.sharedEnvFileNames.map((name) => `/${name}`))
|
|
386
386
|
: undefined,
|
|
387
387
|
})
|
|
388
388
|
|
|
389
389
|
if (infrastructureChanged) {
|
|
390
390
|
if (useBlueGreen) {
|
|
391
391
|
if (argv.verbose) console.log(infrastructureDiff)
|
|
392
|
-
|
|
392
|
+
console.log("Shared infrastructure files changed; refreshing shared infrastructure before deploying the inactive app instance.")
|
|
393
|
+
} else {
|
|
394
|
+
console.log("Infrastructure compose files differ between local and remote (info only; deploy proceeds).")
|
|
395
|
+
if (argv.verbose) console.log(infrastructureDiff)
|
|
393
396
|
}
|
|
394
|
-
console.log("Infrastructure compose files differ between local and remote (info only; deploy proceeds).")
|
|
395
|
-
if (argv.verbose) console.log(infrastructureDiff)
|
|
396
397
|
}
|
|
397
398
|
}
|
|
398
399
|
|
|
@@ -416,6 +417,8 @@ export const deploy = async (argv) => {
|
|
|
416
417
|
log(`Running: ${infrastructureRsyncCmd}`)
|
|
417
418
|
execSync(infrastructureRsyncCmd, { stdio: argv.verbose ? "inherit" : "ignore" })
|
|
418
419
|
await ssh(`cd ~/apps/${baseDeployDir}/infrastructure && [ -f package.json ] && npm ci || true`)
|
|
420
|
+
console.log("Refreshing shared infrastructure before deploying the inactive app instance.")
|
|
421
|
+
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
422
|
}
|
|
420
423
|
|
|
421
424
|
const excludeList = baseExcludeList
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import fs from "fs"
|
|
2
|
-
import https from "https"
|
|
3
|
-
|
|
4
1
|
import axios from "axios"
|
|
5
2
|
|
|
6
3
|
|
|
@@ -11,16 +8,9 @@ const requiredEnv = (env, name) => {
|
|
|
11
8
|
}
|
|
12
9
|
|
|
13
10
|
export const createPrivateApiClient = ({env, timeoutMs = 15_000}) => {
|
|
14
|
-
const httpsAgent = new https.Agent({
|
|
15
|
-
cert: fs.readFileSync(requiredEnv(env, "RB_PROXY_PRIVATE_API_CLIENT_CERT")),
|
|
16
|
-
key: fs.readFileSync(requiredEnv(env, "RB_PROXY_PRIVATE_API_CLIENT_KEY")),
|
|
17
|
-
ca: fs.readFileSync(requiredEnv(env, "RB_PROXY_PRIVATE_API_CA")),
|
|
18
|
-
})
|
|
19
|
-
|
|
20
11
|
return axios.create({
|
|
21
12
|
baseURL: requiredEnv(env, "RB_PROXY_PRIVATE_API_URL"),
|
|
22
13
|
timeout: timeoutMs,
|
|
23
|
-
httpsAgent,
|
|
24
14
|
validateStatus: (status) => status >= 200 && status < 300,
|
|
25
15
|
})
|
|
26
16
|
}
|