Setup self-hosted Redash Ready with Ubuntu Server (Local Machine/AWS)
Tags: redash, dashboard, ubuntu, visualization
Published: 2022-08-28 06:56:00

Looking for building a dashboard with historical analytics graphs without spending time on searching for a paid BI tool and time-series database migration, then your spaceship landed in a correct space. 

![Redash features](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rvmh2eiev2qq4wbiu2dg.gif)

Let's discuss the few points that Redash can achieve for your project:

**1.** -     Browser-based: Everything in your browser, with a shareable URL.

**2.** -     Ease-of-use: Become immediately productive with data without the need to master complex software.

**3.** -     Query editor: Quickly compose SQL and NoSQL queries with a schema browser and auto-complete.

**4.** -     Visualization and dashboards: Create beautiful visualizations with drag and drop, and combine them into a single dashboard.

**5.** -     Sharing: Collaborate easily by sharing visualizations and their associated queries, enabling peer review of reports and queries.

**6.** -     Schedule refreshes: Automatically update your charts and dashboards at regular intervals you define.

**7.** -     Alerts: Define conditions and be alerted instantly when your data changes.

**8.** -     REST API: Everything that can be done in the UI is also available through REST API.

**9.** -     Broad support for data sources: Extensible data source API with native support for a long list of common databases and platforms.

Coming to the knowledge as far as I was into redash, let me guide you guys to set up a redash local environment in your machine, where you can explore the redash as much as you can.
__________________________________________________________________
**Pre-requisites :**

- Install Docker
- Install Docker Compose
- Install Git
- Install Node
          `14.16.1 or newer, can be installed with Homebrew on OS/X`
- Install Yarn
          `npm install --global yarn@1.22.10`
- Install Nginx
- Install PostgreSQL

**Setup #1**
# _Clone the Git repository_
First you will need to clone the Git repository:
`git clone https://github.com/getredash/redash.git`
`cd redash/`

# _Set up environment variables_
Create a .env file at the root and set any environment variables you need.
`touch .env`

```
REDASH_HOST=http://localhost/redash
PYTHONUNBUFFERED=0
REDASH_LOG_LEVEL=INFO
REDASH_REDIS_URL=redis://redis:6379/0
POSTGRES_PASSWORD=
REDASH_COOKIE_SECRET=redash-selfhosted
REDASH_SECRET_KEY=redash-selfhosted
REDASH_DATABASE_URL=postgresql://postgres@postgres/postgres
```
As we will use PostgreSQL and Redis images from the docker-hub we can leave the POSTGRES_PASSWORD as blank and REDASH_DATABASE_URL as it is.

**Step #2**
# _Create Docker Services_

Once you have the above setup, you need to create the Docker services:
`docker-compose up -d`
This will build the Docker images and fetch some prebuilt images and then start the services (Redash web server, worker, PostgreSQL and Redis).

> make sure you give your Docker VM enough memory (4GB or more).

**Step #3**
# _Install Node Package_
rum this command 
`yarn --frozen-lockfile`

**Step #4**
# _Create Database_
Create tables
`docker-compose run --rm server create_db`
Create database for tests
`docker-compose run --rm postgres psql -h postgres -U postgres -c "create database tests"`

**Health Check for Installation**

> After your installation is complete, you can do the healthcheck by calling **/ping** API endpoint.

**Step #5**
# _Run webpack Dev Server_
Once all Docker services are running (can be started either by docker-compose up or docker-compose start), Redash is available at http://localhost:5000/. 

While we will use webpack’s dev server, we still need to build the frontend assets at least once, as some of them used for static pages (login page and such):
`yarn build`
To work on the frontend code, you need to use the webpack dev server, which you start with:
`yarn start`
Now the dev server is available at http://localhost:8080.
![Start page of redash](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4v003sxdo9fvgzmsc7sb.png)
**Step #6**
# _Installing new Python packages_(requirements.txt)
If you pulled a new version with new packages or added some yourself, you will need to rebuild the server and worker images:
`docker-compose build worker`
`docker-compose build server`

After this setup process, you will be able to create queries, add visualization, create dashboards with multiple visualizations, etc in your local machine.
 
[LINK]=https://redash.io/help/open-source/dev-guide/docker