Skip to content

How to build and contribute

Zalenski Egor edited this page Jun 7, 2024 · 17 revisions

If you wish to build from source or contribute follow the steps below.

Prerequisites

Make sure you have installed the following packages:

Directory Structure

The cloned repository has the following directory structure:

  • redisinsight/ui - Contains the frontend code
  • redisinsight/api - Contains the backend code
  • docs - Contains the documentation
  • scripts - Build scripts and other build-related files
  • configs - Webpack configuration files and other build-related files
  • tests - Contains e2e tests

Installation

Before development or building, install the following required dependencies

yarn install && yarn --cwd redisinsight/api/

Build

Packaging the desktop app

Building statics for the enablement area and default plugins

Run yarn build:statics or yarn build:statics:win for Windows

After you have installed all dependencies you can package the app. Run yarn package:prod to package app for the local platform:

Production

yarn package:prod

The packaged installer will become available in the folder ./release.

Development

There are 2 ways to develop:

Developing using the Electron app

After you have installed all dependencies you can now run the app. Run yarn start to start an electron application that will watch and build for you.

Development

yarn start

Developing using web

Running the RedisInsight backend part

Run yarn --cwd redisinsight/api/ start:dev to start a local API at localhost:5540.

Development

yarn --cwd redisinsight/api/ start:dev

While the API is running, open your browser and navigate to http://localhost:5540/api/docs. You should see the Swagger UI.

Running frontend part of the app

Run yarn dev:ui to start a local server for UI.

Development

yarn dev:ui

Web interface will be available at http://localhost:8080.

Now servers will watch for changes and automatically build for you.

Running frontend tests

Run UI unit tests

yarn test

Running backend tests

Run backend unit tests

Plain tests

yarn --cwd redisinsight/api test

Tests with coverage

yarn --cwd redisinsight/api test:cov

Run backend integration tests (using local server)

Plain tests

yarn --cwd redisinsight/api test:api

Tests with coverage

yarn --cwd redisinsight/api test:api:cov

NOTE: Using yarn test:api* scripts you should have redis server up and running.
By default tests will look on localhost:6379 without any auth.
To customize tests configs, you should run test with proper environment variables.

Example:

If you have redis server running on a different host or port somehost:7777 with default user pass somepass

You should run test commands with such environment variables

Plain tests

TEST_REDIS_HOST=somehost \ 
TEST_REDIS_PORT=7777 \
TEST_REDIS_PASSWORD=somepass \
yarn --cwd redisinsight/api test:api

You can find all possible environment variable available in the constants.ts file

Run backend integration tests (using docker)

Here you should not care about tests and local redis database configuration

We will spin up server inside docker container and run tests over it

run this command

./redisinsight/api/test/test-runs/start-test-run.sh -r oss-st-6
  • -r - is the Redis Test Environment name

We are supporting several test environments to run tests on various Redis databases:

  • oss-st-5 - OSS Standalone v5
  • oss-st-5-pass - OSS Standalone v5 with admin pass required
  • oss-st-6 - OSS Standalone v6 and all modules
  • oss-st-6-tls - OSS Standalone v6 with TLS enabled
  • oss-st-6-tls-auth - OSS Standalone v6 with TLS auth required
  • oss-clu - OSS Cluster
  • oss-clu-tls - OSS Cluster with TLS enabled
  • oss-sent - OSS Sentinel
  • re-st - Redis Enterprise with Standalone inside
  • re-clu - Redis Enterprise with Cluster inside

Running E2E tests

Install E2E tests deps

yarn --cwd tests/e2e 

Run E2E tests

yarn --cwd tests/e2e test:chrome