Apache Superset
Jump to navigation
Jump to search
Install[edit]
#!/bin/bash
sudo apt install libmysqlclient-dev build-essential libssl-dev libffi-dev python3.6-dev python-pip libsasl2-dev libldap2-dev
sudo adduser superset
sudo su -l superset
virtualenv -p /usr/bin/python3.6 superset
mkdir .superset
# Install superset
pip install superset gevent
# Create an admin user (you will be prompted to set a username, first and last name before setting a password)
fabmanager create-admin --app superset
# Initialize the database
superset db upgrade
# Load some data to play with
superset load_examples
# Create default roles and permissions
superset init
# To start a development web server on port 8088, use -p to bind to another port
superset runserver -d
Config[edit]
#---------------------------------------------------------
# Superset specific config
#---------------------------------------------------------
ROW_LIMIT = 5000
SUPERSET_WEBSERVER_PORT = 8088
#---------------------------------------------------------
#---------------------------------------------------------
# Flask App Builder configuration
#---------------------------------------------------------
# Your App secret key
SECRET_KEY = '\2\1skljsoieslkjfoiaerjteslaksfjieskjshf\1\2\e\y\y\h'
# The SQLAlchemy connection string to your database backend
# This connection defines the path to the database that stores your
# superset metadata (slices, connections, tables, dashboards, ...).
# Note that the connection information to connect to the datasources
# you want to explore are managed directly in the web UI
SQLALCHEMY_DATABASE_URI = 'sqlite:////home/superset/.superset/superset.db'
# Flask-WTF flag for CSRF
WTF_CSRF_ENABLED = True
# Add endpoints that need to be exempt from CSRF protection
WTF_CSRF_EXEMPT_LIST = []
# A CSRF token that expires in 1 year
WTF_CSRF_TIME_LIMIT = 60 * 60 * 24 * 365
# Set this API key to enable Mapbox visualizations
MAPBOX_API_KEY = ''
Add superset_config.py to python path example:
ln -s /home/superset/superset_config.py /home/superset/.virtualenvs/superset/lib/python3.6/site-packages/superset_config.py
Web Server setup (Gunicorn + nginx)[edit]
SystemD sevice file[edit]
[Unit]
Description=Superset WSGI Service
After=network.target
[Service]
User=superset
Group=superset
WorkingDirectory=/home/superset
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=superset
Restart=always
RestartSec=3
ExecStart=/home/superset/.virtualenvs/superset/bin/gunicorn -w 3 -k gevent --timeout 120 -b unix:/home/superset/.superset/superset.sock --limit-request-line 0 --limit-request-field_size 0 --statsd-host localhost:8125 superset:app
[Install]
WantedBy=multi-user.targetNginx site-available.conf[edit]
upstream superset {
server unix:/home/superset/.superset/superset.sock;
}
server {
if ($host = superset.rra.lan) {
return 301 https://$host$request_uri;
}
listen 80 ;
server_name superset.rra.lan;
return 404;
}
server {
server_name superset.rra.lan;
charset utf-8;
location / {
proxy_pass http://superset;
include /etc/nginx/uwsgi_params;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 120;
send_timeout 120;
}
ssl on;
ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DDS";
listen 443 ssl;
ssl_certificate /etc/ssl/certs/superset.rra.lan.crt;
ssl_certificate_key /etc/ssl/private/superset.rra.lan.key;
}