Installing Redash Data Visualization Dashboard on CentOS/Fedora

Posted on 9 views

This article I will take you through the steps of Installing Redash Data Visualization Dashboard on CentOS 7 / Fedora. Redash is a data visualization tool that gives you quick and easy access to billions of records collected from various data sources.

Redash supported Data sources

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

Components of Redash

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.

Installing Redash Data Visualization Dashboard on CentOS / Fedora

In this section, we kick off the installation of Redash Data Visualization Dashboard on CentOS 7 / Fedora. This installation of Redash on CentOS 7 / Fedora has the following dependencies

  • Docker Engine
  • Docker compose

Redash developer provides a script to automate the installation.

Step 1: Install Docker and Docker Compose

Install Docker Engine on CentOS / Fedora using one of the following guides:

After the Docker engine is installed, ensure Docker Compose is installed as well.

sudo yum -y install wget curl
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 -
chmod +x docker-compose-linux-x86_64
sudo mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose

Allow the current logged in user to run Docker commands without sudo.

sudo usermod -aG docker $USER
newgrp docker

Confirm both Docker and Compose are installed:

$ docker-compose version
Docker Compose version v2.11.2

$ docker version
Client: Docker Engine - Community
 Version:           20.10.19
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        d85ef84
 Built:             Thu Oct 13 16:48:38 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Step 2: Prepare environment and install Redash

Install pwgenwget and perl-JSON-PP on CentOS 7.

sudo yum -y install epel-release
sudo yum -y install vim wget pwgen perl-JSON-PP

Install pwgenwget and perl-JSON-PP on Fedora.

sudo dnf -y install vim wget pwgen perl-JSON-PP

Create Project directory

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

Create PostgreSQL data directory

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

Modify and add the contents.

COOKIE_SECRET=$(pwgen -1s 32)
POSTGRES_PASSWORD=$(pwgen -1s 32)
REDASH_DATABASE_URL="postgresql://postgres:[email protected]/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

You can view the values set on the variables file using cat command:

# cat $REDASH_BASE_PATH/env
PYTHONUNBUFFERED=0
REDASH_LOG_LEVEL=INFO
REDASH_REDIS_URL=redis://redis:6379/0
POSTGRES_PASSWORD=X1Tqgc8RSj8lqFAhh46kbjLIQ92JvShu
REDASH_COOKIE_SECRET=sERgxHgyn6iwxqNh9ZiiS9e2YCipFXpk
REDASH_DATABASE_URL=postgresql://postgres:[email protected]/postgres

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 'BEGINFS=":"print $3' | awk 'BEGINFS="\""print $1'`

cd $REDASH_BASE_PATH
GIT_BRANCH="$REDASH_BRANCH:-master" # Default branch/version to master if not specified in REDASH_BRANCH env var
wget https://raw.githubusercontent.com/getredash/setup/$GIT_BRANCH/data/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

Start Redash docker containers:

docker-compose up -d

The setup may take a couple of minutes to finish. When done, you should have a number of containers running. View them using the docker pscommand:

# docker ps
CONTAINER ID   IMAGE                        COMMAND                  CREATED              STATUS          PORTS                                        NAMES
e88cdc267b72   redash/nginx:latest          "nginx -g 'daemon of…"   About a minute ago   Up 55 seconds   0.0.0.0:80->80/tcp, :::80->80/tcp, 443/tcp   redash-nginx-1
607ae397ac09   redash/redash:8.0.0.b32245   "/app/bin/docker-ent…"   About a minute ago   Up 56 seconds   5000/tcp                                     redash-adhoc_worker-1
c07ae79d897e   redash/redash:8.0.0.b32245   "/app/bin/docker-ent…"   About a minute ago   Up 56 seconds   5000/tcp                                     redash-scheduler-1
5c9bfbf03313   redash/redash:8.0.0.b32245   "/app/bin/docker-ent…"   About a minute ago   Up 56 seconds   5000/tcp                                     redash-scheduled_worker-1
0c3fc2fdfaf1   redash/redash:8.0.0.b32245   "/app/bin/docker-ent…"   About a minute ago   Up 56 seconds   0.0.0.0:5000->5000/tcp, :::5000->5000/tcp    redash-server-1
1c79b4317b64   postgres:9.6-alpine          "docker-entrypoint.s…"   About a minute ago   Up 58 seconds   5432/tcp                                     redash-postgres-1
f1defa651553   redis:5.0-alpine             "docker-entrypoint.s…"   About a minute ago   Up 58 seconds   6379/tcp                                     redash-redis-1
[[email protected] redash]#

Step 3: 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.

https://www.computingpost.com/install-docker-ce-on-fedora-36-35-34-33-32-31/

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.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.