cube.js 目前来说是越来越复杂了(不是代码多复杂,而且融合了不少三方语言,python,rust, node addon java)如果网络不是很好的情况下
编译cube.js 是极其痛苦的,而且不少依赖问题,cube.js 实际上很早就支持oracle,但是今天oracle 比较给力提供了基于node 的原生实现
这样node 系统集成起来就很方便了,以下是一个简单试用(基于容器运行)
环境
- docker-compose
核心部分是自己替换了cube 内部的oracle driver
version: '2.2'
services:
cube:
image: cubejs/cube:v0.34.5
ports:
# It's better to use random port binding for 4000/3000 ports
# without it you will not able to start multiple projects inside docker
- 4000:4000 # Cube API and Developer Playground
- 3000:3000 # Dashboard app, if created
env_file: .env
volumes:
- .:/cube/conf
# We ignore Cube deps, because they are built-in inside the official Docker image
- .empty:/cube/conf/node_modules/@cubejs-backend/
- ./node_modules/oracledb:/cube/node_modules/oracledb
- pacakge.json
{
"name": "hello-world2",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "cubejs-server"
},
"template": "docker",
"templateVersion": "0.34.5",
"devDependencies": {
"@cubejs-backend/oracle-driver": "^0.34.1",
"@cubejs-backend/server": "^0.34.5"
},
"overrides": {
"@cubejs-backend/oracle-driver":{
"oracledb":"6.2.0"
}
},
"dependencies": {
"oracledb": "^6.2.0"
}
}
- 环境变量
# Cube environment variables: https://cube.dev/docs/reference/environment-variables
CUBEJS_DEV_MODE=true
CUBEJS_DB_TYPE=oracle
CUBEJS_API_SECRET=a9508cba761044b1ab6b419a1ae57fd4737d4dff710e458cbb7429b05bc5b329fbc952f11ae20bd31d61e248105be1c2c06ef1a9a20474cb17e12b6ea3e7f553
CUBEJS_EXTERNAL_DEFAULT=true
CUBEJS_SCHEDULED_REFRESH_DEFAULT=true
CUBEJS_SCHEMA_PATH=model
CUBEJS_WEB_SOCKETS=true
CUBEJS_DB_HOST=xxxx
CUBEJS_DB_NAME=xxx
CUBEJS_DB_USER=xxx
CUBEJS_DB_PASS=xxxx
- 效果
说明
目前来说cube.js 的确是越来越重了,对于简单场景抛起来还是需要不少东西要做,如果自己扩展,当前版本需要好好研究下,目前新版本是添加了不少特性,但是越来越复杂了,尤其在安装的时候,比如cubestore,一些native 组件
参考资料
https://node-oracledb.readthedocs.io/en/latest/user_guide/installation.html
https://cube.dev/docs/product/configuration/data-sources/oracle