You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@madlib.apache.org by jingyimei <gi...@git.apache.org> on 2017/09/02 01:19:59 UTC

[GitHub] madlib pull request #181: Add a script to start docker image

GitHub user jingyimei opened a pull request:

    https://github.com/apache/madlib/pull/181

    Add a script to start docker image

    This is a script that does the following:
    * Pull madlib/postgres_9.6:latest from docker;
    * Mount your local madlib directory to docker container;
    * Build madlib from source;
    * Install madlib and run install check;
    * Log into docker container from shell as postgres user, so that you
      can run psql and start using madlib from here

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jingyimei/madlib docker_start_script

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/madlib/pull/181.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #181
    
----
commit 9f41a1a8dc63b80eb8239bf7f80896f844547a59
Author: Jingyi Mei <jm...@pivotal.io>
Date:   2017-09-02T01:10:09Z

    Add a script to start docker image
    
    This is a script that does the following:
    * Pull madlib/postgres_9.6:latest from docker;
    * Mount your local madlib directory to docker container;
    * Build madlib from source;
    * Install madlib and run install check;
    * Log in to docker container from shell as postgres user, so that you
      can run psql and start using madlib from here

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] madlib pull request #181: Add a script to start docker image

Posted by njayaram2 <gi...@git.apache.org>.
Github user njayaram2 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/181#discussion_r139574130
  
    --- Diff: README.md ---
    @@ -18,7 +18,11 @@ Development with Docker
     =======================
     We provide a Docker image with necessary dependencies required to compile and test MADlib on PostgreSQL 9.6. You can view the dependency Docker file at ./tool/docker/base/Dockerfile_postgres_9_6. The image is hosted on Docker Hub at madlib/postgres_9.6:latest. Later we will provide a similar Docker image for Greenplum Database.
     
    -Some useful commands to use the docker file:
    +We have a script to quickly run this docker image at ./tool/docker_start.sh, which will mount your local madlib directory, build MADlib and run install check on this Docker image. At the end, it will `docker exec` as postgres user. Note that you have to run this script from one level up from your madlib directory, for example, ~/workspace which has madlib source directory there. 
    --- End diff --
    
    If applicable, please update the usage steps listed in this too.


---

[GitHub] madlib pull request #181: Add a script to start docker image

Posted by njayaram2 <gi...@git.apache.org>.
Github user njayaram2 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/181#discussion_r139573759
  
    --- Diff: tool/docker_start.sh ---
    @@ -0,0 +1,98 @@
    +#!/bin/bash
    +# 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.
    +
    +###############################################################################
    +#  This is a script that does the following:
    +#  * Pull madlib/postgres_9.6:latest from docker;
    +#  * Mount your local madlib directory to docker container;
    +#  * Build madlib from source; build dir is /madlib/docker_build which 
    +#    is mounted to your local madlib dir
    +#  * Install madlib and run install check;
    +#  * Log in to docker container from shell as postgres user, so that you
    +#    can run psql and start using madlib from here
    +#
    +# Note: you have to run this script from one level up from your madlib 
    +# directory, for example, ~/workspace which has madlib src directory there
    +###############################################################################
    +set -o pipefail
    +
    +workdir=$(pwd)
    +user_name=$(whoami)
    +reponame=madlib
    +
    +echo "======================================================================"
    +echo "Build user: ${user_name}"
    +echo "Work directory: ${workdir}"
    +echo "Git reponame: ${reponame}"
    +echo "======================================================================"
    +
    +if [[ ! -d "${workdir}/${reponame}" ]]; then
    +  echo "Error: you have to run this script from one level up from your madlib \
    +        directory, for example, ~/workspace which has madlib src directory \
    +        there"
    +  exit
    +fi
    +
    +rm -rf logs
    +mkdir logs
    +
    +echo "-----------creating docker container madlib--------------------"
    +docker kill madlib
    +docker rm madlib
    +
    +# Pull down the base docker images
    +echo "Creating docker container"
    +docker pull madlib/postgres_9.6:latest
    +
    +# Launch docker container with volume mounted from workdir
    +docker run -d --name madlib -v "${workdir}/${reponame}":/madlib \
    --- End diff --
    
    Let's also take the docker container name `madlib` as an optional parameter.


---

[GitHub] madlib pull request #181: Add a script to start docker image

