栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

安装superset官方容器

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

安装superset官方容器

前置条件

1.主机上安装好docker

2.主机上安装好dnscrypt-proxy(用于解决dns污染),参考Installation linux · DNSCrypt/dnscrypt-proxy Wiki · GitHub

3.主机上装好http代理服务用于容器访问github示例数据

安装容器

Docker Hubhttps://hub.docker.com/r/apache/superset安装并启动容器后,先不要运行初始化,需要作一些修改:

安装vim、修改dns:

# 以root身份进入容器安装好vim
docker exec -it -u root superset /bin/bash
apt update
apt install vim
# 还可以设置一下root密码
passwd

# 按dnscrypt-proxy文档修改dns,其中的ip换为主机的
vim /etc/resolv.conf

修改代理、代码:

# 进入容器
docker exec -it superset /bin/bash
# 设置代理,ip和端口指向主机代理服务,替换为自己的
export http_proxy=http://172.17.0.1:1081
export https_proxy=http://172.17.0.1:1081

# 具体修改内容见后面
vim /app/superset/examples/helpers.py

# 具体修改内容见后面
vim /app/superset/datasets/commands/importers/v1/utils.py

修改容器内/app/superset/examples/helpers.py

# 头部引入requests
import requests

# 注释以下3行
#content = request.urlopen(  # pylint: disable=consider-using-with
#    f"{base_URL}{filepath}?raw=true"
#).read()

# 紧随其后增加以下4行
res = requests.get(
    f"{base_URL}{filepath}?raw=true"
)
content = res.content

 修改容器内/app/superset/datasets/commands/importers/v1/utils.py

# 修改load_data方法
# 注释此行
#data = request.urlopen(data_uri)  # pylint: disable=consider-using-with
# 随后增加以下两行
res = requests.get(data_uri)
data = io.BytesIO(res.content)

将urllib修改为requests的目的是解决以下错误:
http.client.RemoteDisconnected: Remote end closed connection without response

 中文支持

找到config.py,修改BABEL_DEFAULT_LOCALE为zh,注释LANGUAGES = {},重启容器:

docker restart superset

# ---------------------------------------------------
# Babel config for translations
# ---------------------------------------------------
# Setup default language
BABEL_DEFAULT_LOCALE = "zh"
# Your application default translation path
BABEL_DEFAULT_FOLDER = "superset/translations"
# The allowed translation for you app
LANGUAGES = {
    "en": {"flag": "us", "name": "English"},
    "es": {"flag": "es", "name": "Spanish"},
    "it": {"flag": "it", "name": "Italian"},
    "fr": {"flag": "fr", "name": "French"},
    "zh": {"flag": "cn", "name": "Chinese"},
    "ja": {"flag": "jp", "name": "Japanese"},
    "de": {"flag": "de", "name": "German"},
    "pt": {"flag": "pt", "name": "Portuguese"},
    "pt_BR": {"flag": "br", "name": "Brazilian Portuguese"},
    "ru": {"flag": "ru", "name": "Russian"},
    "ko": {"flag": "kr", "name": "Korean"},
    "sk": {"flag": "sk", "name": "Slovak"},
    "sl": {"flag": "si", "name": "Slovenian"},
}
# Turning off i18n by default as translation in most languages are
# incomplete and not well maintained.
# LANGUAGES = {}

 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/741469.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号