You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2020/09/02 21:56:42 UTC

[incubator-pinot] branch fixing_superset_docker created (now 40fe40b)

This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a change to branch fixing_superset_docker
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git.


      at 40fe40b  Fix superset docker image build script

This branch includes the following new commits:

     new 40fe40b  Fix superset docker image build script

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[incubator-pinot] 01/01: Fix superset docker image build script

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a commit to branch fixing_superset_docker
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 40fe40b7970770272869ef3400c1ae6ebf0abd12
Author: Xiang Fu <fx...@gmail.com>
AuthorDate: Wed Sep 2 14:56:18 2020 -0700

    Fix superset docker image build script
---
 docker/images/pinot-superset/.dockerignore       |   2 -
 docker/images/pinot-superset/Dockerfile          | 120 ++---------------------
 docker/images/pinot-superset/README.md           |  10 +-
 docker/images/pinot-superset/bin/superset-init   |  13 ---
 docker/images/pinot-superset/requirements-db.txt |  23 -----
 5 files changed, 11 insertions(+), 157 deletions(-)

diff --git a/docker/images/pinot-superset/.dockerignore b/docker/images/pinot-superset/.dockerignore
index ed27dea..68e9458 100644
--- a/docker/images/pinot-superset/.dockerignore
+++ b/docker/images/pinot-superset/.dockerignore
@@ -18,6 +18,4 @@
 #
 
 *
-!bin/
 !examples/
-!requirements-db.txt
diff --git a/docker/images/pinot-superset/Dockerfile b/docker/images/pinot-superset/Dockerfile
index bc9c2e6..82c8960 100644
--- a/docker/images/pinot-superset/Dockerfile
+++ b/docker/images/pinot-superset/Dockerfile
@@ -17,123 +17,15 @@
 # under the License.
 #
 
-######################################################################
-# PY stage that simply does a pip install on our requirements
-######################################################################
-ARG PY_VER=3.6.9
-FROM python:${PY_VER} AS superset-py
+ARG PRESET_SUPERSET_IMAGE_TAG=latest
+FROM preset/superset:${PRESET_SUPERSET_IMAGE_TAG}
 