Posted by njayaram2 <gi...@git.apache.org>.
Github user njayaram2 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/181#discussion_r139573426
  
    --- Diff: README.md ---
    @@ -18,7 +18,11 @@ Development with Docker
     =======================
     We provide a Docker image with necessary dependencies required to compile and test MADlib on PostgreSQL 9.6. You can view the dependency Docker file at ./tool/docker/base/Dockerfile_postgres_9_6. The image is hosted on Docker Hub at madlib/postgres_9.6:latest. Later we will provide a similar Docker image for Greenplum Database.
     
    -Some useful commands to use the docker file:
    +We have a script to quickly run this docker image at ./tool/docker_start.sh, which will mount your local madlib directory, build MADlib and run install check on this Docker image. At the end, it will `docker exec` as postgres user. Note that you have to run this script from one level up from your madlib directory, for example, ~/workspace which has madlib source directory there. 
    --- End diff --
    
    We might want to run this from `~/workspace/madlib` folder and not the `~/workspace` folder.


---

[GitHub] madlib issue #181: Add a script to start docker image

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:

    https://github.com/apache/madlib/pull/181
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/madlib-pr-build/232/



---

[GitHub] madlib issue #181: Add a script to start docker image

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:

    https://github.com/apache/madlib/pull/181
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/madlib-pr-build/214/



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] madlib pull request #181: Add a script to start docker image

