@rpcbase/server 0.41.0 → 0.44.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
@@ -14,11 +14,11 @@ const args = yargs(hideBin(process.argv))
14
14
  .command("start", "run server/infrastructure", () => {}, (argv) => {
15
15
  is_command = true
16
16
  console.log("run start server/infrastructure")
17
- start_server()
17
+ start_server(argv)
18
18
  })
19
19
  .command("ping", "ping", () => {}, (argv) => {
20
20
  is_command = true
21
- console.log("OING")
21
+ console.log("PING")
22
22
  })
23
23
  .option("verbose", {
24
24
  alias: "v",
package/cli/run_docker.js CHANGED
@@ -4,11 +4,12 @@ const path = require("path")
4
4
 
5
5
  const is_production = "yes" === process.env.INFRASTRUCTURE_IS_PRODUCTION
6
6
 
7
-
8
- const run_docker = async(infrastructure_dir, proj_prefix) => {
7
+ const run_docker = async(infrastructure_dir, proj_prefix, args) => {
9
8
  // env
10
9
  const env_path = path.relative(infrastructure_dir, path.join(process.cwd(), "./.env"))
11
10
 
11
+ console.log("ICI ARGS", args)
12
+
12
13
  // compose files
13
14
  const compose_files = ["-f common.yml"]
14
15
  if (is_production) compose_files.push("-f prod.yml")
@@ -16,6 +17,7 @@ const run_docker = async(infrastructure_dir, proj_prefix) => {
16
17
 
17
18
  const opts = ["--build", "--remove-orphans"]
18
19
  if (!is_production) opts.push("--abort-on-container-exit")
20
+ if (args.detach) opts.push("--detach")
19
21
 
20
22
  const cmd = `docker-compose --env-file ${env_path} -p ${proj_prefix} ${compose_files.join(" ")} up ${opts.join(" ")}`
21
23
 
@@ -10,7 +10,7 @@ const run_native = require("./run_native")
10
10
  // TODO: auto create network if necessary
11
11
  // docker network create local-network
12
12
 
13
- const start_server = async() => {
13
+ const start_server = async(args) => {
14
14
 
15
15
  const infrastructure_dir = path.join(process.cwd(), "../infrastructure")
16
16
 
@@ -24,7 +24,7 @@ const start_server = async() => {
24
24
  if (runtime === "native") {
25
25
  run_native(infrastructure_dir, proj_prefix)
26
26
  } else {
27
- run_docker(infrastructure_dir, proj_prefix)
27
+ run_docker(infrastructure_dir, proj_prefix, args)
28
28
  }
29
29
 
30
30
  }
package/database.js CHANGED
@@ -24,7 +24,22 @@ const mongo_url = `mongodb://${replicaset_str}/${DATABASE_NAME}?`
24
24
 
25
25
  module.exports = async() => {
26
26
  console.log("MONGO_URL", mongo_url)
27
- const ret = await mongoose.connect(mongo_url)
27
+ const ret = await mongoose.connect(mongo_url, {
28
+ keepAlive: true,
29
+ keepAliveInitialDelay: 10000,
30
+ minPoolSize: 3,
31
+ })
32
+
33
+ // mongoose.connection.on("")
34
+ mongoose.connection.on("disconnected", (arg) => {
35
+ console.log("Mongoose disconnected", arg)
36
+ })
37
+
38
+ mongoose.connection.on("error", (arg) => {
39
+ console.log("Mongoose connection error", arg)
40
+ })
41
+
42
+ // console.log("Mongoose connect got ret", ret)
28
43
  // console.log("waiting after return", ret)
29
44
  // TODO: handle connection retry and pools
30
45
  }
@@ -14,8 +14,6 @@ if (typeof SESSION_STORE_PORT === "string" && !validator.isPort(SESSION_STORE_PO
14
14
  throw new Error("expected SESSION_STORE_PORT to be a valid port number")
15
15
  }
16
16
 
17
- // console.log("ICIII", execSync("redis-cli -p 7979 -h session-store ping", {stdio: "inherit"}))
18
-
19
17
  const reconnectStrategy = (retries) => {
20
18
  console.log("reconnectStrategy::retrying with arg", retries)
21
19
  if (retries < 5) {
@@ -0,0 +1,8 @@
1
+ /* @flow */
2
+ const postmark = require("postmark")
3
+
4
+ const {POSTMARK_API_KEY} = process.env
5
+
6
+ const client = new postmark.ServerClient(POSTMARK_API_KEY)
7
+
8
+ module.exports = client
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/server",
3
- "version": "0.41.0",
3
+ "version": "0.44.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -11,16 +11,17 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "body-parser": "1.19.2",
14
- "connect-redis": "6.1.2",
14
+ "connect-redis": "6.1.3",
15
15
  "cors": "2.8.5",
16
- "debug": "4.3.3",
16
+ "debug": "4.3.4",
17
17
  "dotenv": "16.0.0",
18
18
  "express": "4.17.3",
19
19
  "express-session": "1.17.2",
20
20
  "glob": "7.2.0",
21
- "mongoose": "6.2.6",
21
+ "mongoose": "6.2.7",
22
+ "postmark": "3.0.1",
22
23
  "redis": "4.0.4",
23
24
  "validator": "13.7.0",
24
- "yargs": "17.3.1"
25
+ "yargs": "17.4.0"
25
26
  }
26
27
  }