From 8d8cc79921549a237ceb37fcdbc78b25a3585d68 Mon Sep 17 00:00:00 2001 From: wangshiyouyang Date: Wed, 13 Dec 2023 21:37:23 +0800 Subject: [PATCH] Change Name --- .env.template | 18 +- Docker_install.md | 4 +- Docker_install_CN.md | 36 ++-- Dockerfile.template | 4 +- README.md | 34 ++-- README_CN.md | 34 ++-- ai/backend/util/db/postgresql_report.py | 8 +- bi/settings/__init__.py | 246 ++++++++++++------------ bi/settings/organization.py | 46 ++--- bi/utils/__init__.py | 4 +- bin/docker-entrypoint | 12 +- docker-compose.yml | 16 +- ubuntu_CN_install.sh | 26 +-- ubuntu_install.sh | 24 +-- 14 files changed, 256 insertions(+), 256 deletions(-) diff --git a/.env.template b/.env.template index f78d2be1..60ef51f6 100644 --- a/.env.template +++ b/.env.template @@ -1,16 +1,16 @@ -#HOLMES environment variables +#DEEPBI environment variables #log level -HOLMES_LOG_LEVEL=INFO +DEEPBI_LOG_LEVEL=INFO # use other redis config; default: docker redis://redis:6379/0 -# HOLMES_REDIS_URL=redis://127.0.0.1:6379/0 +# DEEPBI_REDIS_URL=redis://127.0.0.1:6379/0 # session encryption string -HOLMES_COOKIE_SECRET=SEC_KEY -# database encryption string, same with HOLMES_SECRET_KEY, you can change -HOLMES_SECRET_KEY=SEC_KEY +DEEPBI_COOKIE_SECRET=SEC_KEY +# database encryption string, same with DEEPBI_SECRET_KEY, you can change +DEEPBI_SECRET_KEY=SEC_KEY # use other postgresql database; default docker postgresql://postgres@postgres/postgres -# HOLMES_DATABASE_URL="postgresql://user:pwd@ip/database" +# DEEPBI_DATABASE_URL="postgresql://user:pwd@ip/database" # allow custom js visualizations -HOLMES_FEATURE_ALLOW_CUSTOM_JS_VISUALIZATIONS=True +DEEPBI_FEATURE_ALLOW_CUSTOM_JS_VISUALIZATIONS=True # Language CN/EN, only ip address ,no WEB_LANGUAGE=LANGTYPE # web server ip address or domain,for ai get database config option. port 5000,same with Docker @@ -18,7 +18,7 @@ WEB_SERVER=IP:WEB_PORT # api secret key for ai get database config option DB_API_SECRET_KEY=SEC_KEY # web content security policy -HOLMES_CONTENT_SECURITY_POLICY="style-src 'self' 'unsafe-inline'; font-src 'self' data:; img-src 'self' http: https: data: blob:; object-src 'none'; frame-ancestors 'none';" +DEEPBI_CONTENT_SECURITY_POLICY="style-src 'self' 'unsafe-inline'; font-src 'self' data:; img-src 'self' http: https: data: blob:; object-src 'none'; frame-ancestors 'none';" # socket dir, need set Localhost ip REACT_APP_SOCKET_URL=IP:SOCKET_PORT/chat/ # static file CDN diff --git a/Docker_install.md b/Docker_install.md index 2f11282d..6acc3121 100644 --- a/Docker_install.md +++ b/Docker_install.md @@ -44,8 +44,8 @@ sudo ln -s /usr/bin/docker-compose /usr/local/bin/docker-compose - Start the docker command ```sudo service docker start``` - Check the docker running status command``` service docker status``` It should be "active (running)" - Install network management commands```sudo apt install net-tools``` -- Download the Holmes code by the command : ```git clone git@github.com:DeepThought-AI/Holmes.git``` -- Run the command ```cd Holmes``` to the corresponding folder and run install file ```sudo ./install.sh``` +- Download the DeepBi code by the command : ```git clone git@github.com:DeepThought-AI/DeepBi.git``` +- Run the command ```cd DeepBi``` to the corresponding folder and run install file ```sudo ./install.sh``` ## Ubuntu - Run the command as follows: diff --git a/Docker_install_CN.md b/Docker_install_CN.md index 7a7f56e0..d05d2f4d 100644 --- a/Docker_install_CN.md +++ b/Docker_install_CN.md @@ -55,38 +55,38 @@ sudo ln -s /usr/bin/docker-compose /usr/local/bin/docker-compose ``` 11. 安装网络管理 命令: ```sudo apt install net-tools``` 12. 上面安装完毕docker ,以后就不用再次安装 -## 配置Holmes +## 配置DeepBi 13. 运行命令 ```service docker status``` 确认docker是在运行 "active (running)"
14. 获取本机内网IP地址,记录下来,一般是192.168.1.xxx,稍后可以用在安装路径下 如下图:
![ip.png](user_manual/cn/img/ip.png) -15.然后,安装Holmes有两种方式,任选其一 如下 +15.然后,安装DeepBi有两种方式,任选其一 如下 - (1)直接下载压做包 (推荐) - 在WSL命令行中运行命令 : ```pwd``` 你会看到你目前的文件夹地址 比如 ```/mnt/c/Windows/system32``` -- 点击”链接“通过网页下载我们的代码 如下图 +- 点击”链接“通过网页下载我们的代码 如下图 - ![download.png](user_manual/cn/img/download.png) -- 解压后的文件夹 "Holmes" 移动到 C:/Windows/system32 (也就是上面看到的文件夹地址,c表示C盘) -- 回到WSL命令行,运行命令```cd Holmes ```进入项目文件夹 +- 解压后的文件夹 "DeepBi" 移动到 C:/Windows/system32 (也就是上面看到的文件夹地址,c表示C盘) +- 回到WSL命令行,运行命令```cd DeepBi ```进入项目文件夹 - 修改权限 ```sudo chmod +x ./Install.sh``` - 运行命令```sudo ./Install_cn.sh ``` 开始安装,安装结束后会有一个网址提示,直接浏览器访问即可 - (2)通过命令下载代码 (需要本地github公钥) -- 下载我们的代码,```git clone git@github.com:DeepThought-AI/Holmes.git``` +- 下载我们的代码,```git clone git@github.com:DeepThought-AI/DeepBi.git``` - 出现 ```Are you sure you want to continue connecting (yes/no/[fingerprint])? ``` - 输入 ```yes``` 回车 -- 进入项目文件夹 ```cd Holmes ``` +- 进入项目文件夹 ```cd DeepBi ``` - 修改权限 ```sudo chmod +x ./Install.sh``` - 运行命令```sudo ./Install_cn.sh ``` 开始安装
16. 安装结束后会有一个网址提示,直接浏览器访问即可
-(注意*关闭命令符窗口将无法访问属于Holmes网址 - 再次使用Holmes,打开“命令提示符”窗口“以管理员身份运行” +(注意*关闭命令符窗口将无法访问属于DeepBi网址 + 再次使用DeepBi,打开“命令提示符”窗口“以管理员身份运行” ``` 1.运行“wsl”命令 - 2.运行“cd Holmes”命令 + 2.运行“cd DeepBi”命令 3.运行“sudo docker-compose start”命令 ``` - 就可以去浏览器中打开自己Holmes网址了【网址都是http://‘本机内网IP地址’:8338】 + 就可以去浏览器中打开自己DeepBi网址了【网址都是http://‘本机内网IP地址’:8338】 # Ubuntu @@ -108,14 +108,14 @@ systemctl start docker sud apt-get -y install apt-transport-https ca-certificates curl software-properties-common sudo systemctl enable docker ``` -## 配置Holmes +## 配置DeepBi 3. 开始下载我们的代码文件 ``` -git clone git@github.com:DeepThought-AI/Holmes.git +git clone git@github.com:DeepThought-AI/DeepBi.git ``` -4. 解压后重命名为 "Holmes" 然后进入目录 +4. 解压后重命名为 "DeepBi" 然后进入目录 ``` - cd Holmes && sudo chmod+x./Install.sh + cd DeepBi && sudo chmod+x./Install.sh . Install_cn.sh ``` 5. 注意上面运行的是 . Install_cn.sh @@ -146,9 +146,9 @@ git clone git@github.com:DeepThought-AI/Holmes.git - 运行命令:```brew services start docker``` - 检查命令:```brew services list |grep docker``` -## 配置Holmes -- 下载代码```git clone git@github.com:DeepThought-AI/Holmes.git``` -- 运行命令到对应文件夹 ```cd Holmes ``` +## 配置DeepBi +- 下载代码```git clone git@github.com:DeepThought-AI/DeepBi.git``` +- 运行命令到对应文件夹 ```cd DeepBi ``` - 修改权限 ```sudo chmod+x ./Install.sh``` - 运行命令```sudo ./Install_cn.sh ``` 开始安装,安装结束后会有一个网址提示,直接浏览器访问即可 diff --git a/Dockerfile.template b/Dockerfile.template index 275637eb..90898a4c 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -40,7 +40,7 @@ RUN apt-get clean && apt-get update && \ # ali pip source #CN#RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple #CN#RUN pip install --upgrade pip -COPY --chown=holmes . /app +COPY --chown=deepbi . /app WORKDIR /app ## Disable PIP Cache and Version Check ENV PIP_DISABLE_PIP_VERSION_CHECK=1 @@ -55,7 +55,7 @@ RUN pip install -r requirements.txt && pip install -r requirements_ai.txt ## fix python 3.8.18 error import . RUN sed -i 's/from importlib_resources import path/from importlib.resources import path/g' /usr/local/lib/python3.8/site-packages/saml2/sigver.py && \ sed -i 's/from importlib_resources import path/from importlib.resources import path/g' /usr/local/lib/python3.8/site-packages/saml2/xml/schema/__init__.py && \ - chown holmes /app && chmod +x /app/ai/main.py + chown deepbi /app && chmod +x /app/ai/main.py ENTRYPOINT ["/app/bin/docker-entrypoint"] CMD ["server"] diff --git a/README.md b/README.md index b6dcac3a..c4468037 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -

Holmes

+

DeepBi

-Holmes is an AI-native data analysis platform. Holmes leverages the power of large language models to explore, query, visualize, and share data from any data source. Users can use Holmes to gain data insight and make data-driven decisions. +DeepBi is an AI-native data analysis platform. DeepBi leverages the power of large language models to explore, query, visualize, and share data from any data source. Users can use DeepBi to gain data insight and make data-driven decisions.
@@ -14,7 +14,7 @@ Developer:dev@deep-thought.io Business:hi@deep-thought.io
-If you think Holmes is helpful to you, please help by clicking here on the ⭐ Star and Fork in the upper right corner. Your support is the greatest driving force for Holmes to become better. +If you think DeepBi is helpful to you, please help by clicking here on the ⭐ Star and Fork in the upper right corner. Your support is the greatest driving force for DeepBi to become better.
@@ -24,11 +24,11 @@ If you think Holmes is helpful to you, please help by clicking Issue +- Issue diff --git a/README_CN.md b/README_CN.md index 90467c79..b8a68dc8 100644 --- a/README_CN.md +++ b/README_CN.md @@ -1,8 +1,8 @@ -

Holmes

+

DeepBi

-Holmes是一款AI原生的数据分析平台。Holmes充分利用大语言模型的能力来探索、查询、可视化和共享来自任何数据源的数据。用户可以使用Holmes洞察数据并做出数据驱动的决策。 +DeepBi是一款AI原生的数据分析平台。DeepBi充分利用大语言模型的能力来探索、查询、可视化和共享来自任何数据源的数据。用户可以使用DeepBi洞察数据并做出数据驱动的决策。
@@ -16,8 +16,8 @@ Holmes是一款AI原生的数据分析平台。Holmes充分利用大语言模型 开发:dev@deep-thought.io,工作及商务:hi@deep-thought.io
- 如果觉得 Holmes 对您有帮助的话,请帮忙 - 的右上角点个⭐ Star 和 Fork,您的支持是 Holmes 变得更好最大的动力 + 如果觉得 DeepBi 对您有帮助的话,请帮忙 + 的右上角点个⭐ Star 和 Fork,您的支持是 DeepBi 变得更好最大的动力
@@ -25,10 +25,10 @@ Holmes是一款AI原生的数据分析平台。Holmes充分利用大语言模型 ## 案例视频 -https://github.com/DeepThought-AI/Holmes/assets/151519374/f0d2fcd4-32b0-4095-a892-b9bbf8a51602 +https://github.com/DeepThought-AI/DeepBi/assets/151519374/f0d2fcd4-32b0-4095-a892-b9bbf8a51602 ## 使用说明 -[Holmes 使用说明](client/app/assets/images/cn/user_manual_cn.md) +[DeepBi 使用说明](client/app/assets/images/cn/user_manual_cn.md) ## ✨ 特性 @@ -44,14 +44,14 @@ https://github.com/DeepThought-AI/Holmes/assets/151519374/f0d2fcd4-32b0-4095-a89 ## 🚀 支持的数据库 -Holmes 支持的数据库连接有: +DeepBi 支持的数据库连接有: - MySQL - PostgreSQL - csv/Excel导入 ## 📦 Docker 安装部署 -按照 [使用 Docker 安装](Docker_install_CN.md) 中对应自己的系统操作步骤操作,最后获取Holmes网址,即可使用 +按照 [使用 Docker 安装](Docker_install_CN.md) 中对应自己的系统操作步骤操作,最后获取DeepBi网址,即可使用 ## 📦 Ubuntu 直接安装 @@ -61,7 +61,7 @@ Holmes 支持的数据库连接有: 1. redis 可以直接通过127.0.0.1,无密码命令行访问 2. python版本要求3.8+ 建议使用pyenv coda 等虚拟环境 3. postgresql 需要安装postgresql-16 版本 -- 下载代码``` git clone git@github.com:DeepThought-AI/Holmes.git ``` +- 下载代码``` git clone git@github.com:DeepThought-AI/DeepBi.git ``` - 直接运行 ```. ubuntu_CN_install.sh ```即可
(注意,这里运行的是 . ubuntu_CN_install.sh 而不是sh xxx, 因为需要运行python 虚拟环境) - 默认使用端口 8338 8339 - web访问: http://[ip]:8338 @@ -69,19 +69,19 @@ Holmes 支持的数据库连接有: 完成安装后, 请看上面的使用说明进行设置和使用 - 查看本机IP ```ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -vE '^inet 127(\.[0-9]{1,3}){3}'``` -## Holmes 命令 +## DeepBi 命令 - 进入项目目录后运行命令: ``` - docker-compose start # 启动Holmes 服务 - docker-compose stop # 停止Holmes 服务 - docker-compose ps # 查看 Holmes 服务 + docker-compose start # 启动DeepBi 服务 + docker-compose stop # 停止DeepBi 服务 + docker-compose ps # 查看 DeepBi 服务 ``` - 如果出现 ```... PermissionError ...``` 或者 ```... Permission denied ...``` 请在执行命令前 加sudo ``` - sudo docker-compose start # 启动Holmes 服务 - sudo docker-compose stop # 停止Holmes 服务 - sudo docker-compose ps # 查看 Holmes 服务 + sudo docker-compose start # 启动DeepBi 服务 + sudo docker-compose stop # 停止DeepBi 服务 + sudo docker-compose ps # 查看 DeepBi 服务 ``` @@ -90,5 +90,5 @@ Holmes 支持的数据库连接有: ## 📑 文档 - 我们已经在 Mac OS 12.7/13.X /14.1.1 , Ubuntu 20.04/22.04 和 Windows11 WSL 22.04 系统测试。
如果有什么问题,可以联系我们 dev@deep-thought.io -- Issue +- Issue diff --git a/ai/backend/util/db/postgresql_report.py b/ai/backend/util/db/postgresql_report.py index 92e025ac..a20711db 100644 --- a/ai/backend/util/db/postgresql_report.py +++ b/ai/backend/util/db/postgresql_report.py @@ -2,14 +2,14 @@ import psycopg2 # 创建数据库连接引擎,URL 形式 -HOLMES_DATABASE_URL = os.environ.get("HOLMES_DATABASE_URL", "postgresql://postgres@postgres/postgres") -print('HOLMES_DATABASE_URL : ', HOLMES_DATABASE_URL) +DEEPBI_DATABASE_URL = os.environ.get("DEEPBI_DATABASE_URL", "postgresql://postgres@postgres/postgres") +print('DEEPBI_DATABASE_URL : ', DEEPBI_DATABASE_URL) class PsgReport: def connect(self): try: - conn = psycopg2.connect(HOLMES_DATABASE_URL) + conn = psycopg2.connect(DEEPBI_DATABASE_URL) print("Connected to PostgreSQL database!") return conn except (Exception, psycopg2.Error) as error: @@ -68,7 +68,7 @@ def update_data(self, data): # 示例用法 if __name__ == "__main__": - HOLMES_DATABASE_URL = "postgresql://redash:aaa123456@192.168.5.165/redash" + DEEPBI_DATABASE_URL = "postgresql://redash:aaa123456@192.168.5.165/redash" psg = PsgReport() data = (0, 37) re = psg.update_data(data) diff --git a/bi/settings/__init__.py b/bi/settings/__init__.py index c3b0ec50..51606fe9 100644 --- a/bi/settings/__init__.py +++ b/bi/settings/__init__.py @@ -17,11 +17,11 @@ # _REDIS_URL is the unchanged REDIS_URL we get from env vars, to be used later with RQ _REDIS_URL = os.environ.get( - "HOLMES_REDIS_URL", os.environ.get("HOLMES_REDIS_URL", "redis://redis:6379/0") + "DEEPBI_REDIS_URL", os.environ.get("DEEPBI_REDIS_URL", "redis://redis:6379/0") ) # This is the one to use for Bi' own connection: REDIS_URL = add_decode_responses_to_redis_url(_REDIS_URL) -PROXIES_COUNT = int(os.environ.get("HOLMES_PROXIES_COUNT", "1")) +PROXIES_COUNT = int(os.environ.get("DEEPBI_PROXIES_COUNT", "1")) WEB_LANGUAGE = os.environ.get('WEB_LANGUAGE', 'EN') # language code if 'CN' != WEB_LANGUAGE: WEB_LANGUAGE = "EN" @@ -31,14 +31,14 @@ if DATA_SOURCE_FILE_DIR is None or "" == DATA_SOURCE_FILE_DIR: DATA_SOURCE_FILE_DIR = "./user_upload_files" -STATSD_HOST = os.environ.get("HOLMES_STATSD_HOST", "127.0.0.1") -STATSD_PORT = int(os.environ.get("HOLMES_STATSD_PORT", "8125")) -STATSD_PREFIX = os.environ.get("HOLMES_STATSD_PREFIX", "holmes") -STATSD_USE_TAGS = parse_boolean(os.environ.get("HOLMES_STATSD_USE_TAGS", "false")) +STATSD_HOST = os.environ.get("DEEPBI_STATSD_HOST", "127.0.0.1") +STATSD_PORT = int(os.environ.get("DEEPBI_STATSD_PORT", "8125")) +STATSD_PREFIX = os.environ.get("DEEPBI_STATSD_PREFIX", "deepbi") +STATSD_USE_TAGS = parse_boolean(os.environ.get("DEEPBI_STATSD_USE_TAGS", "false")) # Connection settings for Bi's own database (where we store the queries, results, etc) SQLALCHEMY_DATABASE_URI = os.environ.get( - "HOLMES_DATABASE_URL", os.environ.get("HOLMES_DATABASE_URL", "postgresql://postgres@postgres/postgres") + "DEEPBI_DATABASE_URL", os.environ.get("DEEPBI_DATABASE_URL", "postgresql://postgres@postgres/postgres") ) SQLALCHEMY_MAX_OVERFLOW = int_or_none(os.environ.get("SQLALCHEMY_MAX_OVERFLOW")) SQLALCHEMY_POOL_SIZE = int_or_none(os.environ.get("SQLALCHEMY_POOL_SIZE")) @@ -55,88 +55,88 @@ # The following enables periodic job (every 5 minutes) of removing unused query results. QUERY_RESULTS_CLEANUP_ENABLED = parse_boolean( - os.environ.get("HOLMES_QUERY_RESULTS_CLEANUP_ENABLED", "true") + os.environ.get("DEEPBI_QUERY_RESULTS_CLEANUP_ENABLED", "true") ) QUERY_RESULTS_CLEANUP_COUNT = int( - os.environ.get("HOLMES_QUERY_RESULTS_CLEANUP_COUNT", "100") + os.environ.get("DEEPBI_QUERY_RESULTS_CLEANUP_COUNT", "100") ) QUERY_RESULTS_CLEANUP_MAX_AGE = int( - os.environ.get("HOLMES_QUERY_RESULTS_CLEANUP_MAX_AGE", "7") + os.environ.get("DEEPBI_QUERY_RESULTS_CLEANUP_MAX_AGE", "7") ) -SCHEMAS_REFRESH_SCHEDULE = int(os.environ.get("HOLMES_SCHEMAS_REFRESH_SCHEDULE", 30)) +SCHEMAS_REFRESH_SCHEDULE = int(os.environ.get("DEEPBI_SCHEMAS_REFRESH_SCHEDULE", 30)) -AUTH_TYPE = os.environ.get("HOLMES_AUTH_TYPE", "api_key") +AUTH_TYPE = os.environ.get("DEEPBI_AUTH_TYPE", "api_key") INVITATION_TOKEN_MAX_AGE = int( - os.environ.get("HOLMES_INVITATION_TOKEN_MAX_AGE", 60 * 60 * 24 * 7) + os.environ.get("DEEPBI_INVITATION_TOKEN_MAX_AGE", 60 * 60 * 24 * 7) ) # The secret key to use in the Flask app for various cryptographic features -SECRET_KEY = os.environ.get("HOLMES_COOKIE_SECRET", "c292b0a3ca32397cdb050e233733900f") +SECRET_KEY = os.environ.get("DEEPBI_COOKIE_SECRET", "c292b0a3ca32397cdb050e233733900f") if SECRET_KEY is None: - raise Exception("You must set the HOLMES_COOKIE_SECRET environment variable") + raise Exception("You must set the DEEPBI_COOKIE_SECRET environment variable") # The secret key to use when encrypting data source options -DATASOURCE_SECRET_KEY = os.environ.get("HOLMES_SECRET_KEY", SECRET_KEY) +DATASOURCE_SECRET_KEY = os.environ.get("DEEPBI_SECRET_KEY", SECRET_KEY) # Whether and how to redirect non-HTTP requests to HTTPS. Disabled by default. -ENFORCE_HTTPS = parse_boolean(os.environ.get("HOLMES_ENFORCE_HTTPS", "false")) +ENFORCE_HTTPS = parse_boolean(os.environ.get("DEEPBI_ENFORCE_HTTPS", "false")) ENFORCE_HTTPS_PERMANENT = parse_boolean( - os.environ.get("HOLMES_ENFORCE_HTTPS_PERMANENT", "false") + os.environ.get("DEEPBI_ENFORCE_HTTPS_PERMANENT", "false") ) # Whether file downloads are enforced or not. -ENFORCE_FILE_SAVE = parse_boolean(os.environ.get("HOLMES_ENFORCE_FILE_SAVE", "true")) +ENFORCE_FILE_SAVE = parse_boolean(os.environ.get("DEEPBI_ENFORCE_FILE_SAVE", "true")) # Whether api calls using the json query runner will block private addresses ENFORCE_PRIVATE_ADDRESS_BLOCK = parse_boolean( - os.environ.get("HOLMES_ENFORCE_PRIVATE_IP_BLOCK", "true") + os.environ.get("DEEPBI_ENFORCE_PRIVATE_IP_BLOCK", "true") ) # Whether to use secure cookies by default. COOKIES_SECURE = parse_boolean( - os.environ.get("HOLMES_COOKIES_SECURE", str(ENFORCE_HTTPS)) + os.environ.get("DEEPBI_COOKIES_SECURE", str(ENFORCE_HTTPS)) ) # Whether the session cookie is set to secure. SESSION_COOKIE_SECURE = parse_boolean( - os.environ.get("HOLMES_SESSION_COOKIE_SECURE") or str(COOKIES_SECURE) + os.environ.get("DEEPBI_SESSION_COOKIE_SECURE") or str(COOKIES_SECURE) ) # Whether the session cookie is set HttpOnly. SESSION_COOKIE_HTTPONLY = parse_boolean( - os.environ.get("HOLMES_SESSION_COOKIE_HTTPONLY", "true") + os.environ.get("DEEPBI_SESSION_COOKIE_HTTPONLY", "true") ) -SESSION_EXPIRY_TIME = int(os.environ.get("HOLMES_SESSION_EXPIRY_TIME", 60 * 60 * 6)) +SESSION_EXPIRY_TIME = int(os.environ.get("DEEPBI_SESSION_EXPIRY_TIME", 60 * 60 * 6)) # Whether the session cookie is set to secure. REMEMBER_COOKIE_SECURE = parse_boolean( - os.environ.get("HOLMES_REMEMBER_COOKIE_SECURE") or str(COOKIES_SECURE) + os.environ.get("DEEPBI_REMEMBER_COOKIE_SECURE") or str(COOKIES_SECURE) ) # Whether the remember cookie is set HttpOnly. REMEMBER_COOKIE_HTTPONLY = parse_boolean( - os.environ.get("HOLMES_REMEMBER_COOKIE_HTTPONLY", "true") + os.environ.get("DEEPBI_REMEMBER_COOKIE_HTTPONLY", "true") ) # The amount of time before the remember cookie expires. REMEMBER_COOKIE_DURATION = int( - os.environ.get("HOLMES_REMEMBER_COOKIE_DURATION", 60 * 60 * 24 * 31) + os.environ.get("DEEPBI_REMEMBER_COOKIE_DURATION", 60 * 60 * 24 * 31) ) # Doesn't set X-Frame-Options by default since it's highly dependent # on the specific deployment. # See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options # for more information. -FRAME_OPTIONS = os.environ.get("HOLMES_FRAME_OPTIONS", "deny") -FRAME_OPTIONS_ALLOW_FROM = os.environ.get("HOLMES_FRAME_OPTIONS_ALLOW_FROM", "") +FRAME_OPTIONS = os.environ.get("DEEPBI_FRAME_OPTIONS", "deny") +FRAME_OPTIONS_ALLOW_FROM = os.environ.get("DEEPBI_FRAME_OPTIONS_ALLOW_FROM", "") # Whether and how to send Strict-Transport-Security response headers. # See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security # for more information. HSTS_ENABLED = parse_boolean( - os.environ.get("HOLMES_HSTS_ENABLED") or str(ENFORCE_HTTPS) + os.environ.get("DEEPBI_HSTS_ENABLED") or str(ENFORCE_HTTPS) ) -HSTS_PRELOAD = parse_boolean(os.environ.get("HOLMES_HSTS_PRELOAD", "false")) -HSTS_MAX_AGE = int(os.environ.get("HOLMES_HSTS_MAX_AGE", talisman.ONE_YEAR_IN_SECS)) +HSTS_PRELOAD = parse_boolean(os.environ.get("DEEPBI_HSTS_PRELOAD", "false")) +HSTS_MAX_AGE = int(os.environ.get("DEEPBI_HSTS_MAX_AGE", talisman.ONE_YEAR_IN_SECS)) HSTS_INCLUDE_SUBDOMAINS = parse_boolean( - os.environ.get("HOLMES_HSTS_INCLUDE_SUBDOMAINS", "false") + os.environ.get("DEEPBI_HSTS_INCLUDE_SUBDOMAINS", "false") ) # Whether and how to send Content-Security-Policy response headers. @@ -147,17 +147,17 @@ # individual CSP directives, see https://github.com/GoogleCloudPlatform/flask-talisman#example-7 # for more information. E.g.: CONTENT_SECURITY_POLICY = os.environ.get( - "HOLMES_CONTENT_SECURITY_POLICY", + "DEEPBI_CONTENT_SECURITY_POLICY", "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-eval'; font-src 'self' data:; img-src 'self' http: https: data: blob:; object-src 'none'; frame-ancestors 'none';", ) CONTENT_SECURITY_POLICY_REPORT_URI = os.environ.get( - "HOLMES_CONTENT_SECURITY_POLICY_REPORT_URI", "" + "DEEPBI_CONTENT_SECURITY_POLICY_REPORT_URI", "" ) CONTENT_SECURITY_POLICY_REPORT_ONLY = parse_boolean( - os.environ.get("HOLMES_CONTENT_SECURITY_POLICY_REPORT_ONLY", "false") + os.environ.get("DEEPBI_CONTENT_SECURITY_POLICY_REPORT_ONLY", "false") ) CONTENT_SECURITY_POLICY_NONCE_IN = array_from_string( - os.environ.get("HOLMES_CONTENT_SECURITY_POLICY_NONCE_IN", "") + os.environ.get("DEEPBI_CONTENT_SECURITY_POLICY_NONCE_IN", "") ) # Whether and how to send Referrer-Policy response headers. Defaults to @@ -165,18 +165,18 @@ # See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy # for more information. REFERRER_POLICY = os.environ.get( - "HOLMES_REFERRER_POLICY", "strict-origin-when-cross-origin" + "DEEPBI_REFERRER_POLICY", "strict-origin-when-cross-origin" ) # Whether and how to send Feature-Policy response headers. Defaults to # an empty value. # See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy # for more information. -FEATURE_POLICY = os.environ.get("HOLMES_REFERRER_POLICY", "") +FEATURE_POLICY = os.environ.get("DEEPBI_REFERRER_POLICY", "") -MULTI_ORG = parse_boolean(os.environ.get("HOLMES_MULTI_ORG", "false")) +MULTI_ORG = parse_boolean(os.environ.get("DEEPBI_MULTI_ORG", "false")) -GOOGLE_CLIENT_ID = os.environ.get("HOLMES_GOOGLE_CLIENT_ID", "") -GOOGLE_CLIENT_SECRET = os.environ.get("HOLMES_GOOGLE_CLIENT_SECRET", "") +GOOGLE_CLIENT_ID = os.environ.get("DEEPBI_GOOGLE_CLIENT_ID", "") +GOOGLE_CLIENT_SECRET = os.environ.get("DEEPBI_GOOGLE_CLIENT_SECRET", "") GOOGLE_OAUTH_ENABLED = bool(GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET) # If bi is behind a proxy it might sometimes receive a X-Forwarded-Proto of HTTP @@ -184,17 +184,17 @@ # the SAML redirect URL incorrect thus failing auth. This is especially common if # you're behind a SSL/TCP configured AWS ELB or similar. # This setting will force the URL scheme. -SAML_SCHEME_OVERRIDE = os.environ.get("HOLMES_SAML_SCHEME_OVERRIDE", "") +SAML_SCHEME_OVERRIDE = os.environ.get("DEEPBI_SAML_SCHEME_OVERRIDE", "") -SAML_ENCRYPTION_PEM_PATH = os.environ.get("HOLMES_SAML_ENCRYPTION_PEM_PATH", "") -SAML_ENCRYPTION_CERT_PATH = os.environ.get("HOLMES_SAML_ENCRYPTION_CERT_PATH", "") +SAML_ENCRYPTION_PEM_PATH = os.environ.get("DEEPBI_SAML_ENCRYPTION_PEM_PATH", "") +SAML_ENCRYPTION_CERT_PATH = os.environ.get("DEEPBI_SAML_ENCRYPTION_CERT_PATH", "") SAML_ENCRYPTION_ENABLED = SAML_ENCRYPTION_PEM_PATH != "" and SAML_ENCRYPTION_CERT_PATH != "" # Enables the use of an externally-provided and trusted remote user via an HTTP # header. The "user" must be an email address. # # By default the trusted header is X-Forwarded-Remote-User. You can change -# this by setting HOLMES_REMOTE_USER_HEADER. +# this by setting DEEPBI_REMOTE_USER_HEADER. # # Enabling this authentication method is *potentially dangerous*, and it is # your responsibility to ensure that only a trusted frontend (usually on the @@ -214,69 +214,69 @@ # then your authentication will be seamless. Otherwise a link will be presented # on the login page to trigger remote user auth. REMOTE_USER_LOGIN_ENABLED = parse_boolean( - os.environ.get("HOLMES_REMOTE_USER_LOGIN_ENABLED", "false") + os.environ.get("DEEPBI_REMOTE_USER_LOGIN_ENABLED", "false") ) REMOTE_USER_HEADER = os.environ.get( - "HOLMES_REMOTE_USER_HEADER", "X-Forwarded-Remote-User" + "DEEPBI_REMOTE_USER_HEADER", "X-Forwarded-Remote-User" ) # If the organization setting auth_password_login_enabled is not false, then users will still be # able to login through instead of the LDAP server -LDAP_LOGIN_ENABLED = parse_boolean(os.environ.get("HOLMES_LDAP_LOGIN_ENABLED", "false")) +LDAP_LOGIN_ENABLED = parse_boolean(os.environ.get("DEEPBI_LDAP_LOGIN_ENABLED", "false")) # Bind LDAP using SSL. Default is False -LDAP_SSL = parse_boolean(os.environ.get("HOLMES_LDAP_USE_SSL", "false")) +LDAP_SSL = parse_boolean(os.environ.get("DEEPBI_LDAP_USE_SSL", "false")) # Choose authentication method(SIMPLE, ANONYMOUS or NTLM). Default is SIMPLE -LDAP_AUTH_METHOD = os.environ.get("HOLMES_LDAP_AUTH_METHOD", "SIMPLE") +LDAP_AUTH_METHOD = os.environ.get("DEEPBI_LDAP_AUTH_METHOD", "SIMPLE") # The LDAP directory address (ex. ldap://10.0.10.1:389) -LDAP_HOST_URL = os.environ.get("HOLMES_LDAP_URL", None) +LDAP_HOST_URL = os.environ.get("DEEPBI_LDAP_URL", None) # The DN & password used to connect to LDAP to determine the identity of the user being authenticated. # For AD this should be "org\\user". -LDAP_BIND_DN = os.environ.get("HOLMES_LDAP_BIND_DN", None) -LDAP_BIND_DN_PASSWORD = os.environ.get("HOLMES_LDAP_BIND_DN_PASSWORD", "") +LDAP_BIND_DN = os.environ.get("DEEPBI_LDAP_BIND_DN", None) +LDAP_BIND_DN_PASSWORD = os.environ.get("DEEPBI_LDAP_BIND_DN_PASSWORD", "") # AD/LDAP email and display name keys -LDAP_DISPLAY_NAME_KEY = os.environ.get("HOLMES_LDAP_DISPLAY_NAME_KEY", "displayName") -LDAP_EMAIL_KEY = os.environ.get("HOLMES_LDAP_EMAIL_KEY", "mail") +LDAP_DISPLAY_NAME_KEY = os.environ.get("DEEPBI_LDAP_DISPLAY_NAME_KEY", "displayName") +LDAP_EMAIL_KEY = os.environ.get("DEEPBI_LDAP_EMAIL_KEY", "mail") # Prompt that should be shown above username/email field. LDAP_CUSTOM_USERNAME_PROMPT = os.environ.get( - "HOLMES_LDAP_CUSTOM_USERNAME_PROMPT", "LDAP/AD/SSO username:" + "DEEPBI_LDAP_CUSTOM_USERNAME_PROMPT", "LDAP/AD/SSO username:" ) # LDAP Search DN TEMPLATE (for AD this should be "(sAMAccountName=%(username)s)"") LDAP_SEARCH_TEMPLATE = os.environ.get( - "HOLMES_LDAP_SEARCH_TEMPLATE", "(cn=%(username)s)" + "DEEPBI_LDAP_SEARCH_TEMPLATE", "(cn=%(username)s)" ) # The schema to bind to (ex. cn=users,dc=ORG,dc=local) LDAP_SEARCH_DN = os.environ.get( - "HOLMES_LDAP_SEARCH_DN", os.environ.get("HOLMES_SEARCH_DN") + "DEEPBI_LDAP_SEARCH_DN", os.environ.get("DEEPBI_SEARCH_DN") ) STATIC_ASSETS_PATH = fix_assets_path( - os.environ.get("HOLMES_STATIC_ASSETS_PATH", "../client/dist/") + os.environ.get("DEEPBI_STATIC_ASSETS_PATH", "../client/dist/") ) FLASK_TEMPLATE_PATH = fix_assets_path( - os.environ.get("HOLMES_FLASK_TEMPLATE_PATH", STATIC_ASSETS_PATH) + os.environ.get("DEEPBI_FLASK_TEMPLATE_PATH", STATIC_ASSETS_PATH) ) # Time limit (in seconds) for scheduled queries. Set this to -1 to execute without a time limit. SCHEDULED_QUERY_TIME_LIMIT = int( - os.environ.get("HOLMES_SCHEDULED_QUERY_TIME_LIMIT", -1) + os.environ.get("DEEPBI_SCHEDULED_QUERY_TIME_LIMIT", -1) ) # Time limit (in seconds) for adhoc queries. Set this to -1 to execute without a time limit. -ADHOC_QUERY_TIME_LIMIT = int(os.environ.get("HOLMES_ADHOC_QUERY_TIME_LIMIT", -1)) +ADHOC_QUERY_TIME_LIMIT = int(os.environ.get("DEEPBI_ADHOC_QUERY_TIME_LIMIT", -1)) -JOB_EXPIRY_TIME = int(os.environ.get("HOLMES_JOB_EXPIRY_TIME", 3600 * 12)) +JOB_EXPIRY_TIME = int(os.environ.get("DEEPBI_JOB_EXPIRY_TIME", 3600 * 12)) JOB_DEFAULT_FAILURE_TTL = int( - os.environ.get("HOLMES_JOB_DEFAULT_FAILURE_TTL", 7 * 24 * 60 * 60) + os.environ.get("DEEPBI_JOB_DEFAULT_FAILURE_TTL", 7 * 24 * 60 * 60) ) -LOG_LEVEL = os.environ.get("HOLMES_LOG_LEVEL", "INFO") -LOG_STDOUT = parse_boolean(os.environ.get("HOLMES_LOG_STDOUT", "false")) -LOG_PREFIX = os.environ.get("HOLMES_LOG_PREFIX", "") +LOG_LEVEL = os.environ.get("DEEPBI_LOG_LEVEL", "INFO") +LOG_STDOUT = parse_boolean(os.environ.get("DEEPBI_LOG_STDOUT", "false")) +LOG_PREFIX = os.environ.get("DEEPBI_LOG_PREFIX", "") LOG_FORMAT = os.environ.get( - "HOLMES_LOG_FORMAT", + "DEEPBI_LOG_FORMAT", LOG_PREFIX + "[%(asctime)s][PID:%(process)d][%(levelname)s][%(name)s] %(message)s", ) RQ_WORKER_JOB_LOG_FORMAT = os.environ.get( - "HOLMES_RQ_WORKER_JOB_LOG_FORMAT", + "DEEPBI_RQ_WORKER_JOB_LOG_FORMAT", ( LOG_PREFIX + "[%(asctime)s][PID:%(process)d][%(levelname)s][%(name)s] " "job.func_name=%(job_func_name)s " @@ -285,16 +285,16 @@ ) # Mail settings: -MAIL_SERVER = os.environ.get("HOLMES_MAIL_SERVER", "localhost") -MAIL_PORT = int(os.environ.get("HOLMES_MAIL_PORT", 25)) -MAIL_USE_TLS = parse_boolean(os.environ.get("HOLMES_MAIL_USE_TLS", "false")) -MAIL_USE_SSL = parse_boolean(os.environ.get("HOLMES_MAIL_USE_SSL", "false")) -MAIL_USERNAME = os.environ.get("HOLMES_MAIL_USERNAME", None) -MAIL_PASSWORD = os.environ.get("HOLMES_MAIL_PASSWORD", None) -MAIL_DEFAULT_SENDER = os.environ.get("HOLMES_MAIL_DEFAULT_SENDER", None) -MAIL_MAX_EMAILS = os.environ.get("HOLMES_MAIL_MAX_EMAILS", None) +MAIL_SERVER = os.environ.get("DEEPBI_MAIL_SERVER", "localhost") +MAIL_PORT = int(os.environ.get("DEEPBI_MAIL_PORT", 25)) +MAIL_USE_TLS = parse_boolean(os.environ.get("DEEPBI_MAIL_USE_TLS", "false")) +MAIL_USE_SSL = parse_boolean(os.environ.get("DEEPBI_MAIL_USE_SSL", "false")) +MAIL_USERNAME = os.environ.get("DEEPBI_MAIL_USERNAME", None) +MAIL_PASSWORD = os.environ.get("DEEPBI_MAIL_PASSWORD", None) +MAIL_DEFAULT_SENDER = os.environ.get("DEEPBI_MAIL_DEFAULT_SENDER", None) +MAIL_MAX_EMAILS = os.environ.get("DEEPBI_MAIL_MAX_EMAILS", None) MAIL_ASCII_ATTACHMENTS = parse_boolean( - os.environ.get("HOLMES_MAIL_ASCII_ATTACHMENTS", "false") + os.environ.get("DEEPBI_MAIL_ASCII_ATTACHMENTS", "false") ) @@ -302,42 +302,42 @@ def email_server_is_configured(): return MAIL_DEFAULT_SENDER is not None -HOST = os.environ.get("HOLMES_HOST", "") +HOST = os.environ.get("DEEPBI_HOST", "") SEND_FAILURE_EMAIL_INTERVAL = int( - os.environ.get("HOLMES_SEND_FAILURE_EMAIL_INTERVAL", 60) + os.environ.get("DEEPBI_SEND_FAILURE_EMAIL_INTERVAL", 60) ) MAX_FAILURE_REPORTS_PER_QUERY = int( - os.environ.get("HOLMES_MAX_FAILURE_REPORTS_PER_QUERY", 100) + os.environ.get("DEEPBI_MAX_FAILURE_REPORTS_PER_QUERY", 100) ) ALERTS_DEFAULT_MAIL_SUBJECT_TEMPLATE = os.environ.get( - "HOLMES_ALERTS_DEFAULT_MAIL_SUBJECT_TEMPLATE", "({state}) {alert_name}" + "DEEPBI_ALERTS_DEFAULT_MAIL_SUBJECT_TEMPLATE", "({state}) {alert_name}" ) # How many requests are allowed per IP to the login page before # being throttled? # See https://flask-limiter.readthedocs.io/en/stable/#rate-limit-string-notation -RATELIMIT_ENABLED = parse_boolean(os.environ.get("HOLMES_RATELIMIT_ENABLED", "true")) -THROTTLE_LOGIN_PATTERN = os.environ.get("HOLMES_THROTTLE_LOGIN_PATTERN", "50/hour") -LIMITER_STORAGE = os.environ.get("HOLMES_LIMITER_STORAGE", REDIS_URL) -THROTTLE_PASS_RESET_PATTERN = os.environ.get("HOLMES_THROTTLE_PASS_RESET_PATTERN", "10/hour") +RATELIMIT_ENABLED = parse_boolean(os.environ.get("DEEPBI_RATELIMIT_ENABLED", "true")) +THROTTLE_LOGIN_PATTERN = os.environ.get("DEEPBI_THROTTLE_LOGIN_PATTERN", "50/hour") +LIMITER_STORAGE = os.environ.get("DEEPBI_LIMITER_STORAGE", REDIS_URL) +THROTTLE_PASS_RESET_PATTERN = os.environ.get("DEEPBI_THROTTLE_PASS_RESET_PATTERN", "10/hour") # CORS settings for the Query Result API (and possibly future external APIs). -# In most cases all you need to do is set HOLMES_CORS_ACCESS_CONTROL_ALLOW_ORIGIN +# In most cases all you need to do is set DEEPBI_CORS_ACCESS_CONTROL_ALLOW_ORIGIN # to the calling domain (or domains in a comma separated list). ACCESS_CONTROL_ALLOW_ORIGIN = set_from_string( - os.environ.get("HOLMES_CORS_ACCESS_CONTROL_ALLOW_ORIGIN", "") + os.environ.get("DEEPBI_CORS_ACCESS_CONTROL_ALLOW_ORIGIN", "") ) ACCESS_CONTROL_ALLOW_CREDENTIALS = parse_boolean( - os.environ.get("HOLMES_CORS_ACCESS_CONTROL_ALLOW_CREDENTIALS", "false") + os.environ.get("DEEPBI_CORS_ACCESS_CONTROL_ALLOW_CREDENTIALS", "false") ) ACCESS_CONTROL_REQUEST_METHOD = os.environ.get( - "HOLMES_CORS_ACCESS_CONTROL_REQUEST_METHOD", "GET, POST, PUT" + "DEEPBI_CORS_ACCESS_CONTROL_REQUEST_METHOD", "GET, POST, PUT" ) ACCESS_CONTROL_ALLOW_HEADERS = os.environ.get( - "HOLMES_CORS_ACCESS_CONTROL_ALLOW_HEADERS", "Content-Type" + "DEEPBI_CORS_ACCESS_CONTROL_ALLOW_HEADERS", "Content-Type" ) # Query Runners @@ -347,13 +347,13 @@ def email_server_is_configured(): ] enabled_query_runners = array_from_string( - os.environ.get("HOLMES_ENABLED_QUERY_RUNNERS", ",".join(default_query_runners)) + os.environ.get("DEEPBI_ENABLED_QUERY_RUNNERS", ",".join(default_query_runners)) ) additional_query_runners = array_from_string( - os.environ.get("HOLMES_ADDITIONAL_QUERY_RUNNERS", "") + os.environ.get("DEEPBI_ADDITIONAL_QUERY_RUNNERS", "") ) disabled_query_runners = array_from_string( - os.environ.get("HOLMES_DISABLED_QUERY_RUNNERS", "") + os.environ.get("DEEPBI_DISABLED_QUERY_RUNNERS", "") ) QUERY_RUNNERS = remove( @@ -362,7 +362,7 @@ def email_server_is_configured(): ) dynamic_settings = importlib.import_module( - os.environ.get("HOLMES_DYNAMIC_SETTINGS_MODULE", "bi.settings.dynamic_settings") + os.environ.get("DEEPBI_DYNAMIC_SETTINGS_MODULE", "bi.settings.dynamic_settings") ) # Destinations @@ -379,32 +379,32 @@ def email_server_is_configured(): ] enabled_destinations = array_from_string( - os.environ.get("HOLMES_ENABLED_DESTINATIONS", ",".join(default_destinations)) + os.environ.get("DEEPBI_ENABLED_DESTINATIONS", ",".join(default_destinations)) ) additional_destinations = array_from_string( - os.environ.get("HOLMES_ADDITIONAL_DESTINATIONS", "") + os.environ.get("DEEPBI_ADDITIONAL_DESTINATIONS", "") ) DESTINATIONS = distinct(enabled_destinations + additional_destinations) EVENT_REPORTING_WEBHOOKS = array_from_string( - os.environ.get("HOLMES_EVENT_REPORTING_WEBHOOKS", "") + os.environ.get("DEEPBI_EVENT_REPORTING_WEBHOOKS", "") ) # Support for Sentry (https://getsentry.com/). Just set your Sentry DSN to enable it: -SENTRY_DSN = os.environ.get("HOLMES_SENTRY_DSN", "") -SENTRY_ENVIRONMENT = os.environ.get("HOLMES_SENTRY_ENVIRONMENT") +SENTRY_DSN = os.environ.get("DEEPBI_SENTRY_DSN", "") +SENTRY_ENVIRONMENT = os.environ.get("DEEPBI_SENTRY_ENVIRONMENT") # Client side toggles: ALLOW_SCRIPTS_IN_USER_INPUT = parse_boolean( - os.environ.get("HOLMES_ALLOW_SCRIPTS_IN_USER_INPUT", "false") + os.environ.get("DEEPBI_ALLOW_SCRIPTS_IN_USER_INPUT", "false") ) DASHBOARD_REFRESH_INTERVALS = list( map( int, array_from_string( os.environ.get( - "HOLMES_DASHBOARD_REFRESH_INTERVALS", "60,300,600,1800,3600,43200,86400" + "DEEPBI_DASHBOARD_REFRESH_INTERVALS", "60,300,600,1800,3600,43200,86400" ) ), ) @@ -414,58 +414,58 @@ def email_server_is_configured(): int, array_from_string( os.environ.get( - "HOLMES_QUERY_REFRESH_INTERVALS", + "DEEPBI_QUERY_REFRESH_INTERVALS", "60, 300, 600, 900, 1800, 3600, 7200, 10800, 14400, 18000, 21600, 25200, 28800, 32400, 36000, 39600, 43200, 86400, 604800, 1209600, 2592000", ) ), ) ) -PAGE_SIZE = int(os.environ.get("HOLMES_PAGE_SIZE", 20)) +PAGE_SIZE = int(os.environ.get("DEEPBI_PAGE_SIZE", 20)) PAGE_SIZE_OPTIONS = list( map( int, - array_from_string(os.environ.get("HOLMES_PAGE_SIZE_OPTIONS", "5,10,20,50,100")), + array_from_string(os.environ.get("DEEPBI_PAGE_SIZE_OPTIONS", "5,10,20,50,100")), ) ) -TABLE_CELL_MAX_JSON_SIZE = int(os.environ.get("HOLMES_TABLE_CELL_MAX_JSON_SIZE", 50000)) +TABLE_CELL_MAX_JSON_SIZE = int(os.environ.get("DEEPBI_TABLE_CELL_MAX_JSON_SIZE", 50000)) # Features: -VERSION_CHECK = parse_boolean(os.environ.get("HOLMES_VERSION_CHECK", "true")) +VERSION_CHECK = parse_boolean(os.environ.get("DEEPBI_VERSION_CHECK", "true")) FEATURE_DISABLE_REFRESH_QUERIES = parse_boolean( - os.environ.get("HOLMES_FEATURE_DISABLE_REFRESH_QUERIES", "false") + os.environ.get("DEEPBI_FEATURE_DISABLE_REFRESH_QUERIES", "false") ) FEATURE_SHOW_QUERY_RESULTS_COUNT = parse_boolean( - os.environ.get("HOLMES_FEATURE_SHOW_QUERY_RESULTS_COUNT", "true") + os.environ.get("DEEPBI_FEATURE_SHOW_QUERY_RESULTS_COUNT", "true") ) FEATURE_ALLOW_CUSTOM_JS_VISUALIZATIONS = parse_boolean( - os.environ.get("HOLMES_FEATURE_ALLOW_CUSTOM_JS_VISUALIZATIONS", "false") + os.environ.get("DEEPBI_FEATURE_ALLOW_CUSTOM_JS_VISUALIZATIONS", "false") ) FEATURE_AUTO_PUBLISH_NAMED_QUERIES = parse_boolean( - os.environ.get("HOLMES_FEATURE_AUTO_PUBLISH_NAMED_QUERIES", "true") + os.environ.get("DEEPBI_FEATURE_AUTO_PUBLISH_NAMED_QUERIES", "true") ) FEATURE_EXTENDED_ALERT_OPTIONS = parse_boolean( - os.environ.get("HOLMES_FEATURE_EXTENDED_ALERT_OPTIONS", "false") + os.environ.get("DEEPBI_FEATURE_EXTENDED_ALERT_OPTIONS", "false") ) # BigQuery -BIGQUERY_HTTP_TIMEOUT = int(os.environ.get("HOLMES_BIGQUERY_HTTP_TIMEOUT", "600")) +BIGQUERY_HTTP_TIMEOUT = int(os.environ.get("DEEPBI_BIGQUERY_HTTP_TIMEOUT", "600")) # Allow Parameters in Embeds # WARNING: Deprecated! ALLOW_PARAMETERS_IN_EMBEDS = parse_boolean( - os.environ.get("HOLMES_ALLOW_PARAMETERS_IN_EMBEDS", "false") + os.environ.get("DEEPBI_ALLOW_PARAMETERS_IN_EMBEDS", "false") ) # Enhance schema fetching SCHEMA_RUN_TABLE_SIZE_CALCULATIONS = parse_boolean( - os.environ.get("HOLMES_SCHEMA_RUN_TABLE_SIZE_CALCULATIONS", "false") + os.environ.get("DEEPBI_SCHEMA_RUN_TABLE_SIZE_CALCULATIONS", "false") ) # kylin -KYLIN_OFFSET = int(os.environ.get("HOLMES_KYLIN_OFFSET", 0)) -KYLIN_LIMIT = int(os.environ.get("HOLMES_KYLIN_LIMIT", 50000)) +KYLIN_OFFSET = int(os.environ.get("DEEPBI_KYLIN_OFFSET", 0)) +KYLIN_LIMIT = int(os.environ.get("DEEPBI_KYLIN_LIMIT", 50000)) KYLIN_ACCEPT_PARTIAL = parse_boolean( - os.environ.get("HOLMES_KYLIN_ACCEPT_PARTIAL", "false") + os.environ.get("DEEPBI_KYLIN_ACCEPT_PARTIAL", "false") ) # sqlparse @@ -476,20 +476,20 @@ def email_server_is_configured(): # requests REQUESTS_ALLOW_REDIRECTS = parse_boolean( - os.environ.get("HOLMES_REQUESTS_ALLOW_REDIRECTS", "false") + os.environ.get("DEEPBI_REQUESTS_ALLOW_REDIRECTS", "false") ) # Enforces CSRF token validation on API requests. # This is turned off by default to avoid breaking any existing deployments but it is highly recommended to turn this toggle on to prevent CSRF attacks. ENFORCE_CSRF = parse_boolean( - os.environ.get("HOLMES_ENFORCE_CSRF", "false") + os.environ.get("DEEPBI_ENFORCE_CSRF", "false") ) # Databricks -CSRF_TIME_LIMIT = int(os.environ.get("HOLMES_CSRF_TIME_LIMIT", 3600 * 6)) +CSRF_TIME_LIMIT = int(os.environ.get("DEEPBI_CSRF_TIME_LIMIT", 3600 * 6)) # Email blocked domains, use delimiter comma to separated multiple domains -BLOCKED_DOMAINS = set_from_string(os.environ.get("HOLMES_BLOCKED_DOMAINS", "qq.com")) +BLOCKED_DOMAINS = set_from_string(os.environ.get("DEEPBI_BLOCKED_DOMAINS", "qq.com")) AI_WEB_SERVER = os.environ.get('AI_WEB_SERVER', '127.0.0.1:8340') diff --git a/bi/settings/organization.py b/bi/settings/organization.py index 10c4fe45..d40952ca 100644 --- a/bi/settings/organization.py +++ b/bi/settings/organization.py @@ -1,7 +1,7 @@ import os from .helpers import parse_boolean -if os.environ.get("HOLMES_SAML_LOCAL_METADATA_PATH") is not None: +if os.environ.get("DEEPBI_SAML_LOCAL_METADATA_PATH") is not None: print("DEPRECATION NOTICE:\n") print( "SAML_LOCAL_METADATA_PATH is no longer supported. Only URL metadata is supported now, please update" @@ -11,48 +11,48 @@ PASSWORD_LOGIN_ENABLED = parse_boolean( - os.environ.get("HOLMES_PASSWORD_LOGIN_ENABLED", "true") + os.environ.get("DEEPBI_PASSWORD_LOGIN_ENABLED", "true") ) -SAML_LOGIN_TYPE = os.environ.get("HOLMES_SAML_AUTH_TYPE", "") -SAML_METADATA_URL = os.environ.get("HOLMES_SAML_METADATA_URL", "") -SAML_ENTITY_ID = os.environ.get("HOLMES_SAML_ENTITY_ID", "") -SAML_NAMEID_FORMAT = os.environ.get("HOLMES_SAML_NAMEID_FORMAT", "") -SAML_SSO_URL = os.environ.get("HOLMES_SAML_SSO_URL", "") -SAML_X509_CERT = os.environ.get("HOLMES_SAML_X509_CERT", "") -SAML_SP_SETTINGS = os.environ.get("HOLMES_SAML_SP_SETTINGS", "") +SAML_LOGIN_TYPE = os.environ.get("DEEPBI_SAML_AUTH_TYPE", "") +SAML_METADATA_URL = os.environ.get("DEEPBI_SAML_METADATA_URL", "") +SAML_ENTITY_ID = os.environ.get("DEEPBI_SAML_ENTITY_ID", "") +SAML_NAMEID_FORMAT = os.environ.get("DEEPBI_SAML_NAMEID_FORMAT", "") +SAML_SSO_URL = os.environ.get("DEEPBI_SAML_SSO_URL", "") +SAML_X509_CERT = os.environ.get("DEEPBI_SAML_X509_CERT", "") +SAML_SP_SETTINGS = os.environ.get("DEEPBI_SAML_SP_SETTINGS", "") if SAML_LOGIN_TYPE == "static": SAML_LOGIN_ENABLED = SAML_SSO_URL != "" and SAML_METADATA_URL != "" else: SAML_LOGIN_ENABLED = SAML_METADATA_URL != "" -DATE_FORMAT = os.environ.get("HOLMES_DATE_FORMAT", "DD/MM/YY") -TIME_FORMAT = os.environ.get("HOLMES_TIME_FORMAT", "HH:mm") -INTEGER_FORMAT = os.environ.get("HOLMES_INTEGER_FORMAT", "0,0") -FLOAT_FORMAT = os.environ.get("HOLMES_FLOAT_FORMAT", "0,0.00") +DATE_FORMAT = os.environ.get("DEEPBI_DATE_FORMAT", "DD/MM/YY") +TIME_FORMAT = os.environ.get("DEEPBI_TIME_FORMAT", "HH:mm") +INTEGER_FORMAT = os.environ.get("DEEPBI_INTEGER_FORMAT", "0,0") +FLOAT_FORMAT = os.environ.get("DEEPBI_FLOAT_FORMAT", "0,0.00") MULTI_BYTE_SEARCH_ENABLED = parse_boolean( os.environ.get("MULTI_BYTE_SEARCH_ENABLED", "false") ) -JWT_LOGIN_ENABLED = parse_boolean(os.environ.get("HOLMES_JWT_LOGIN_ENABLED", "false")) -JWT_AUTH_ISSUER = os.environ.get("HOLMES_JWT_AUTH_ISSUER", "") -JWT_AUTH_PUBLIC_CERTS_URL = os.environ.get("HOLMES_JWT_AUTH_PUBLIC_CERTS_URL", "") -JWT_AUTH_AUDIENCE = os.environ.get("HOLMES_JWT_AUTH_AUDIENCE", "") +JWT_LOGIN_ENABLED = parse_boolean(os.environ.get("DEEPBI_JWT_LOGIN_ENABLED", "false")) +JWT_AUTH_ISSUER = os.environ.get("DEEPBI_JWT_AUTH_ISSUER", "") +JWT_AUTH_PUBLIC_CERTS_URL = os.environ.get("DEEPBI_JWT_AUTH_PUBLIC_CERTS_URL", "") +JWT_AUTH_AUDIENCE = os.environ.get("DEEPBI_JWT_AUTH_AUDIENCE", "") JWT_AUTH_ALGORITHMS = os.environ.get( - "HOLMES_JWT_AUTH_ALGORITHMS", "HS256,RS256,ES256" + "DEEPBI_JWT_AUTH_ALGORITHMS", "HS256,RS256,ES256" ).split(",") -JWT_AUTH_COOKIE_NAME = os.environ.get("HOLMES_JWT_AUTH_COOKIE_NAME", "") -JWT_AUTH_HEADER_NAME = os.environ.get("HOLMES_JWT_AUTH_HEADER_NAME", "") +JWT_AUTH_COOKIE_NAME = os.environ.get("DEEPBI_JWT_AUTH_COOKIE_NAME", "") +JWT_AUTH_HEADER_NAME = os.environ.get("DEEPBI_JWT_AUTH_HEADER_NAME", "") FEATURE_SHOW_PERMISSIONS_CONTROL = parse_boolean( - os.environ.get("HOLMES_FEATURE_SHOW_PERMISSIONS_CONTROL", "false") + os.environ.get("DEEPBI_FEATURE_SHOW_PERMISSIONS_CONTROL", "false") ) SEND_EMAIL_ON_FAILED_SCHEDULED_QUERIES = parse_boolean( - os.environ.get("HOLMES_SEND_EMAIL_ON_FAILED_SCHEDULED_QUERIES", "false") + os.environ.get("DEEPBI_SEND_EMAIL_ON_FAILED_SCHEDULED_QUERIES", "false") ) HIDE_PLOTLY_MODE_BAR = parse_boolean(os.environ.get("HIDE_PLOTLY_MODE_BAR", "false")) DISABLE_PUBLIC_URLS = parse_boolean( - os.environ.get("HOLMES_DISABLE_PUBLIC_URLS", "false") + os.environ.get("DEEPBI_DISABLE_PUBLIC_URLS", "false") ) settings = { diff --git a/bi/utils/__init__.py b/bi/utils/__init__.py index c2fdcaec..a2952e82 100644 --- a/bi/utils/__init__.py +++ b/bi/utils/__init__.py @@ -22,8 +22,8 @@ from .human_time import parse_human_time COMMENTS_REGEX = re.compile("/\*.*?\*/") -WRITER_ENCODING = os.environ.get("HOLMES_CSV_WRITER_ENCODING", "utf-8") -WRITER_ERRORS = os.environ.get("HOLMES_CSV_WRITER_ERRORS", "strict") +WRITER_ENCODING = os.environ.get("DEEPBI_CSV_WRITER_ENCODING", "utf-8") +WRITER_ERRORS = os.environ.get("DEEPBI_CSV_WRITER_ERRORS", "strict") def utcnow(): diff --git a/bin/docker-entrypoint b/bin/docker-entrypoint index 913f4030..aff2b446 100755 --- a/bin/docker-entrypoint +++ b/bin/docker-entrypoint @@ -32,7 +32,7 @@ worker() { workers_healthcheck() { WORKERS_COUNT=${WORKERS_COUNT} echo "Checking active workers count against $WORKERS_COUNT..." - ACTIVE_WORKERS_COUNT=`echo $(rq info --url $HOLMES_REDIS_URL -R | grep workers | grep -oP ^[0-9]+)` + ACTIVE_WORKERS_COUNT=`echo $(rq info --url $DEEPBI_REDIS_URL -R | grep workers | grep -oP ^[0-9]+)` if [ "$ACTIVE_WORKERS_COUNT" -lt "$WORKERS_COUNT" ]; then echo "$ACTIVE_WORKERS_COUNT workers are active, Exiting" exit 1 @@ -47,8 +47,8 @@ server() { # Recycle gunicorn workers every n-th request. See http://docs.gunicorn.org/en/stable/settings.html#max-requests for more details. MAX_REQUESTS=${MAX_REQUESTS:-1000} MAX_REQUESTS_JITTER=${MAX_REQUESTS_JITTER:-100} - TIMEOUT=${HOLMES_GUNICORN_TIMEOUT:-60} - exec /usr/local/bin/gunicorn -b 0.0.0.0:8338 --name holmes -w${HOLMES_WEB_WORKERS:-4} bi.wsgi:app --max-requests $MAX_REQUESTS --max-requests-jitter $MAX_REQUESTS_JITTER --timeout $TIMEOUT + TIMEOUT=${DEEPBI_GUNICORN_TIMEOUT:-60} + exec /usr/local/bin/gunicorn -b 0.0.0.0:8338 --name deepbi -w${DEEPBI_WEB_WORKERS:-4} bi.wsgi:app --max-requests $MAX_REQUESTS --max-requests-jitter $MAX_REQUESTS_JITTER --timeout $TIMEOUT } create_db() { @@ -56,19 +56,19 @@ create_db() { } help() { - echo "Holmes Docker." + echo "DeepBi Docker." echo "" echo "Usage:" echo "" - echo "server -- start holmes server (with gunicorn)" + echo "server -- start deepbi server (with gunicorn)" echo "worker -- start a single RQ worker" echo "scheduler -- start an rq-scheduler instance" echo "" echo "shell -- open shell" echo "debug -- start Flask development server with remote debugger via ptvsd" echo "create_db -- create database tables" - echo "manage -- CLI to manage holmes" + echo "manage -- CLI to manage deepbi" } tests() { diff --git a/docker-compose.yml b/docker-compose.yml index 43586b11..3c5f2c04 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,14 +9,14 @@ x-service: &holmes-service env_file: - .env x-environment: &holmes-environment - HOLMES_LOG_LEVEL: "INFO" - HOLMES_RATELIMIT_ENABLED: "false" - HOLMES_MAIL_DEFAULT_SENDER: "test@example.com" - HOLMES_MAIL_SERVER: "email" - HOLMES_ENFORCE_CSRF: "true" - HOLMES_GUNICORN_TIMEOUT: 60 - HOLMES_WEB_WORKERS: 4 - HOLMES_CELERY_WORKERS: 4 + DEEPBI_LOG_LEVEL: "INFO" + DEEPBI_RATELIMIT_ENABLED: "false" + DEEPBI_MAIL_DEFAULT_SENDER: "test@example.com" + DEEPBI_MAIL_SERVER: "email" + DEEPBI_ENFORCE_CSRF: "true" + DEEPBI_GUNICORN_TIMEOUT: 60 + DEEPBI_WEB_WORKERS: 4 + DEEPBI_CELERY_WORKERS: 4 services: server: <<: *holmes-service diff --git a/ubuntu_CN_install.sh b/ubuntu_CN_install.sh index bb1ef54e..2cfceeaf 100644 --- a/ubuntu_CN_install.sh +++ b/ubuntu_CN_install.sh @@ -86,24 +86,24 @@ else fi echo "启动 postgresql" sudo service postgresql start -echo "创建数据库 holmes" -if sudo -u postgres psql -lqt | cut -d \| -f 1 | grep -qw holmes; then - echo "数据库 'holmes' 已经存在." +echo "创建数据库 deepbi" +if sudo -u postgres psql -lqt | cut -d \| -f 1 | grep -qw deepbi; then + echo "数据库 'deepbi' 已经存在." else - sudo -u postgres psql -c "CREATE DATABASE holmes;" - echo "数据库 'holmes' 创建完毕." + sudo -u postgres psql -c "CREATE DATABASE deepbi;" + echo "数据库 'deepbi' 创建完毕." fi # shellcheck disable=SC2006 -if sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='holmes'" | grep -q 1; then - echo "用户 'holmes' 已经存在." +if sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='deepbi'" | grep -q 1; then + echo "用户 'deepbi' 已经存在." else - echo "创建用户 'holmes' " - sudo su postgres -c "`printf 'psql -c "create user holmes password %s;"' "'holmes_8338'"`" + echo "创建用户 'deepbi' " + sudo su postgres -c "`printf 'psql -c "create user deepbi password %s;"' "'deepbi_8338'"`" fi echo "修改数据库 database 所有者" -sudo -u postgres psql -c "ALTER DATABASE holmes OWNER TO holmes;" +sudo -u postgres psql -c "ALTER DATABASE deepbi OWNER TO deepbi;" echo "设置用户连接" -sudo sh -c "sed -i '/^#\s*TYPE/ahost holmes holmes 127.0.0.1/32 md5' /etc/postgresql/16/main/pg_hba.conf && service postgresql restart " +sudo sh -c "sed -i '/^#\s*TYPE/ahost deepbi deepbi 127.0.0.1/32 md5' /etc/postgresql/16/main/pg_hba.conf && service postgresql restart " line echo "安装系统扩展" @@ -181,10 +181,10 @@ socket_port=8339 env_content=$(cat .env.template) # replace postgresql # shellcheck disable=SC2001 -env_content=$(echo "$env_content" | sed "s/# HOLMES_DATABASE_URL=\"postgresql:\/\/user:pwd@ip\/database\"/HOLMES_DATABASE_URL=\"postgresql:\/\/holmes:holmes_8338@127.0.0.1\/holmes\"/g") +env_content=$(echo "$env_content" | sed "s/# DEEPBI_DATABASE_URL=\"postgresql:\/\/user:pwd@ip\/database\"/DEEPBI_DATABASE_URL=\"postgresql:\/\/deepbi:deepbi_8338@127.0.0.1\/deepbi\"/g") # replace redis # shellcheck disable=SC2001 -env_content=$(echo "$env_content" | sed "s/# HOLMES_REDIS_URL/HOLMES_REDIS_URL/g") +env_content=$(echo "$env_content" | sed "s/# DEEPBI_REDIS_URL/DEEPBI_REDIS_URL/g") # replace language # shellcheck disable=SC2001 env_content=$(echo "$env_content" | sed "s/LANGTYPE/CN/g") diff --git a/ubuntu_install.sh b/ubuntu_install.sh index ee044e89..e768389c 100644 --- a/ubuntu_install.sh +++ b/ubuntu_install.sh @@ -86,23 +86,23 @@ else fi echo "start postgresql" sudo service postgresql start -echo "create database holmes" -if sudo -u postgres psql -lqt | cut -d \| -f 1 | grep -qw holmes; then - echo "Database 'holmes' already exists." +echo "create database deepbi" +if sudo -u postgres psql -lqt | cut -d \| -f 1 | grep -qw deepbi; then + echo "Database 'deepbi' already exists." else - sudo -u postgres psql -c "CREATE DATABASE holmes;" - echo "Database 'holmes' created." + sudo -u postgres psql -c "CREATE DATABASE deepbi;" + echo "Database 'deepbi' created." fi # shellcheck disable=SC2006 -if sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='holmes'" | grep -q 1; then - echo "User 'holmes' created." +if sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='deepbi'" | grep -q 1; then + echo "User 'deepbi' created." else - sudo su postgres -c "`printf 'psql -c "create user holmes password %s;"' "'holmes_8338'"`" + sudo su postgres -c "`printf 'psql -c "create user deepbi password %s;"' "'deepbi_8338'"`" fi echo "change database owner" -sudo -u postgres psql -c "ALTER DATABASE holmes OWNER TO holmes;" +sudo -u postgres psql -c "ALTER DATABASE deepbi OWNER TO deepbi;" echo "Setting user and database can connect" -sudo sh -c "sed -i '/^#\s*TYPE/ahost holmes holmes 127.0.0.1/32 md5' /etc/postgresql/16/main/pg_hba.conf && service postgresql restart " +sudo sh -c "sed -i '/^#\s*TYPE/ahost deepbi deepbi 127.0.0.1/32 md5' /etc/postgresql/16/main/pg_hba.conf && service postgresql restart " line echo "install sys extends" @@ -181,10 +181,10 @@ socket_port=8339 env_content=$(cat .env.template) # replace postgresql # shellcheck disable=SC2001 -env_content=$(echo "$env_content" | sed "s/# HOLMES_DATABASE_URL=\"postgresql:\/\/user:pwd@ip\/database\"/HOLMES_DATABASE_URL=\"postgresql:\/\/holmes:holmes_8338@127.0.0.1\/holmes\"/g") +env_content=$(echo "$env_content" | sed "s/# DEEPBI_DATABASE_URL=\"postgresql:\/\/user:pwd@ip\/database\"/DEEPBI_DATABASE_URL=\"postgresql:\/\/deepbi:deepbi_8338@127.0.0.1\/deepbi\"/g") # replace redis # shellcheck disable=SC2001 -env_content=$(echo "$env_content" | sed "s/# HOLMES_REDIS_URL/HOLMES_REDIS_URL/g") +env_content=$(echo "$env_content" | sed "s/# DEEPBI_REDIS_URL/DEEPBI_REDIS_URL/g") # replace language # shellcheck disable=SC2001 env_content=$(echo "$env_content" | sed "s/LANGTYPE/EN/g")