Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Setup Redash v2.x for Oracle

Usage

Refs

https://redash.io/

Download Redash

$ curl -L -O https://github.com/getredash/redash/archive/v2.0.0.zip
$ unzip v2.0.0.zip && cd ./path-to-redash

Download Oracle instant client

http://www.oracle.com/technetwork/database/features/instant-client/index.html

$ mkdir oracle
$ mv /path-to/instantclient-*.zip oracle/

Build docker image

# Copy Dockerfile to /path-to-redash before building
$ docker build -t my/redash .

Deploy container

# Copy docker-compose.oracle.yml to /path-to-redash before deploying
$ docker-compose -f docker-compose-oracle.yml run --rm server create_db
$ docker-compose -f docker-compose-oracle.yml up -d
$ docker-compoe logs -f
version: '2'
services:
server:
image: my/redash:latest
command: server
depends_on:
- postgres
- redis
ports:
- "5000:5000"
- "1555:1555" # for Oracle
environment:
PYTHONUNBUFFERED: 0
REDASH_LOG_LEVEL: "INFO"
REDASH_REDIS_URL: "redis://redis:6379/0"
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
REDASH_COOKIE_SECRET: veryverysecret
REDASH_WEB_WORKERS: 4
# NLS_LANG: japanese_Japan.JA16SJIS # optional
worker:
image: my/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
# NLS_LANG: japanese_Japan.JA16SJIS # optional
redis:
image: redis:3.0-alpine
postgres:
image: postgres:9.5.6-alpine
#volumes:
#- /opt/postgres-data:/var/lib/postgresql/data
nginx:
image: redash/nginx:latest
ports:
- "80:80"
depends_on:
- server
links:
- server:redash
FROM redash/base:latest
RUN apt-get update -y
RUN apt-get install -y unzip
RUN apt-get install -y libaio-dev # depends on Oracle
RUN apt-get clean -y
# -- Start setup Oracle
# Add instantclient
ADD oracle/instantclient-basic-linux.x64-12.2.0.1.0.zip /tmp/instantclient-basic-linux.x64-12.2.0.1.0.zip
ADD oracle/instantclient-sdk-linux.x64-12.2.0.1.0.zip /tmp/instantclient-sdk-linux.x64-12.2.0.1.0.zip
ADD oracle/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip /tmp/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip
ADD oracle/instantclient-odbc-linux.x64-12.2.0.1.0.zip /tmp/instantclient-odbc-linux.x64-12.2.0.1.0.zip
ADD oracle/instantclient-jdbc-linux.x64-12.2.0.1.0.zip /tmp/instantclient-jdbc-linux.x64-12.2.0.1.0.zip
ADD oracle/tnsnames.ora /tmp/tnsnames.ora
RUN mkdir -p /opt/oracle/
RUN unzip /tmp/instantclient-basic-linux.x64-12.2.0.1.0.zip -d /opt/oracle/
RUN unzip /tmp/instantclient-sdk-linux.x64-12.2.0.1.0.zip -d /opt/oracle/
RUN unzip /tmp/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip -d /opt/oracle/
RUN unzip /tmp/instantclient-odbc-linux.x64-12.2.0.1.0.zip -d /opt/oracle/
RUN unzip /tmp/instantclient-jdbc-linux.x64-12.2.0.1.0.zip -d /opt/oracle/
RUN ln -s /opt/oracle/instantclient_12_2 /opt/oracle/instantclient
RUN ln -s /opt/oracle/instantclient/libclntsh.so.12.1 /opt/oracle/instantclient/libclntsh.so
RUN ln -s /opt/oracle/instantclient/sqlplus /usr/local/bin/sqlplus
ENV ORACLE_HOME=/opt/oracle/instantclient
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/oracle/instantclient
ENV TNS_ADMIN=$ORACLE_HOME/network/admin
RUN mkdir -p /opt/oracle/instantclient/network/admin
RUN cp /tmp/tnsnames.ora /opt/oracle/instantclient/network/admin/
# Add REDASH ENV to add Oracle Query Runner
ENV REDASH_ADDITIONAL_QUERY_RUNNERS=redash.query_runner.oracle
# -- End setup Oracle
# -- Start setup Redash (Add requirements_oracle_ds.txt)
COPY requirements.txt requirements_dev.txt requirements_all_ds.txt requirements_oracle_ds.txt ./
RUN pip install --upgrade pip
RUN pip install -r requirements.txt -r requirements_dev.txt -r requirements_all_ds.txt -r requirements_oracle_ds.txt
COPY . ./
RUN npm install self-update && npm install && npm run build && rm -rf node_modules
RUN chown -R redash /app
USER redash
ENTRYPOINT ["/app/bin/docker-entrypoint"]
# -- End setup Redash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.