파이썬 가상환경에 올리는 것이 가장 단순하다. 빌드에 필요한 헤더를 먼저 깐다.
sudo dnf install -y gcc gcc-c++ make \
python3-devel python3-pip libffi-devel openssl-devel \
cyrus-sasl-devel openldap-devel
python3 -m venv /opt/superset-venv
source /opt/superset-venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install apache-superset==<version>
설정 파일을 만들고 위치를 환경변수로 알려 준다.
# /opt/superset/superset_config.py
SECRET_KEY = "${SUPERSET_SECRET_KEY}"
SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://<user>:${DB_PASSWORD}@<host>/superset"
export SUPERSET_CONFIG_PATH=/opt/superset/superset_config.py
export FLASK_APP=superset
superset db upgrade
superset fab create-admin
superset init
SECRET_KEY 를 지정하지 않으면 기본값으로 뜨고 경고가 나온다. 운영에서는 반드시 지정한다. 메타데이터 DB 도 SQLite 기본값 대신 PostgreSQL 이나 MySQL 을 쓴다.
기동은 개발용 서버가 아니라 gunicorn 으로 한다.
gunicorn -w 4 -k gevent --timeout 120 -b 0.0.0.0:8088 "superset.app:create_app()"
RHEL 7 계열처럼 시스템 OpenSSL 이 1.0.2 인 환경에서 흔히 만난다.
ImportError: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module
is compiled with 'OpenSSL 1.0.2k-fips'
파이썬의 ssl 모듈이 어떤 OpenSSL 로 빌드됐는지가 문제다. 파이썬 자체를 새 OpenSSL 로 다시 빌드하지 않는 한 근본 해결이 안 된다.
python3 -c 'import ssl; print(ssl.OPENSSL_VERSION)'
가장 손쉬운 우회는 urllib3 을 1.x 계열로 고정하는 것이다.
pip install 'urllib3<2'
운영 환경이라면 OS 를 올리거나, 새 OpenSSL 로 빌드한 파이썬을 별도 경로에 두고 그 파이썬으로 가상환경을 만드는 쪽이 낫다. 시스템 OpenSSL 자체를 덮어쓰는 것은 다른 패키지를 깨뜨린다.
ModuleNotFoundError: No module named 'marshmallow_enum'
의존성 해석이 어긋난 상태다. Superset 은 의존성 범위가 넓어서 이미 다른 패키지가 들어 있는 가상환경에 얹으면 버전이 충돌한다.
해당 버전이 검증한 조합을 그대로 쓰는 것이 확실하다.
pip install apache-superset==<version> \
-c https://raw.githubusercontent.com/apache/superset/<version>/requirements/base.txt
pip check
pip check 가 아무것도 출력하지 않아야 정상이다. 빠진 모듈을 하나씩 손으로 설치해 메우는 방식은 다음 오류를 부른다. 가상환경을 새로 만들고 제약 파일과 함께 설치하는 편이 빠르다.
We haven't found any Content Security Policy (CSP) defined in the configurations.
Using the in-memory storage for tracking rate limits as no storage was explicitly specified.
No PIL installation found
기동을 막지는 않지만 운영에서는 정리해 둔다. CSP 는 TALISMAN_ENABLED 와 TALISMAN_CONFIG, 요청 제한 저장소는 RATELIMIT_STORAGE_URI 로 Redis 를 지정한다. 썸네일·리포트를 쓰려면 Pillow 가 필요하다.