LoginSignup
10
7

More than 5 years have passed since last update.

Redash on Docker

Last updated at Posted at 2017-04-01

概要

BIツールのRedashが人気ですね。
利用環境は色々有ります。
今回は、Provision Scriptを実行するDockerfileを作成してサクッと試してみる方法を紹介します。
本格的に利用したくなったら、ホスティングやAWSオープンソース版等を利用してみると良いでしょう。

Dockerfileを作成するのも面倒な人用に、Docker Cloudにイメージをアップしました。
バージョンは、4.0.1+b4038です。

$ docker run -d -p 8125:80 maedamikio/redash

利用環境は色々

ホスティング

30日間は、無料なので試してみるには十分でしょう。ただ、Liteプランでも3,000円/月ちょっとです。

  • 30日間は無料
  • Lite $29 / 月
  • Startup $99 / 月
  • Business $450 / 月

参考
https://redash.io/pricing/

オープンソース

AWS

AMIが提供されています。EC2の料金だけ必要ですね。
バージョンは、0.11.1です。

Google Compute Engine

下記の手順が記載されています。Compute Engineの料金だけ必要ですね。
バージョンは、0.9.1です。

$ gcloud compute images create "redash-091-b1377" --source-uri gs://redash-images/redash.0.9.1.b1377.tar.gz

Docker Based Developer Installation Guide

開発者向けの環境です。

以下がインストールされている必要があります。

  • Docker
  • Docker Compose
  • Node.js

そして、下記を実行する必要があります。

$ docker-compose up
$ npm install
$ docker-compose run --rm server create_db
$ docker-compose run --rm postgres psql -h postgres -U postgres -c "create database tests"

Developer Installation Guide

開発者向けの環境です。
色々なパッケージのインストールと設定が必要です。ちょっと面倒な感じです。

Provision Script

下記の環境で動作確認されてます。
バージョンは、2.0.1+b3080です。

  • Ubuntu 12.04
  • Ubuntu 14.04
  • Debian Wheezy

物理サーバやVirtualBox等で仮想サーバを準備して、スクリプトをダウンロード、実行するだけでOKです。

$ wget https://raw.githubusercontent.com/getredash/redash/master/setup/ubuntu/bootstrap.sh
$ chmod u+x bootstrap.sh
$ sudo ./bootstrap.sh

参考
https://redash.io/help-onpremise/setup/setting-up-redash-instance.html

Dockerでサクッと試してみる方法

今回は、Provision Scriptを実行するDockerfileを作成して、docker buildします。
あとは、docker runするだけです。

Dockerfileの作成

Provision Scriptは、物理サーバ等で動作確認されているので、docker buildでは、正常終了しません。そこで下記をDockerfileに加えています。

  • 必須パッケージ
  • postgresqlとProvision Scriptの同時実行
  • redisのゴミファイルの削除
  • 関連サービスの同時起動

Dockerfile

FROM ubuntu:16.04

RUN apt-get update && apt-get install -y \
    curl \
    postgresql \
    redis-server \
    sudo \
    wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN service postgresql start && service redis-server start && curl -sL https://raw.githubusercontent.com/getredash/redash/master/setup/ubuntu/bootstrap.sh | bash

EXPOSE 80

CMD service nginx start && \
    service postgresql start && \
    service redis-server start && \
    service supervisor start && \
    tail -f /dev/null

イメージの作成

結構時間がかかります。コンパイルが多数実行されている様です。

$ docker build -t redash .

コンテナの起動

あとは、下記でOKですね。

$ docker run -d -p 8125:80 redash

まとめ

なるべく手間をかけずにRedashを試してみる方法を紹介しました。
dockerの1コンテナ1プロセスの原則は守られていません。
本格的に利用する場合は、ホスティングやEC2等の利用を検討しましょう。

10
7
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
7