From 2eea9e1fee09200ee02b873383cb557632267241 Mon Sep 17 00:00:00 2001 From: HongwuLin Date: Wed, 29 Jul 2020 20:15:49 +0800 Subject: [PATCH 1/4] Add model zoo to playground --- doc/run/k8s/install-sqlflow.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/doc/run/k8s/install-sqlflow.yaml b/doc/run/k8s/install-sqlflow.yaml index bf419e1ec6..8a06efce44 100644 --- a/doc/run/k8s/install-sqlflow.yaml +++ b/doc/run/k8s/install-sqlflow.yaml @@ -64,3 +64,33 @@ spec: - /work/mysql-inited initialDelaySeconds: 5 periodSeconds: 5 + - name: model-zoo + image: sqlflow/sqlflow:model_zoo + imagePullPolicy: IfNotPresent + ports: + - containerPort: 50055 + protocol: TCP + env: + - name: MYSQL_ADDR + value: 127.0.0.1:3306 + volumeMounts: + # bind to host's docker.sock to build image + - mountPath: /var/run/docker.sock + name: docker-socket-volume + securityContext: + privileged: true + command: [ "/bin/bash", "-c" ] + args: + - | + while ! nc -z -w 1 ${MYSQL_ADDR/:/ }; do + sleep 3 + echo "Waiting for mysql..." + done + echo "Starting SQLFlow Model Zoo server ..." + modelzooserver --mysql-addr="mysql://root:root@tcp(${MYSQL_ADDR})/" + volumes: + - name: docker-socket-volume + hostPath: + path: /var/run/docker.sock + type: File + From 6e08126a15b770afa77302d13c4918152d5f3745 Mon Sep 17 00:00:00 2001 From: HongwuLin Date: Wed, 29 Jul 2020 20:31:35 +0800 Subject: [PATCH 2/4] update indent --- doc/run/k8s/install-sqlflow.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/run/k8s/install-sqlflow.yaml b/doc/run/k8s/install-sqlflow.yaml index 8a06efce44..8095afe085 100644 --- a/doc/run/k8s/install-sqlflow.yaml +++ b/doc/run/k8s/install-sqlflow.yaml @@ -81,13 +81,13 @@ spec: privileged: true command: [ "/bin/bash", "-c" ] args: - - | - while ! nc -z -w 1 ${MYSQL_ADDR/:/ }; do - sleep 3 - echo "Waiting for mysql..." - done - echo "Starting SQLFlow Model Zoo server ..." - modelzooserver --mysql-addr="mysql://root:root@tcp(${MYSQL_ADDR})/" + - | + while ! nc -z -w 1 ${MYSQL_ADDR/:/ }; do + sleep 3 + echo "Waiting for mysql..." + done + echo "Starting SQLFlow Model Zoo server ..." + modelzooserver --mysql-addr="mysql://root:root@tcp(${MYSQL_ADDR})/" volumes: - name: docker-socket-volume hostPath: From c8fe6840daa3a6e639669054e8419d4db545ba29 Mon Sep 17 00:00:00 2001 From: HongwuLin Date: Thu, 30 Jul 2020 17:01:14 +0800 Subject: [PATCH 3/4] Minimize model zoo image --- docker/modelzooserver/Dockerfile | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/docker/modelzooserver/Dockerfile b/docker/modelzooserver/Dockerfile index d21425e7bf..9834c5826d 100644 --- a/docker/modelzooserver/Dockerfile +++ b/docker/modelzooserver/Dockerfile @@ -1,17 +1,23 @@ # NOTE: The docker build context directory must be the root of the source tree. # NOTE: To build the release image, SQLFlow must be built into ./build -FROM ubuntu:18.04 +FROM alpine:3.12 ARG FIND_FASTED_MIRROR=true -# Choose faster mirrors for apt-get and pip -# Install docker.io to release model defininiation +# Choose faster mirrors for alpine and pip COPY docker/dev/find_fastest_resources.sh /usr/local/bin/ -RUN bash -c 'if [ "$FIND_FASTED_MIRROR" == "true" ]; then source find_fastest_resources.sh && \ - echo "Choose the fastest APT source ..." && \ - choose_fastest_apt_source; fi' && \ - apt-get -qq update && \ - apt-get -qq install -y axel sudo docker.io +RUN /bin/sh -c 'if [ "$FIND_FASTED_MIRROR" == "true" ]; then source find_fastest_resources.sh && \ + echo "Choose the fastest Alpine source ..." && \ + choose_fastest_alpine_source && \ + echo "Choose the fastest PIP source ..." && \ + choose_fastest_pip_source && \ + apk add --no-cache python3 py3-pip sudo bash docker-cli && \ + wget -q -O /etc/apk/keys/sgerrand.rsa.pub http://cdn.sqlflow.tech/alpine/sgerrand.rsa.pub.txt && \ + wget -q http://cdn.sqlflow.tech/alpine/glibc-2.31-r0.apk && \ + apk add glibc-2.31-r0.apk && \ + rm glibc-2.31-r0.apk && \ + ln -s /usr/bin/python3 /usr/local/bin/python && \ + ln -s /usr/bin/pip3 /usr/local/bin/pi; fi' # Install pre-built SQLFlow components. COPY build/modelzooserver /usr/local/bin/modelzooserver From dc8c4c759fa5ad1f41a8880dc2a9fd9c10cbfd17 Mon Sep 17 00:00:00 2001 From: HongwuLin Date: Thu, 30 Jul 2020 17:05:42 +0800 Subject: [PATCH 4/4] add comment --- docker/modelzooserver/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/modelzooserver/Dockerfile b/docker/modelzooserver/Dockerfile index 9834c5826d..b589e74dd1 100644 --- a/docker/modelzooserver/Dockerfile +++ b/docker/modelzooserver/Dockerfile @@ -5,6 +5,7 @@ FROM alpine:3.12 ARG FIND_FASTED_MIRROR=true # Choose faster mirrors for alpine and pip +# Install docker.io to release model defininiation COPY docker/dev/find_fastest_resources.sh /usr/local/bin/ RUN /bin/sh -c 'if [ "$FIND_FASTED_MIRROR" == "true" ]; then source find_fastest_resources.sh && \ echo "Choose the fastest Alpine source ..." && \