22

Install Redash Data Visualization Dashboard on Ubuntu 20.04/18.04

 2 years ago
source link: https://computingforgeeks.com/install-redash-data-visualization-dashboard-on-ubuntu/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Install Redash Data Visualization Dashboard on Ubuntu 20.04/18.04

This blog post will cover the installation of Redash Data Visualization Dashboard on Ubuntu 20.04/18.04 LTS Linux operating systems. Redash is a data visualization tool built to allow for fast and easy access to billions of records collected from various data sources.

Today Redash has support for querying multiple databases, including: Redshift, Google BigQuery, PostgreSQL, MySQL, Graphite, Presto, Google Spreadsheets, Cloudera Impala, Hive and custom scripts. The dashboards supported are charts, pivot table, cohorts and many more.

For CentOS / Fedora, use: Installing Redash Data Visualization Dashboard on CentOS 7 / Fedora

Redash consists of two parts:

  1. Query Editor: This is your editor for SQL queries. You can browse schema and import with a click of a button.
  2. Visualizations and Dashboards: create different visualizations from your dataset, and then combine several visualizations into a single dashboard.

Features of Redash

  • It gives you a powerful query editor with collaboration capabilities
  • Rich API – You get an API for accessing Redash and extend its functionality.
  • User Management: Redash support SSO, access control and many other great features for enterprise-friendly workflow.
  • Alerts: Set up alerts and get notified on certain events on your data.
  • Support for many Data Sources: Redash supports SQL, NoSQL, Big Data and API data sources – query your data from different sources to answer complex questions. Redash supports more than 25 data sources.

Setup Environment

This installation of Redash has the following dependencies

  • Installed and running Ubuntu 20.04/18.04 LTS server
  • Docker Engine
  • Docker compose

The installation of Redash Data Visualization Dashboard on Ubuntu 20.04|18.04  can be done from a script which automates the process for you, or manual steps.

Step 1: Update Ubuntu system

As a rule of thumb, your system should be updated before installing any packages.

sudo apt update
sudo apt upgrade -y
sudo reboot

Once the system is rebooted, proceed to step 2

Step 2: Install Docker and Docker Compose

Run the following commands to install Docker on Ubuntu 20.04/18.04:

sudo apt update 
sudo apt -yy install apt-transport-https ca-certificates curl software-properties-common wget pwgen
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update && sudo apt -y install docker-ce docker-ce-cli containerd.io

Allow the current user to run Docker commands

sudo usermod -aG docker $USER
newgrp docker

Install Docker Compose:

curl -s https://api.github.com/repos/docker/compose/releases/latest \
  | grep browser_download_url \
  | grep docker-compose-Linux-x86_64 \
  | cut -d '"' -f 4 \
  | wget -qi -

Make the file executable

chmod +x docker-compose-Linux-x86_64

Move the file to your PATH.

sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose

Confirm version.

$ docker-compose version
docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

Confirm docker installation by checking the version:

$ docker --version
Docker version 20.10.7, build f0df350

Step 3: Prepare environment and install Redash

You can perform the installation automatically via a bash setup script or manually step-by-step. Let’s consider both applicable methods:

Automated installation with Script

You can download and run Redash installation script without following all the steps shown in the next manual installation section.

curl -O https://raw.githubusercontent.com/getredash/setup/master/setup.sh

Make the script executable and run it

chmod +x setup.sh
sudo ./setup.sh

The script will:

  1. Install both Docker and Docker Compose.
  2. Download  Docker Compose configuration files and bootstrap Redash environment
  3. Start all Redash docker containers

Confirm containers were created and in running status:

