@rpcbase/server 0.54.0 → 0.55.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/bin.js CHANGED
@@ -8,6 +8,7 @@ const {hideBin} = require("yargs/helpers")
8
8
 
9
9
  const start_server = require("./cli/start_server")
10
10
  const build_server = require("./cli/build_server")
11
+ const run_agent = require("./cli/run_agent")
11
12
 
12
13
  let is_command = false
13
14
 
@@ -16,6 +17,10 @@ const args = yargs(hideBin(process.argv))
16
17
  is_command = true
17
18
  start_server()
18
19
  })
20
+ .command("agent", "run the agent", () => {}, (argv) => {
21
+ is_command = true
22
+ run_agent()
23
+ })
19
24
  .command("build", "build server", () => {}, (argv) => {
20
25
  is_command = true
21
26
  build_server()
@@ -33,5 +38,5 @@ const args = yargs(hideBin(process.argv))
33
38
  .parse()
34
39
 
35
40
  if (!is_command) {
36
- console.log("default command")
41
+ console.log("default com22mand")
37
42
  }
@@ -0,0 +1,33 @@
1
+ /* @flow */
2
+ const path = require("path")
3
+ const fs = require("fs")
4
+
5
+ // const get_runtime = require("./get_runtime")
6
+ // const run_docker = require("./run_docker")
7
+ // const run_native = require("./run_native")
8
+ const {run} = require("@rpcbase/agent")
9
+
10
+ const run_agent = async() => {
11
+ const cwd = process.cwd()
12
+ const proj_parent_dir = path.join(cwd, "../../")
13
+ const proj_prefix = path.basename(proj_parent_dir)
14
+
15
+ console.log("RUN AGENT", proj_prefix)
16
+ run(proj_prefix)
17
+ // const infrastructure_dir = path.join(process.cwd(), "../infrastructure")
18
+ //
19
+ // // prefix
20
+ // const proj_parent_dir = path.join(infrastructure_dir, "../../")
21
+ // const proj_prefix = path.basename(proj_parent_dir)
22
+ //
23
+ // const runtime = get_runtime()
24
+ //
25
+ // if (runtime === "native") {
26
+ // run_native(infrastructure_dir, proj_prefix)
27
+ // } else {
28
+ // run_docker(infrastructure_dir, proj_prefix)
29
+ // }
30
+
31
+ }
32
+
33
+ module.exports = run_agent
package/cli/run_docker.js CHANGED
@@ -15,7 +15,7 @@ const run_docker = async(infrastructure_dir, proj_prefix) => {
15
15
  }
16
16
  else compose_files.push("-f dev.yml")
17
17
 
18
- console.log("got compose files", compose_files)
18
+ // console.log("got compose files", compose_files)
19
19
 
20
20
  const opts = ["--build", "--remove-orphans"]
21
21
  if (!is_production) opts.push("--abort-on-container-exit")
package/database.js CHANGED
@@ -16,7 +16,6 @@ const mongo_url = `mongodb://database:${DATABASE_PORT}/${DATABASE_NAME}?directCo
16
16
 
17
17
 
18
18
  module.exports = async() => {
19
-
20
19
  // set listeners before attempting to connect
21
20
  mongoose.connection.on("connected", () => {
22
21
  console.log("mongoose connected")
@@ -32,13 +31,13 @@ module.exports = async() => {
32
31
  console.log("mongoose connection error", err)
33
32
  })
34
33
 
35
-
36
34
  console.log("connect mongo_url", mongo_url)
37
35
 
38
36
  const connect_opts = {
39
37
  keepAlive: true,
40
38
  keepAliveInitialDelay: 5000,
41
39
  minPoolSize: 5,
40
+ maxPoolSize: 1024 * 1024,
42
41
  family: 4, // force ipv4
43
42
  }
44
43
 
@@ -16,7 +16,8 @@ if (typeof SESSION_STORE_PORT === "string" && !validator.isPort(SESSION_STORE_PO
16
16
 
17
17
  let session_middleware = null
18
18
 
19
- // extreme warning: when there is blocking io redis client won't connect
19
+ // extreme warning: docker issue
20
+ // when there is synchronous io redis client fails to connect
20
21
  // process.nextTick(async() => {
21
22
  setTimeout(async() => {
22
23
  if (!SESSION_STORE_PORT) {
@@ -60,7 +61,7 @@ setTimeout(async() => {
60
61
  resave: false,
61
62
  })
62
63
 
63
- }, 500)
64
+ }, 300)
64
65
 
65
66
 
66
67
  module.exports = (req, res, next) => {
@@ -257,7 +257,7 @@ loglevel notice
257
257
  # Specify the log file name. Also the empty string can be used to force
258
258
  # Redis to log on the standard output. Note that if you use standard
259
259
  # output for logging but daemonize, logs will be sent to /dev/null
260
- logfile ""
260
+ logfile "logfile "/var/log/redis/logs.txt""
261
261
 
262
262
  # To enable logging to the system logger, just set 'syslog-enabled' to yes,
263
263
  # and optionally update the other syslog parameters to suit your needs.
package/mailer/index.js CHANGED
@@ -12,7 +12,7 @@ if (is_production) {
12
12
  } else {
13
13
  client = {
14
14
  sendEmail: async(payload) => {
15
- console.log("sendEmail disabled outside of production")
15
+ console.log("sendEmail disabled when not in production")
16
16
  console.log("From:", payload.From, "To:", payload.To, "Subject:", payload.Subject)
17
17
  }
18
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/server",
3
- "version": "0.54.0",
3
+ "version": "0.55.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -10,6 +10,7 @@
10
10
  "test": "echo \"Error: no test specified\" && exit 0"
11
11
  },
12
12
  "dependencies": {
13
+ "@rpcbase/agent": "0.2.0",
13
14
  "body-parser": "1.20.0",
14
15
  "connect-redis": "6.1.3",
15
16
  "cors": "2.8.5",