一、安装
从https://github.com/getredash/redash 拉取代码,运行docker-compose.production.yml
1,docker-compose文件调整
主要修改了两处:
1,增加了redis和postgres的db文件与宿主机的映射,不让docker容器停止后数据丢失。
官方默认的docker-compose.production.yml在docker-compose down 命令后,所有的配置信息都丢失了
2,增加了redis和postgres的端口映射,方便调试,线上环境也可以关掉。
3,修改REDASH_COOKIE_SECRET。
修改后的docker-compose.production.yml文件如下:
# This is an example configuration for Docker Compose. Make sure to atleast update
# the cookie secret & postgres database password.
#
# Some other recommendations:
# 1. To persist Postgres data, assign it a volume host location.
# 2. Split the worker service to adhoc workers and scheduled queries workers.
version: '2'
services:
server:
image: redash/redash:latest
command: server
depends_on:
- postgres
- redis
ports:
- "5000:5000"
environment:
PYTHONUNBUFFERED: 0
REDASH_LOG_LEVEL: "INFO"
REDASH_REDIS_URL: "redis://redis:6379/0"
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
REDASH_COOKIE_SECRET: "Q422k6vaXUk8"
REDASH_WEB_WORKERS: 4
restart: always
worker:
image: redash/redash:latest
command: scheduler
environment:
PYTHONUNBUFFERED: 0
REDASH_LOG_LEVEL: "INFO"
REDASH_REDIS_URL: "redis://redis:6379/0"
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
QUEUES: "queries,scheduled_queries,celery"
WORKERS_COUNT: 2
restart: always
redis:
image: redis:3.0-alpine
ports:
- "6379:6379"
volumes:
- ./data/redis_data:/data
restart: always
postgres:
image: postgres:9.5.6-alpine
ports:
- "5432:5432"
volumes:
- ./data/postgresql_data:/var/lib/postgresql/data
restart: always
nginx:
image: redash/nginx:latest
ports:
- "88:80"
depends_on:
- server
links:
- server:redash
restart: always