# docker ps
CONTAINER ID   IMAGE                        COMMAND                  CREATED              STATUS              PORTS                                        NAMES
a9a33dd34537   redash/nginx:latest          "nginx -g 'daemon of…"   34 seconds ago       Up 33 seconds       0.0.0.0:80->80/tcp, :::80->80/tcp, 443/tcp   redash_nginx_1
bea926c0792e   redash/redash:8.0.0.b32245   "/app/bin/docker-ent…"   38 seconds ago       Up 34 seconds       5000/tcp                                     redash_adhoc_worker_1
35597df680ce   redash/redash:8.0.0.b32245   "/app/bin/docker-ent…"   38 seconds ago       Up 34 seconds       5000/tcp                                     redash_scheduled_worker_1
aac80f752662   redash/redash:8.0.0.b32245   "/app/bin/docker-ent…"   38 seconds ago       Up 35 seconds       5000/tcp                                     redash_scheduler_1
09e45d09e995   redash/redash:8.0.0.b32245   "/app/bin/docker-ent…"   38 seconds ago       Up 34 seconds       0.0.0.0:5000->5000/tcp, :::5000->5000/tcp    redash_server_1
3211d9dca322   postgres:9.6-alpine          "docker-entrypoint.s…"   About a minute ago   Up About a minute   5432/tcp                                     redash_postgres_1
d15c5b33dba7   redis:5.0-alpine             "docker-entrypoint.s…"   About a minute ago   Up About a minute   6379/tcp                                     redash_redis_1

Doing Manual installation (Alternative method)

If you’re a person who likes to manually setup stuff, then this section is for you. The steps are obtained from the script.

Create Project directory

REDASH_BASE_PATH=/opt/redash
sudo mkdir -p $REDASH_BASE_PATH
sudo chown $USER:$USER $REDASH_BASE_PATH

Create PostgreSQL data directory

sudo mkdir $REDASH_BASE_PATH/postgres-data

Create the envfile to store variables

rm $REDASH_BASE_PATH/env 2>/dev/null
touch $REDASH_BASE_PATH/env

Export required variables

COOKIE_SECRET=$(pwgen -1s 32)
POSTGRES_PASSWORD=$(pwgen -1s 32)
REDASH_DATABASE_URL="postgresql://postgres:${POSTGRES_PASSWORD}@postgres/postgres"
echo "PYTHONUNBUFFERED=0" >> $REDASH_BASE_PATH/env
echo "REDASH_LOG_LEVEL=INFO" >> $REDASH_BASE_PATH/env
echo "REDASH_REDIS_URL=redis://redis:6379/0" >> $REDASH_BASE_PATH/env
echo "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" >> $REDASH_BASE_PATH/env
echo "REDASH_COOKIE_SECRET=$COOKIE_SECRET" >> $REDASH_BASE_PATH/env
echo "REDASH_DATABASE_URL=$REDASH_DATABASE_URL" >> $REDASH_BASE_PATH/env

Setup Docker Compose

REQUESTED_CHANNEL=stable
LATEST_VERSION=`curl -s "https://version.redash.io/api/releases?channel=$REQUESTED_CHANNEL"  | json_pp  | grep "docker_image" | head -n 1 | awk 'BEGIN{FS=":"}{print $3}' | awk 'BEGIN{FS="\""}{print $1}'`

cd $REDASH_BASE_PATH
REDASH_BRANCH="${REDASH_BRANCH:-master}" # Default branch/version to master if not specified in REDASH_BRANCH env var
wget https://raw.githubusercontent.com/getredash/redash/${REDASH_BRANCH}/setup/docker-compose.yml
sed -ri "s/image: redash\/redash:([A-Za-z0-9.-]*)/image: redash\/redash:$LATEST_VERSION/" docker-compose.yml
echo "export COMPOSE_PROJECT_NAME=redash" >> ~/.profile
echo "export COMPOSE_FILE=/opt/redash/docker-compose.yml" >> ~/.profile
source ~/.profile
docker-compose run --rm server create_db
docker-compose up -d

The setup may take a couple of minutes to finish. When done, you should have a number of containers running

Step 4: Access Redash Dashboard

Once Redash is installed, the service will be available on your server IP or DNS name assigned. Point your browser to the server address to access it.

The first thing you’re asked to do is create your admin account, fill the information required then click the “Setup” button. It will finish the setup and greet you with the admin dashboard

 You can now start using Redash to create Dashboards, Queries, and Alerts. For more reading on administration, visit Redash Admin page.

If you need SSL, follow Redash SSL setup guide for Nginx.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK