onaio.superset

Superset

This role is used to install, configure, and manage Apache Superset.

By default, it installs Superset version 0.28.1. If you want to install a different version, change the superset_version variable.

Role Variables

  • superset_python_executable: Specifies which Python version to use. Supported versions are python2.7 and python3.6.
  • superset_recreate_virtualenv: Set to True to recreate the Python virtual environment for Superset.

This role creates a superset user and database. To connect to the database, set the following:

  • superset_postgres_db_host: Database host
  • superset_postgres_login_user: Postgres user for creating the database and user
  • superset_postgres_login_password: Password for the postgres user
  • superset_postgres_db_name: Name of the superset database (to be created)
  • superset_postgres_db_user: Name of the Superset postgres user (to be created)
  • superset_postgres_db_pass: Password for the Superset postgres user
  • superset_pgpass_credentials: List of database credentials for connecting without a password in the format hostname:port:database:username:password.

Other Default Variables

# Restart Superset after changes; default is True. Disable for a cluster.
superset_perform_restart: True

Available Languages

Control which languages are available and how they are labeled.

supeset_languages:
  - key: en
    flag: us
    name: English
  - key: ja
    flag: jp
    name: Japanese

The default list includes a selection of available languages. You can check the /translations folder of the current Superset version for more options.

Authentication Backends

Set the authentication method for Superset users. The default is:

superset_auth_type: AUTH_DB

It uses Superset's database for user management. Configuration options are currently only available for AUTH_OAUTH type.

If using OAuth authentication, provide more details:

superset_oauth_providers:
  - name:
    icon:
    token_key:
    consumer_key:
    consumer_secret:
    base_url:
    request_token_params:
    request_token_url:
    access_token_url:
    authorize_url:
    access_token_method:
    access_token_params:
    access_token_headers:
    custom_redirect_url:

Note that certain oAuth providers, like onadata, require the request_token_url, access_token_url, and authorize_url to end with a /.

White Labelling

Customize Superset by changing the app name and branding images:

Make sure the sizes and dimensions match the original images found in the static/images directory.

Enable white labelling by setting:

superset_white_label: True

Change App Name

superset_app_name: 'My App'

Using Files for Branding

You can use specific file paths for branding images:

superset_white_label_use_filepaths: True
superset_favicon_path: "/path-to-/favicon.png"
superset_logo_path: "/path-to-/superset.png"
superset_2x_logo_path: "/path-to-/[email protected]"

Using Base64 Images for Branding

To avoid dealing with file paths, you can use base64 encoded images:

superset_white_label_use_base64: True
superset_favicon_base64: "base64 encoded favicon"
superset_logo_base64: "base64 encoded logo"
superset_2x_logo_base64: "base64 encoded 2x logo"

Asset Uploads

Superset allows certain file types for uploads by default:

superset_allowed_extensions:
  - csv

Check the ALLOWED_EXTENSIONS setting in Superset's config.py for the full list.

The upload directories for images and data files are:

superset_img_upload_dir: "{{ superset_home }}/images/"
superset_upload_dir: "{{ superset_home }}/uploads/"

Change JSON Limit

Adjust this to increase the limit for Superset dashboard JSON data. The default is set to 2^16, below is an increased limit of 2^24.

superset_dashboard_position_data_limit: 16777216

Superset-patchup (ketchup)

You can optionally include Superset-patchup with the following settings:

superset_use_ketchup: True
superset_ketchup_version: "v0.1.0"

Superset-patchup adds extra features to Superset. More details can be found in the Superset-patchup documentation.

Superset Caching

To enable caching, provide the CACHE_CONFIG according to Flask-Cache specifications, along with CACHE_DEFAULT_TIMEOUT for the cache warmup period.

superset_enable_cache: True
superset_cache_config: |
  {
    'CACHE_TYPE': 'redis',
    'CACHE_KEY_PREFIX': 'superset_results',
    'CACHE_REDIS_URL': 'redis://localhost:6379/0'
  }
superset_cache_default_timeout: 60 * 60 * 24, # 1 day

For regular cache warmup, configure Superset's celery task:

superset_enable_celerybeat: True
superset_celerybeat_schedule: |
  {
    'cache-warmup-hourly': {
      'task': 'cache-warmup',
      'schedule': crontab(minute=0, hour='*'),  # hourly
      'kwargs': {
          'strategy_name': 'top_n_dashboards',
          'top_n': 5,
          'since': '7 days ago',
      },
    },
  }

Testing

This project includes a Vagrantfile, which is a convenient way to test changes. Start it with vagrant up.

See Vagrant documentation for setup instructions.

License

Apache 2

Authors

Ona Engineering

Informazioni sul progetto

This role is used to install and configure Apache Superset

Installa
ansible-galaxy install onaio.superset
Licenza
bsd-2-clause
Download
139
Proprietario