You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Include version in startup message (cube-js#615) Thanks to jcw-!
* feat: Include version in startup message
* Add version to startup message
* Add version to CubejsServer
* Add version to CubejsServerCore
* Make version available in return of listen
* Use version returned from listen
* Make version an immutable static method
* Update docs with how to use version
* Update doc examples to log version
* Update examples to log version
* Update guides to log version
* Update TypeScript type to include version
Copy file name to clipboardexpand all lines: docs/Cube.js-Backend/@cubejs-backend-server-core.md
+12-3
Original file line number
Diff line number
Diff line change
@@ -195,7 +195,6 @@ CubejsServerCore.create({
195
195
})
196
196
```
197
197
198
-
199
198
### contextToAppId
200
199
201
200
It is a [Multitenancy Setup](multitenancy-setup) option.
@@ -319,7 +318,7 @@ It is usually used in [Multitenancy Setup](multitenancy-setup).
319
318
320
319
### schemaVersion
321
320
322
-
Schema version can be used to tell Cube.js schema should be recompiled in case schema code depends on dynamic definitions fetched from some external database or API.
321
+
Schema version can be used to tell Cube.js schema should be recompiled in case schema code depends on dynamic definitions fetched from some external database or API.
323
322
This method is called on each request however `RequestContext` parameter is reused per application id returned by [contextToAppId](#options-reference-context-to-app-id).
324
323
If returned string has been changed, schema will be recompiled.
325
324
It can be used in both multitenant and single tenant environments.
@@ -369,7 +368,7 @@ Providing `updateCompilerCacheKeepAlive: true` keeps frequently used schemas in
Instantiates the Express.js App to listen to the specified `PORT`. Returns a promise that resolves with the following members:
36
46
37
47
*`port {number}` The port at which CubejsServer is listening for insecure connections for redirection to HTTPS, as specified by the environment variable `PORT`. Defaults to 4000.
48
+
*`tlsPort {number}` If TLS is enabled, the port at which CubejsServer is listening for secure connections, as specified by the environment variable `TLS_PORT`. Defaults to 4433.
38
49
*`app {Express.Application}` The express App powering CubejsServer
39
50
*`server {http.Server}` The `http` Server instance. If TLS is enabled, returns a `https.Server` instance instead.
51
+
*`version {string}` The semantic package version of `@cubejs-backend/server`
40
52
41
53
Cube.js can also support TLS encryption. See the [Security page on how to enable tls](security#enabling-tls) for more information.
Copy file name to clipboardexpand all lines: docs/Cube.js-Backend/Caching.md
+14-14
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ The second in-database level is called **pre-aggregations** and requires explici
19
19
Cube.js caches the results of executed queries using in-memory cache. The cache
20
20
key is generated SQL with any existing query dependent pre-aggregations.
21
21
22
-
Upon incoming request Cube.js first checks the cache using this key.
22
+
Upon incoming request Cube.js first checks the cache using this key.
23
23
If nothing is found it executes the query in database, returns result back alongside writing to the cache.
24
24
Since 0.15.0 in case there's an existing value in cache it will be returned only if `refreshKey` value for query isn't changed.
25
25
Otherwise [query renewal](#in-memory-cache-force-query-renewal) will be performed.
@@ -33,12 +33,12 @@ So, Cube.js defines a `refreshKey` for each cube. [refreshKeys](cube#parameters-
33
33
34
34
__Note__: Cube.js *also caches* the results of `refreshKeys` for a fixed time interval in order to avoid issuing them too often. If you need Cube.js to immediately respond to changes in data, see the [Force Query Renewal](#in-memory-cache-force-query-renewal) section.
35
35
36
-
When a query's result needs to be refreshed, Cube.js will re-execute the query in the foreground and repopulate the cache.
37
-
This means that cached results may still be served to users requesting them while `refreshKey` values aren't changed from Cube.js perspective.
36
+
When a query's result needs to be refreshed, Cube.js will re-execute the query in the foreground and repopulate the cache.
37
+
This means that cached results may still be served to users requesting them while `refreshKey` values aren't changed from Cube.js perspective.
38
38
The cache entry will be refreshed in the foreground if one of the two following conditions is met:
39
39
40
40
- Query cache entry is expired. The default expiration time is 6 hours for cubes with default `refreshKey` and 24 hours where it was set.
41
-
- The result of the `refreshKey` SQL query is different from the previous one. At this stage `refreshKey` won't be refreshed in foreground if it's available in cache.
41
+
- The result of the `refreshKey` SQL query is different from the previous one. At this stage `refreshKey` won't be refreshed in foreground if it's available in cache.
42
42
43
43
### Refresh Key Implementation
44
44
@@ -57,8 +57,8 @@ You can set up a custom refresh check SQL by changing [refreshKey](cube#paramete
57
57
58
58
In these instances, Cube.js needs a query crafted to detect updates to the rows that power the cubes. Often, a `MAX(updated_at_timestamp)` for OLTP data will accomplish this, or examining a metadata table for whatever system is managing the data to see when it last ran.
59
59
60
-
Note that the result of `refreshKey` query itself is cached for 10 seconds for RDBMS backends and for 2 minutes for big data backends by default.
61
-
You can change it by passing [refreshKey every](cube#parameters-refresh-key) parameter.
60
+
Note that the result of `refreshKey` query itself is cached for 10 seconds for RDBMS backends and for 2 minutes for big data backends by default.
61
+
You can change it by passing [refreshKey every](cube#parameters-refresh-key) parameter.
62
62
This cache is useful so that Cube.js can build query result cache keys without issuing database queries and respond to cached requests very quickly.
63
63
64
64
### Force Query Renewal
@@ -75,8 +75,8 @@ If you need to force a specific query to load fresh data from the database (if i
75
75
76
76
The `renewQuery` option applies to the `refreshKey` caching system mentioned above, *not* the actual query result cache. If `renewQuery` is passed, Cube.js will always re-execute the `refreshKey` query, skipping that layer of caching, but, if the result of the `refreshKey` query is the same as the last time it ran, that indicates any current query result cache entries are valid, and they will be served. This means that cached data may still be served by Cube.js even if `renewQuery` is passed. This is a good thing: if the underlying data hasn't changed, the expensive query doesn't need to be re-run, and the database doesn't have to work as hard. This does mean that the `refreshKey` SQL must accurately report data freshness for the `renewQuery` to actually work and renew the query.
77
77
78
-
For situations like real-time analytics or responding to live user changes to underlying data, the `refreshKey` query cache can prevent fresh data from showing up immediately.
79
-
For these situations, you can mostly disable the `refreshKey` cache by setting the [refreshKey every](cube#parameters-refresh-key) parameter to something very low, like `1 second`.
78
+
For situations like real-time analytics or responding to live user changes to underlying data, the `refreshKey` query cache can prevent fresh data from showing up immediately.
79
+
For these situations, you can mostly disable the `refreshKey` cache by setting the [refreshKey every](cube#parameters-refresh-key) parameter to something very low, like `1 second`.
80
80
This means Cube.js will always check the data freshness before executing a query, and notice any changed data underneath.
81
81
82
82
## Pre-Aggregations
@@ -100,7 +100,7 @@ reference.](pre-aggregations)
100
100
```javascript
101
101
cube(`Orders`, {
102
102
// ...
103
-
103
+
104
104
preAggregations: {
105
105
amountByCreated: {
106
106
type:`rollup`,
@@ -113,7 +113,7 @@ cube(`Orders`, {
113
113
```
114
114
115
115
### Refresh Strategy
116
-
116
+
117
117
Refresh strategy can be customized by setting the [refreshKey](pre-aggregations#refresh-key) property for the pre-aggregation.
118
118
119
119
The default value of the `refreshKey` is the same as for cube that defines pre-aggregation.
@@ -123,7 +123,7 @@ It can be redefined either by providing SQL
123
123
```javascript
124
124
cube(`Orders`, {
125
125
// ...
126
-
126
+
127
127
preAggregations: {
128
128
amountByCreated: {
129
129
type:`rollup`,
@@ -143,7 +143,7 @@ or by providing refresh time interval
143
143
```javascript
144
144
cube(`Orders`, {
145
145
// ...
146
-
146
+
147
147
preAggregations: {
148
148
amountByCreated: {
149
149
type:`rollup`,
@@ -183,8 +183,8 @@ const server = new CubejsServer();
Copy file name to clipboardexpand all lines: docs/Cube.js-Backend/Deployment.md
+9-11
Original file line number
Diff line number
Diff line change
@@ -15,16 +15,16 @@ Below you can find guides for popular deployment environments:
15
15
16
16
## Production Mode
17
17
18
-
When running Cube.js Backend in production make sure `NODE_ENV` is set to `production`.
18
+
When running Cube.js Backend in production make sure `NODE_ENV` is set to `production`.
19
19
Such platforms, such as Heroku, do it by default.
20
20
In this mode Cube.js unsecured development server and Playground will be disabled by default because there's a security risk serving those in production environments.
21
-
Production Cube.js servers can be accessed only with [REST API](rest-api) and Cube.js frontend libraries.
21
+
Production Cube.js servers can be accessed only with [REST API](rest-api) and Cube.js frontend libraries.
22
22
23
23
### Redis
24
24
25
-
Also, Cube.js requires [Redis](https://redis.io/), in-memory data structure store, to run in production.
26
-
It uses Redis for query caching and queue.
27
-
Set `REDIS_URL` environment variable to provide Cube.js with Redis connection. In case your Redis instance has password, please set password via `REDIS_PASSWORD` environment variable.
25
+
Also, Cube.js requires [Redis](https://redis.io/), in-memory data structure store, to run in production.
26
+
It uses Redis for query caching and queue.
27
+
Set `REDIS_URL` environment variable to provide Cube.js with Redis connection. In case your Redis instance has password, please set password via `REDIS_PASSWORD` environment variable.
28
28
Make sure, your Redis allows at least 15 concurrent connections.
29
29
Set `REDIS_TLS` env variable to `true` if you want to enable secure connection.
30
30
@@ -65,7 +65,7 @@ app.listen(port, (err) => {
65
65
console.error('Fatal error during server start: ');
66
66
console.error(e.stack|| e);
67
67
}
68
-
console.log(`π Cube.js server is listening on ${port}`);
68
+
console.log(`π Cube.js server (${CubejsServerCore.version()}) is listening on ${port}`);
To run the server in docker-compose we need to add a redis server and a .env file to include the environment variables needed to connect to the database, the secret api secret and redis hostname.
373
+
To run the server in docker-compose we need to add a redis server and a .env file to include the environment variables needed to connect to the database, the secret api secret and redis hostname.
0 commit comments