@rpcbase/server 0.261.0 → 0.263.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/cli/get_runtime.js +2 -11
- package/cli/run_native.js +1 -2
- package/cli/start_server_infrastructure.js +0 -1
- package/database.js +4 -2
- package/infrastructure/redis/redis.conf +2 -2
- package/package.json +6 -6
- package/queue/index.js +6 -3
- package/src/sessions/session_store_middleware.js +3 -5
- package/infrastructure/compose-redis.yml +0 -19
package/cli/get_runtime.js
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
/* @flow */
|
|
2
|
-
const
|
|
2
|
+
const is_docker = require("@rpcbase/std/is_docker")
|
|
3
3
|
|
|
4
|
-
const {CONTAINER_MODE} = process.env
|
|
5
4
|
|
|
6
5
|
const get_runtime = () => {
|
|
7
|
-
|
|
8
|
-
return "docker"
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (os.platform() === "darwin") {
|
|
12
|
-
return "native"
|
|
13
|
-
} else {
|
|
14
|
-
return "docker"
|
|
15
|
-
}
|
|
6
|
+
return is_docker() ? "docker" : "native"
|
|
16
7
|
}
|
|
17
8
|
|
|
18
9
|
module.exports = get_runtime
|
package/cli/run_native.js
CHANGED
|
@@ -12,7 +12,6 @@ const get_runtime = require("./get_runtime")
|
|
|
12
12
|
const start_server = async(args) => {
|
|
13
13
|
const infrastructure_dir = path.join(process.cwd(), "../infrastructure")
|
|
14
14
|
|
|
15
|
-
// TODO: remove and rely on container_mode only
|
|
16
15
|
const runtime = get_runtime()
|
|
17
16
|
|
|
18
17
|
// prefix
|
package/database.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
const isPort = require("validator/lib/isPort")
|
|
3
3
|
|
|
4
|
+
const is_docker = require("@rpcbase/std/is_docker")
|
|
5
|
+
|
|
4
6
|
const mongoose = require("./mongoose")
|
|
5
7
|
|
|
6
8
|
const pack = require("./package.json")
|
|
@@ -11,7 +13,7 @@ require("./src/models/Invite")
|
|
|
11
13
|
require("./src/models/ResetPasswordToken")
|
|
12
14
|
|
|
13
15
|
|
|
14
|
-
const {DATABASE_NAME, DATABASE_PORT
|
|
16
|
+
const {DATABASE_NAME, DATABASE_PORT} = process.env
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
// database can be set by env variable or passed as paramaters to
|
|
@@ -24,7 +26,7 @@ if (typeof DATABASE_NAME !== "string") {
|
|
|
24
26
|
throw new Error("expected DATABASE_NAME to be a string")
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
const hostname =
|
|
29
|
+
const hostname = is_docker() ? "database" : "127.0.0.1"
|
|
28
30
|
|
|
29
31
|
const mongo_url = `mongodb://${hostname}:${DATABASE_PORT}/${DATABASE_NAME}?directConnection=true&replicaSet=rs0`
|
|
30
32
|
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
# You will also need to set a password unless you explicitly disable protected
|
|
85
85
|
# mode.
|
|
86
86
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
87
|
-
bind
|
|
87
|
+
bind 0.0.0.0
|
|
88
88
|
|
|
89
89
|
# By default, outgoing connections (from replica to master, from Sentinel to
|
|
90
90
|
# instances, cluster bus, etc.) are not bound to a specific local address. In
|
|
@@ -108,7 +108,7 @@ bind 127.0.0.1 -::1
|
|
|
108
108
|
# By default protected mode is enabled. You should disable it only if
|
|
109
109
|
# you are sure you want clients from other hosts to connect to Redis
|
|
110
110
|
# even if no authentication is configured.
|
|
111
|
-
protected-mode
|
|
111
|
+
protected-mode no
|
|
112
112
|
|
|
113
113
|
# Redis uses default hardened security configuration directives to reduce the
|
|
114
114
|
# attack surface on innocent users. Therefore, several sensitive configuration
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.263.0",
|
|
4
4
|
"license": "SSPL-1.0",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -11,19 +11,19 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@rpcbase/access-control": "0.27.0",
|
|
14
|
-
"@rpcbase/agent": "0.
|
|
15
|
-
"@rpcbase/std": "0.
|
|
16
|
-
"@sentry/node": "7.
|
|
14
|
+
"@rpcbase/agent": "0.33.0",
|
|
15
|
+
"@rpcbase/std": "0.12.0",
|
|
16
|
+
"@sentry/node": "7.72.0",
|
|
17
17
|
"bluebird": "3.7.2",
|
|
18
18
|
"body-parser": "1.20.2",
|
|
19
19
|
"bull": "4.11.3",
|
|
20
|
-
"connect-redis": "
|
|
20
|
+
"connect-redis": "7.1.0",
|
|
21
21
|
"cors": "2.8.5",
|
|
22
22
|
"debug": "4.3.4",
|
|
23
23
|
"dotenv": "16.3.1",
|
|
24
24
|
"express": "4.18.2",
|
|
25
25
|
"express-session": "1.17.3",
|
|
26
|
-
"firebase-admin": "11.
|
|
26
|
+
"firebase-admin": "11.11.0",
|
|
27
27
|
"glob": "9.3.5",
|
|
28
28
|
"lodash": "4.17.21",
|
|
29
29
|
"mkdirp": "2.1.3",
|
package/queue/index.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
const Queue = require("bull")
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const is_docker = require("@rpcbase/std/is_docker")
|
|
5
|
+
|
|
6
|
+
const {WORKER_QUEUE_PORT} = process.env
|
|
7
|
+
|
|
8
|
+
const hostname = is_docker() ? "worker-queue" : "127.0.0.1"
|
|
9
|
+
|
|
6
10
|
const worker_queue_url = `redis://${hostname}:${WORKER_QUEUE_PORT}`
|
|
7
11
|
|
|
8
12
|
const QUEUE_NAME = "worker-queue"
|
|
9
13
|
|
|
10
|
-
|
|
11
14
|
const tasks_list = Object.create(null)
|
|
12
15
|
|
|
13
16
|
let worker_queue
|
|
@@ -7,7 +7,7 @@ const {createClient} = require("redis")
|
|
|
7
7
|
const redis_store = require("connect-redis")(session)
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
const {SESSION_STORE_PORT,
|
|
10
|
+
const {SESSION_STORE_PORT, APP_DOMAIN} = process.env
|
|
11
11
|
assert(SESSION_STORE_PORT, "SESSION_STORE_PORT is undefined")
|
|
12
12
|
|
|
13
13
|
|
|
@@ -22,7 +22,7 @@ if (typeof SESSION_STORE_PORT === "string" && !validator.isPort(SESSION_STORE_PO
|
|
|
22
22
|
throw new Error("expected SESSION_STORE_PORT to be a valid port number")
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const hostname =
|
|
25
|
+
const hostname = is_docker() ? "session-store" : "127.0.0.1"
|
|
26
26
|
|
|
27
27
|
console.log("session-store hostname", hostname, "port", SESSION_STORE_PORT)
|
|
28
28
|
|
|
@@ -76,7 +76,7 @@ setTimeout(async() => {
|
|
|
76
76
|
// WARNING: apparently doesn't work on localhost or .local domains
|
|
77
77
|
// https://stackoverflow.com/questions/1134290/cookies-on-localhost-with-explicit-domain
|
|
78
78
|
// TODO: WTF IS THIS
|
|
79
|
-
// if (
|
|
79
|
+
// if (is_docker() && typeof APP_DOMAIN === "string" && APP_DOMAIN.trim() !== "") {
|
|
80
80
|
// log("\n\n")
|
|
81
81
|
// log("SETTING COOKIE DOMAIN TO", APP_DOMAIN)
|
|
82
82
|
// log("SETTING secure", APP_DOMAIN)
|
|
@@ -89,8 +89,6 @@ setTimeout(async() => {
|
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
session_middleware = session(session_config)
|
|
92
|
-
|
|
93
|
-
// TODO: is this still necessary
|
|
94
92
|
}, 200)
|
|
95
93
|
|
|
96
94
|
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# docker-compose
|
|
2
|
-
version: "3"
|
|
3
|
-
|
|
4
|
-
services:
|
|
5
|
-
# connect-redis session store
|
|
6
|
-
session-store:
|
|
7
|
-
image: redis:6.2.7-alpine
|
|
8
|
-
volumes:
|
|
9
|
-
- ./redis/redis.conf:/usr/local/etc/redis/redis.conf
|
|
10
|
-
- ./data/session-store/log/:/var/log/
|
|
11
|
-
networks:
|
|
12
|
-
- local-network
|
|
13
|
-
ports:
|
|
14
|
-
- "127.0.0.1:$SESSION_STORE_PORT:$SESSION_STORE_PORT"
|
|
15
|
-
command: [
|
|
16
|
-
"redis-server",
|
|
17
|
-
"/usr/local/etc/redis/redis.conf",
|
|
18
|
-
"--port", $SESSION_STORE_PORT
|
|
19
|
-
]
|