Posted by njayaram2 <gi...@git.apache.org>.
Github user njayaram2 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/181#discussion_r140573035
  
    --- Diff: README.md ---
    @@ -18,14 +18,22 @@ Development with Docker
     =======================
     We provide a Docker image with necessary dependencies required to compile and test MADlib on PostgreSQL 9.6. You can view the dependency Docker file at ./tool/docker/base/Dockerfile_postgres_9_6. The image is hosted on Docker Hub at madlib/postgres_9.6:latest. Later we will provide a similar Docker image for Greenplum Database.
     
    -Some useful commands to use the docker file:
    +We provide a script to quickly run this docker image at ./tool/docker_start.sh, which will mount your local madlib directory, build MADlib and run install check on this Docker image. At the end, it will `docker exec` as postgres user. Note that you have to run this script from inside your madlib directory, and you can specify your docker CONTAINER_NAME (default is madlib) and IMAGE_TAG (default is latest). Here is an example:
    --- End diff --
    
    I think we should also emphasize that this script has to be run just once. Users can then log into the container using `docker exec -it CONTAINER_NAME bash` command for subsequent runs in the development cycle (if it's still alive, else this script has to be run again anyway).
    Add a comment saying use `LaTex` as the `IMAGE_TAG` and use `make design_pdf` command to build the design doc.


---

[GitHub] madlib issue #181: Add a script to start docker image

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:

    https://github.com/apache/madlib/pull/181
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/madlib-pr-build/241/



---

[GitHub] madlib pull request #181: Add a script to start docker image

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/madlib/pull/181


---

[GitHub] madlib issue #181: Add a script to start docker image

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:

    https://github.com/apache/madlib/pull/181
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/madlib-pr-build/249/



---

[GitHub] madlib pull request #181: Add a script to start docker image

Posted by njayaram2 <gi...@git.apache.org>.
Github user njayaram2 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/181#discussion_r139573551
  
    --- Diff: tool/docker_start.sh ---
    @@ -0,0 +1,98 @@
    +#!/bin/bash
    +# 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.
    +
    +###############################################################################
    +#  This is a script that does the following:
    +#  * Pull madlib/postgres_9.6:latest from docker;
    +#  * Mount your local madlib directory to docker container;
    +#  * Build madlib from source; build dir is /madlib/docker_build which 
    +#    is mounted to your local madlib dir
    +#  * Install madlib and run install check;
    +#  * Log in to docker container from shell as postgres user, so that you
    +#    can run psql and start using madlib from here
    +#
    +# Note: you have to run this script from one level up from your madlib 
    +# directory, for example, ~/workspace which has madlib src directory there
    +###############################################################################
    +set -o pipefail
    +
    +workdir=$(pwd)
    +user_name=$(whoami)
    +reponame=madlib
    +
    +echo "======================================================================"
    +echo "Build user: ${user_name}"
    +echo "Work directory: ${workdir}"
    +echo "Git reponame: ${reponame}"
    +echo "======================================================================"
    +
    +if [[ ! -d "${workdir}/${reponame}" ]]; then
    +  echo "Error: you have to run this script from one level up from your madlib \
    +        directory, for example, ~/workspace which has madlib src directory \
    +        there"
    --- End diff --
    
    Let's run it from `${workdir}/${reponame}` and not `${workdir}`, especially because we have `rm -rf logs` inside this script. We don't want to delete something named `logs` in the `${workdir}` folder.


---

[GitHub] madlib pull request #181: Add a script to start docker image

Posted by njayaram2 <gi...@git.apache.org>.
Github user njayaram2 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/181#discussion_r139573813
  
    --- Diff: tool/docker_start.sh ---
    @@ -0,0 +1,98 @@
    +#!/bin/bash
    +# 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.
    +
    +###############################################################################
    +#  This is a script that does the following:
    +#  * Pull madlib/postgres_9.6:latest from docker;
    +#  * Mount your local madlib directory to docker container;
    +#  * Build madlib from source; build dir is /madlib/docker_build which 
    +#    is mounted to your local madlib dir
    +#  * Install madlib and run install check;
    +#  * Log in to docker container from shell as postgres user, so that you
    +#    can run psql and start using madlib from here
    +#
    +# Note: you have to run this script from one level up from your madlib 
    +# directory, for example, ~/workspace which has madlib src directory there
    +###############################################################################
    +set -o pipefail
    +
    +workdir=$(pwd)
    +user_name=$(whoami)
    +reponame=madlib
    +
    +echo "======================================================================"
    +echo "Build user: ${user_name}"
    +echo "Work directory: ${workdir}"
    +echo "Git reponame: ${reponame}"
    +echo "======================================================================"
    +
    +if [[ ! -d "${workdir}/${reponame}" ]]; then
    +  echo "Error: you have to run this script from one level up from your madlib \
    +        directory, for example, ~/workspace which has madlib src directory \
    +        there"
    +  exit
    +fi
    +
    +rm -rf logs
    +mkdir logs
    +
    +echo "-----------creating docker container madlib--------------------"
    +docker kill madlib
    +docker rm madlib
    +
    +# Pull down the base docker images
    +echo "Creating docker container"
    +docker pull madlib/postgres_9.6:latest
    +
    +# Launch docker container with volume mounted from workdir
    +docker run -d --name madlib -v "${workdir}/${reponame}":/madlib \
    + 					madlib/postgres_9.6 | tee logs/docker_setup.log
    +
    +## This sleep is required since it takes a couple of seconds for the docker
    +## container to come up, which is required by the docker exec command that 
    +## follows.
    +sleep 5
    +
    +echo "---------- Building MADlib -----------"
    +# cmake, make, make install
    +# The build folder is /madlib/docker_build, which is mounted to your local
    +# madlib repo
    +docker exec madlib bash -c "rm -rf /madlib/docker_build; \
    --- End diff --
    
    Please use `build-docker` as the build folder, in accordance with what was in the earlier documentation.


---

[GitHub] madlib issue #181: Add a script to start docker image

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:

    https://github.com/apache/madlib/pull/181
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/madlib-pr-build/233/



---

[GitHub] madlib issue #181: Add a script to start docker image

Posted by edespino <gi...@git.apache.org>.
Github user edespino commented on the issue:

    https://github.com/apache/madlib/pull/181
  
    I ran the shell script analysis tool (available via brew [shellcheck](https://www.shellcheck.net/)). It reported a few issues with the script:
    
    ```
    ✘-1 ~/workspace/MADlib/madlib/tool [PR-181 L|…1] 
    17:40 $ shellcheck --version
    ShellCheck - shell script analysis tool
    version: 0.4.6
    license: GNU General Public License, version 3
    website: http://www.shellcheck.net
    ✔ ~/workspace/MADlib/madlib/tool [PR-181 L|…1] 
    17:40 $ shellcheck docker_start.sh
    
    In docker_start.sh line 33:
    workdir=`pwd`
            ^-- SC2006: Use $(..) instead of legacy `..`.
    
    
    In docker_start.sh line 34:
    user_name=`whoami`
              ^-- SC2006: Use $(..) instead of legacy `..`.
    
    
    In docker_start.sh line 77:
    docker exec madlib-test bash -c 'rm -rf /build; mkdir /build; cd /build; cmake ../madlib; make clean; make; make install' | tee $workdir/logs/madlib_compile.log
                                                                                                                                    ^-- SC2086: Double quote to prevent globbing and word splitting.
    
    
    In docker_start.sh line 84:
    docker exec madlib-test bash -c '/build/src/bin/madpack -p postgres -c postgres/postgres@localhost:5432/postgres install' | tee $workdir/logs/madlib_install.log
                                                                                                                                    ^-- SC2086: Double quote to prevent globbing and word splitting.
    
    
    In docker_start.sh line 92:
    docker exec madlib-test bash -c '/build/src/bin/madpack -p postgres  -c postgres/postgres@localhost:5432/postgres -d /tmp install-check' | tee $workdir/logs/madlib_install_check.log
                                                                                                                                                   ^-- SC2086: Double quote to prevent globbing and word splitting.
    
    
    In docker_start.sh line 99:
    docker exec --user=postgres -it madlib-test bash | tee $workdir/logs/docker_exec.log
                                                           ^-- SC2086: Double quote to prevent globbing and word splitting.
    
    ✘-1 ~/workspace/MADlib/madlib/tool [PR-181 L|…1] 
    17:40 $ 
    ```


---

[GitHub] madlib issue #181: Add a script to start docker image

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:

    https://github.com/apache/madlib/pull/181
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/madlib-pr-build/252/



---

[GitHub] madlib issue #181: Add a script to start docker image

Posted by edespino <gi...@git.apache.org>.
Github user edespino commented on the issue:

    https://github.com/apache/madlib/pull/181
  
    Although I do understand why you echo the commands prior to executing, I think the script easier to maintain without them. A user of the script can always run this with `bash -x docker_start.sh` to watch the commands execute.


---

[GitHub] madlib issue #181: Add a script to start docker image

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:

    https://github.com/apache/madlib/pull/181
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/madlib-pr-build/251/



---

[GitHub] madlib pull request #181: Add a script to start docker image

Posted by edespino <gi...@git.apache.org>.
Github user edespino commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/181#discussion_r137689983
  
    --- Diff: tool/docker_start.sh ---
    @@ -0,0 +1,99 @@
    +#!/bin/bash
    +# 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.
    +
    +#####################################################################################
    +#  This is a script that does the following:
    +#  * Pull madlib/postgres_9.6:latest from docker;
    +#  * Mount your local madlib directory to docker container;
    +#  * Build madlib from source;
    +#  * Install madlib and run install check;
    +#  * Log in to docker container from shell as postgres user, so that you
    +#    can run psql and start using madlib from here
    +#
    +# Note: you have to run this script from one level up from your madlib directory, for
    +# example, ~/workspace which has madlib src directory there
    +#####################################################################################
    +set -o pipefail
    +
    +workdir=`pwd`
    +user_name=`whoami`
    +reponame=madlib
    +
    +echo "======================================================================"
    +echo "Build user: $user_name"
    +echo "Work directory: $workdir"
    +echo "Git reponame: $reponame"
    +echo "======================================================================"
    +echo "ls -la"
    +ls -la
    +echo "rm -rf logs"
    +rm -rf logs
    +echo "mkdir logs"
    +mkdir logs
    +
    +echo "-----------creating docker container madlib--------------------"
    +echo "docker kill madlib"
    +docker kill madlib-test
    +echo "docker rm madlib"
    +docker rm madlib-test
    +
    +# Pull down the base docker images
    +echo "Creating docker container"
    +docker pull madlib/postgres_9.6:latest
    +
    +# Launch docker container with volume mounted from workdir
    +echo "-------------------------------"
    +cat <<EOF
    +docker run -d --name madlib-test -v "${workdir}/${reponame}":/madlib madlib/postgres_9.6 | tee logs/docker_setup.log
    +EOF
    +docker run -d --name madlib-test -v "${workdir}/${reponame}":/madlib madlib/postgres_9.6 | tee logs/docker_setup.log
    +echo "-------------------------------"
    +
    +
    +## This sleep is required since it takes a couple of seconds for the docker
    +## container to come up, which is required by the docker exec command that follows.
    +sleep 5
    +
    +echo "---------- Building MADlib -----------"
    +# cmake, make, make install
    +cat <<EOF
    +docker exec madlib bash -c 'rm -rf /build; mkdir /build; cd /build; cmake ../madlib; make clean; make; make install' | tee $workdir/logs/madlib_compile.log
    +EOF
    +docker exec madlib-test bash -c 'rm -rf /build; mkdir /build; cd /build; cmake ../madlib; make clean; make; make install' | tee $workdir/logs/madlib_compile.log
    --- End diff --
    
    I think the `make clean` is essentially a no-op since the build directory has just been created.


---

[GitHub] madlib pull request #181: Add a script to start docker image

Posted by njayaram2 <gi...@git.apache.org>.
Github user njayaram2 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/181#discussion_r139573892
  
    --- Diff: tool/docker_start.sh ---
    @@ -0,0 +1,98 @@
    +#!/bin/bash
    +# 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.
    +
    +###############################################################################
    +#  This is a script that does the following:
    +#  * Pull madlib/postgres_9.6:latest from docker;
    +#  * Mount your local madlib directory to docker container;
    +#  * Build madlib from source; build dir is /madlib/docker_build which 
    +#    is mounted to your local madlib dir
    +#  * Install madlib and run install check;
    +#  * Log in to docker container from shell as postgres user, so that you
    +#    can run psql and start using madlib from here
    +#
    +# Note: you have to run this script from one level up from your madlib 
    +# directory, for example, ~/workspace which has madlib src directory there
    +###############################################################################
    +set -o pipefail
    +
    +workdir=$(pwd)
    +user_name=$(whoami)
    +reponame=madlib
    +
    +echo "======================================================================"
    +echo "Build user: ${user_name}"
    +echo "Work directory: ${workdir}"
    +echo "Git reponame: ${reponame}"
    +echo "======================================================================"
    +
    +if [[ ! -d "${workdir}/${reponame}" ]]; then
    +  echo "Error: you have to run this script from one level up from your madlib \
    +        directory, for example, ~/workspace which has madlib src directory \
    +        there"
    +  exit
    +fi
    +
    +rm -rf logs
    +mkdir logs
    --- End diff --
    
    rename the `logs` folder to `build-docker-logs`, just to indicate that this log folder is related to docker based build folder.


---

[GitHub] madlib issue #181: Add a script to start docker image

Posted by edespino <gi...@git.apache.org>.
Github user edespino commented on the issue:

    https://github.com/apache/madlib/pull/181
  
    Jenkins ok to test


---

[GitHub] madlib pull request #181: Add a script to start docker image

Posted by njayaram2 <gi...@git.apache.org>.
Github user njayaram2 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/181#discussion_r139573718
  
    --- Diff: tool/docker_start.sh ---
    @@ -0,0 +1,98 @@
    +#!/bin/bash
    +# 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.
    +
    +###############################################################################
    +#  This is a script that does the following:
    +#  * Pull madlib/postgres_9.6:latest from docker;
    +#  * Mount your local madlib directory to docker container;
    +#  * Build madlib from source; build dir is /madlib/docker_build which 
    +#    is mounted to your local madlib dir
    +#  * Install madlib and run install check;
    +#  * Log in to docker container from shell as postgres user, so that you
    +#    can run psql and start using madlib from here
    +#
    +# Note: you have to run this script from one level up from your madlib 
    +# directory, for example, ~/workspace which has madlib src directory there
    +###############################################################################
    +set -o pipefail
    +
    +workdir=$(pwd)
    +user_name=$(whoami)
    +reponame=madlib
    +
    +echo "======================================================================"
    +echo "Build user: ${user_name}"
    +echo "Work directory: ${workdir}"
    +echo "Git reponame: ${reponame}"
    +echo "======================================================================"
    +
    +if [[ ! -d "${workdir}/${reponame}" ]]; then
    +  echo "Error: you have to run this script from one level up from your madlib \
    +        directory, for example, ~/workspace which has madlib src directory \
    +        there"
    +  exit
    +fi
    +
    +rm -rf logs
    +mkdir logs
    +
    +echo "-----------creating docker container madlib--------------------"
    +docker kill madlib
    +docker rm madlib
    +
    +# Pull down the base docker images
    +echo "Creating docker container"
    +docker pull madlib/postgres_9.6:latest
    --- End diff --
    
    Please take `latest` as an optional param. We will then be able to use this script for other tags such as `jenkins` and `LaTex`.


---