-RUN mkdir /app \
-        && apt-get update -y \
-        && apt-get install -y --no-install-recommends \
-            build-essential \
-            default-libmysqlclient-dev \
-            libpq-dev \
-        && rm -rf /var/lib/apt/lists/*
+# Switching to root to install the required packages
+USER root
 
-# Superset version to build
-ARG SUPERSET_VERSION=master
-ARG SUPERSET_REPO=https://github.com/apache/incubator-superset
-ENV SUPERSET_SRC=/app/superset-src
+# Install pinotdb driver to connect to Pinot
+RUN pip install pinotdb
 
-# Download source
-WORKDIR ${SUPERSET_SRC}
-RUN wget -qO /tmp/superset.tar.gz ${SUPERSET_REPO}/archive/${SUPERSET_VERSION}.tar.gz \
-      && tar xzf /tmp/superset.tar.gz -C ${SUPERSET_SRC} --strip-components=1
-
-# First, we just wanna install requirements, which will allow us to utilize the cache
-# in order to only build if and only if requirements change
-COPY requirements-db.txt /app/
-RUN cp ${SUPERSET_SRC}/requirements.txt /app/ \
-      && cd /app \
-      && pip install --no-cache -r requirements.txt \
-      && pip install --no-cache -r requirements-db.txt
-
-######################################################################
-# Node stage to deal with static asset construction
-######################################################################
-FROM node:10-jessie AS superset-node
-
-ARG NPM_BUILD_CMD="build"
-ENV BUILD_CMD=${NPM_BUILD_CMD}
-ENV SUPERSET_SRC=/app/superset-src
-
-# NPM ci first, as to NOT invalidate previous steps except for when package.json changes
-RUN mkdir -p /app/superset-frontend
-RUN mkdir -p /app/superset/assets
-
-COPY --from=superset-py ${SUPERSET_SRC}/docker/frontend-mem-nag.sh /
-COPY --from=superset-py ${SUPERSET_SRC}/superset-frontend/package* /app/superset-frontend/
-RUN /frontend-mem-nag.sh \
-        && cd /app/superset-frontend \
-        && npm ci
-
-# Next, copy in the rest and let webpack do its thing
-COPY --from=superset-py ${SUPERSET_SRC}/superset-frontend /app/superset-frontend
-# This is BY FAR the most expensive step (thanks Terser!)
-RUN cd /app/superset-frontend \
-        && npm run ${BUILD_CMD} \
-        && rm -rf node_modules
-
-
-######################################################################
-# Final lean image...
-######################################################################
-ARG PY_VER=3.6.9
-FROM python:${PY_VER} AS lean
-
-ENV SUPERSET_SRC=/app/superset-src
-
-ENV LANG=C.UTF-8 \
-    LC_ALL=C.UTF-8 \
-    FLASK_ENV=production \
-    FLASK_APP="superset.app:create_app()" \
-    PYTHONPATH="/app/pythonpath" \
-    SUPERSET_HOME="/app/superset_home" \
-    SUPERSET_PORT=8080
-
-# Configure environment
-ENV GUNICORN_BIND=0.0.0.0:8088 \
-    GUNICORN_LIMIT_REQUEST_FIELD_SIZE=0 \
-    GUNICORN_LIMIT_REQUEST_LINE=0 \
-    GUNICORN_TIMEOUT=60 \
-    GUNICORN_WORKERS=3 \
-    GUNICORN_THREADS=4
-ENV GUNICORN_CMD_ARGS="--workers ${GUNICORN_WORKERS} --threads ${GUNICORN_THREADS} --timeout ${GUNICORN_TIMEOUT} --bind ${GUNICORN_BIND} --limit-request-line ${GUNICORN_LIMIT_REQUEST_LINE} --limit-request-field_size ${GUNICORN_LIMIT_REQUEST_FIELD_SIZE}"
-
-RUN useradd --user-group --no-create-home --no-log-init --shell /bin/bash superset \
-        && mkdir -p ${SUPERSET_HOME} ${PYTHONPATH} \
-        && apt-get update -y \
-        && apt-get install -y --no-install-recommends \
-            build-essential \
-            default-libmysqlclient-dev \
-            libpq-dev \
-        && rm -rf /var/lib/apt/lists/*
-
-COPY --from=superset-py /usr/local/lib/python3.6/site-packages/ /usr/local/lib/python3.6/site-packages/
-# Copying site-packages doesn't move the CLIs, so let's copy them one by one
-COPY --from=superset-py /usr/local/bin/gunicorn /usr/local/bin/celery /usr/local/bin/flask /usr/bin/
-COPY --from=superset-node /app/superset/static/assets /app/superset/static/assets
-COPY --from=superset-node /app/superset-frontend /app/superset-frontend
-
-## Lastly, let's install superset itself
-COPY --from=superset-py ${SUPERSET_SRC}/superset /app/superset
-COPY --from=superset-py ${SUPERSET_SRC}/setup.py ${SUPERSET_SRC}/MANIFEST.in ${SUPERSET_SRC}/README.md /app/
-RUN cd /app \
-        && chown -R superset:superset * \
-        && pip install -e .
-
-COPY --from=superset-py ${SUPERSET_SRC}/docker/docker-entrypoint.sh /usr/bin/
-
-COPY bin /usr/local/bin
 COPY examples /etc/examples/pinot
 
-WORKDIR /app
-
 USER superset
-
-HEALTHCHECK CMD ["curl", "-f", "http://localhost:8088/health"]
-
-EXPOSE ${SUPERSET_PORT}
-
-ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
diff --git a/docker/images/pinot-superset/README.md b/docker/images/pinot-superset/README.md
index 61cf62c..2aa5afb 100644
--- a/docker/images/pinot-superset/README.md
+++ b/docker/images/pinot-superset/README.md
@@ -21,23 +21,23 @@
 
 # Superset
 
-Docker image for [Superset](https://github.com/ApacheInfra/superset) with Pinot integration.
+Docker image for [Superset](https://github.com/apache/incubator-superset) with Pinot integration.
 
 
 ## How to build
 
-Below command will build docker image and tag it as `apachepinot/pinot-superset:0.36.0`.
+Pinot Superset image is built on top of [preset/superset](https://hub.docker.com/r/preset/superset) with Pinotdb driver.
 
-You can also build directly with `docker build` command by setting arguments:
+Below command will build Superset image based on `preset/superset:0.37` then tag it as `apachepinot/pinot-superset:0.37`.
 
 ```bash
-docker build --build-arg SUPERSET_VERSION=0.36.0 --tag apachepinot/pinot-superset:0.36.0 .
+docker build --build-arg PRESET_SUPERSET_IMAGE_TAG=0.37 --tag apachepinot/pinot-superset:0.37 .
 ```
 
 ## How to push
 
 ```bash
-docker push apachepinot/pinot-superset:0.36.0
+docker push apachepinot/pinot-superset:0.37
 ```
 
 ## Configuration
diff --git a/docker/images/pinot-superset/bin/superset-init b/docker/images/pinot-superset/bin/superset-init
deleted file mode 100644
index 48208d7..0000000
--- a/docker/images/pinot-superset/bin/superset-init
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-
-set -e
-
-# Create an admin user
-FLASK_APP=superset flask fab create-admin $@
-
-# Initialize the database
-superset db upgrade
-
-# Create default roles and permissions
-superset init
-
diff --git a/docker/images/pinot-superset/requirements-db.txt b/docker/images/pinot-superset/requirements-db.txt
deleted file mode 100644
index 1b3d026..0000000
--- a/docker/images/pinot-superset/requirements-db.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-gevent==1.4.0
-psycopg2-binary==2.7.5
-pyhive==0.6.1
-redis==3.2.1
-pinotdb==0.3.3


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org