向导

  • 官网
  • 1.环境准备
  • 1.1 安装docker和docker-compose
  • 1.2 安装nodejs和npm
  • 2.安装Redash


官网

  1. 主页
  2. Developer Guide
  3. github
  4. 讨论
  5. issues

1.环境准备

官网Docker Based Developer Installation Guide

[转帖]Redash -- Redash部署安装docker版_docker

1.1 安装docker和docker-compose

Docker – yum安装docker和docker-compose

1.2 安装nodejs和npm

nodejs/github

Node.js v14.x

# As root
curl -sL https://rpm.nodesource.com/setup_14.x | bash -
# No root privileges 
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -

Node.js v12.x

# As root
curl -sL https://rpm.nodesource.com/setup_12.x | bash -
# No root privileges 
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -

这里我选择14.x版本的,之后安装即可

yum install gcc-c++ make -y
yum -y install nodejs -y
# 通过:node -v  和npm -v 查看版本,说明安装成功

替换为淘宝NPM镜像

# 首先我们可以查看原本的镜像地址:
npm get registry
https://registry.npmjs.org/
#然后替换成淘宝的:
npm config set registry http://registry.npm.taobao.org/
#如果想恢复原来的镜像地址:
npm config set registry https://registry.npmjs.org/

2.安装Redash

  1. clone git repostory
git clone https://github.com/getredash/redash.git
cd redash/
  1. 编辑docker-compose.yml文件
      该配置文件是一个开发环境配置,也可以使用set/docker-compost.yml配置作为生产环境,我这里使用了开发环境的配置,另外这个配置需要注意几点:
  • postgres那里要加入environment: POSTGRES_PASSWORD: xxx的配置,不然postgres镜像起不来
  • server和worker配置postgre那里增加用户名密码配置,不然server和worker启动不起来
  • server和worker配置REDASH_COOKIE_SECRET: xxx,不然服务启动后,查询数据源时报InvalidToken,这是新版本的bug
# This configuration file is for the **development** setup.
# For a production example please refer to setup/docker-compose.yml.
version: '3.2'
services:
  server:
    build: .
    command: dev_server
    depends_on:
      - postgres
      - redis
    ports:
      - "5000:5000"
      - "5678:5678"
    volumes:
      - ".:/data/user/nb_wang/bin/redash/server"
    environment:
      PYTHONUNBUFFERED: 0
      REDASH_LOG_LEVEL: "INFO"
      REDASH_REDIS_URL: "redis://redis:6379/0"
      REDASH_DATABASE_URL: "postgresql://postgres:123123@postgres/postgres"
      REDASH_COOKIE_SECRET: 123123
      REDASH_RATELIMIT_ENABLED: "false"
  worker:
    build: .
    command: dev_worker
    volumes:
      - type: bind
        source: .
        target: /data/user/nb_wang/bin/redash/worker
    depends_on:
      - server
    environment:
      PYTHONUNBUFFERED: 0
      REDASH_LOG_LEVEL: "INFO"
      REDASH_REDIS_URL: "redis://redis:6379/0"
      REDASH_DATABASE_URL: "postgresql://postgres:123123@postgres/postgres"
      QUEUES: "queries,scheduled_queries,celery,schemas"
      REDASH_COOKIE_SECRET: 123123
      WORKERS_COUNT: 2
  redis:
    image: redis:3-alpine
    restart: unless-stopped
  postgres:
    image: postgres:9.5-alpine
    # The following turns the DB into less durable, but gains significant performance improvements for the tests run (x3
    # improvement on my personal machine). We should consider moving this into a dedicated Docker Compose configuration for
    # tests.
    privileged: true
    environment:
      POSTGRES_PASSWORD: 123123
    ports:
      - "15432:5432"
    command: "postgres -c fsync=off -c full_page_writes=off -c synchronous_commit=OFF"
    restart: unless-stopped
  1. 初始化postgres数据库
docker-compose run --rm server create_db
  • 1
  1. 启动和关闭服务
#后台启动
docker-compose up -d
#关闭
docker-compose down
  1. 进入xxx:5000页面,会先进行一个设置,这个设置就是admin用户,最高权限。