diff options
author | Arnstein Ressem <aressem@gmail.com> | 2016-06-22 01:30:16 +0200 |
---|---|---|
committer | Arnstein Ressem <aressem@gmail.com> | 2016-06-22 01:30:16 +0200 |
commit | 18e18c4a77a549606a75f10948f21d21553f7771 (patch) | |
tree | a425798548c605d3f29b909c3fad7040ff99023d /docker | |
parent | 1d786a57d5e1b1a782458a928258281ab9c05943 (diff) |
Fixed build scripts and added run scripts.
Diffstat (limited to 'docker')
-rw-r--r-- | docker/Dockerfile.run | 17 | ||||
-rw-r--r-- | docker/README.md | 3 | ||||
-rwxr-xr-x | docker/build-vespa-internal.sh | 10 | ||||
-rwxr-xr-x | docker/build-vespa.sh | 11 | ||||
-rwxr-xr-x | docker/run-vespa-internal.sh | 25 | ||||
-rwxr-xr-x[-rw-r--r--] | docker/run-vespa.sh | 17 |
6 files changed, 59 insertions, 24 deletions
diff --git a/docker/Dockerfile.run b/docker/Dockerfile.run index 7ea01cc3983..d82297ce676 100644 --- a/docker/Dockerfile.run +++ b/docker/Dockerfile.run @@ -22,19 +22,6 @@ RUN yum -y install vespa-libtorrent RUN yum -y install vespa-zookeeper-c-client RUN yum -y install vespa-cppunit # Should not be needed ? -#RUN yum -y install vespa -# Workaround while we wait for a published rpm -COPY vespa-7.0-1.el7.centos.x86_64.rpm /vespa.rpm -RUN rpm -i vespa.rpm +# Utilities +RUN yum -y install net-tools less -# Workaround for user name and permissions and vespa home detetction -RUN useradd yahoo -RUN chown -R yahoo:yahoo /opt/vespa -ENV VESPA_HOME /opt/vespa - -# Build : docker build -t vesparun -f Dockerfile.run . -# IMORTANT: Need to put the local vespa rpm name in the copy command. -# Run : docker run -ti --rm --net=host vesparun <path to service startup script> -# Need -v options to map directories used to store data -# ONLY MANUAL INSTALL OF VESPA RPM TESTED -# diff --git a/docker/README.md b/docker/README.md index dd11d2eee44..38809e6e3d5 100644 --- a/docker/README.md +++ b/docker/README.md @@ -4,7 +4,8 @@ ## Installing docker [Docker installation](https://docs.docker.com/engine/installation/) -*On OS X, the native Docker engine has NOT been tested. Please use the [Docker Toolbox](https://www.docker.com/products/docker-toolbox).* +*On OS X, the native Docker engine (Beta) has NOT been tested. Please use the [Docker Toolbox](https://www.docker.com/products/docker-toolbox).* +*On Linux, the default storage device is devicemapper with loopback device and max 10GB container size. This size is too small for a full build. Please see [here](http://www.projectatomic.io/blog/2016/03/daemon_option_basedevicesize/) and [here](http://www.projectatomic.io/blog/2015/06/notes-on-fedora-centos-and-docker-storage-drivers/) to overcome this limitation. ## Building Vespa *On OS X, execute ```source osx-setup-docker-machine.sh``` to setup the Docker VM in which to run Docker.* diff --git a/docker/build-vespa-internal.sh b/docker/build-vespa-internal.sh index ee92c156ee0..f79e936c800 100755 --- a/docker/build-vespa-internal.sh +++ b/docker/build-vespa-internal.sh @@ -1,14 +1,18 @@ #!/bin/bash set -e -if [ $# -ne 1 ]; then - echo "Usage: $0 <vespa version>" +if [ $# -ne 3 ]; then + echo "Usage: $0 <vespa version> <caller uid> <caller gid>" + echo "This script should not be called manually." exit 1 fi VESPA_VERSION=$1 +CALLER_UID=$2 +CALLER_GID=$3 cd /vespa ./dist.sh ${VESPA_VERSION} rpmbuild -bb ~/rpmbuild/SPECS/vespa-${VESPA_VERSION}.spec -cp -a ~/rpmbuild/RPMS/x86_64/*.rpm /vespa/docker +chown ${CALLER_UID}:${CALLER_GID} ~/rpmbuild/RPMS/x86_64/*.rpm +mv ~/rpmbuild/RPMS/x86_64/*.rpm /vespa/docker diff --git a/docker/build-vespa.sh b/docker/build-vespa.sh index d860207964d..6d3b1699bc5 100755 --- a/docker/build-vespa.sh +++ b/docker/build-vespa.sh @@ -5,12 +5,13 @@ if [ $# -ne 1 ]; then echo "Usage: $0 <vespa version>" exit 1 fi -VESPA_VERSION=$1 -docker build -t vespabuild -f Dockerfile.build . +DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) +cd $DIR -TMP=$(mktemp -d) -docker run --rm -v $(pwd)/..:/vespa -v $TMP:/root/rpmbuild --entrypoint /vespa/docker/build-vespa-internal.sh vespabuild "$VESPA_VERSION" +VESPA_VERSION=$1 +DOCKER_IMAGE="vespabuild" -rm -rf $TMP +docker build -t "$DOCKER_IMAGE" -f Dockerfile.build . +docker run --rm -v $(pwd)/..:/vespa --entrypoint /vespa/docker/build-vespa-internal.sh "$DOCKER_IMAGE" "$VESPA_VERSION" "$(id -u)" "$(id -g)" diff --git a/docker/run-vespa-internal.sh b/docker/run-vespa-internal.sh new file mode 100755 index 00000000000..3918f7881dd --- /dev/null +++ b/docker/run-vespa-internal.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -e + +if [ $# -ne 1 ]; then + echo "Usage: $0 <vespa version>" + echo "This script should not be called manually." + exit 1 +fi + +DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) +cd $DIR + +VESPA_VERSION=$1 + +rpm -i "vespa-${VESPA_VERSION}-1.el7.centos.x86_64.rpm" +rpm -i "vespa-debuginfo-${VESPA_VERSION}-1.el7.centos.x86_64.rpm" + +# Workaround until we figure out why rpm does not set the ownership. +chown -R vespa:vespa /opt/vespa + +/opt/vespa/bin/vespa-start-configserver +/opt/vespa/bin/vespa-start-services + +# Sleep until killed +tail -f /dev/null diff --git a/docker/run-vespa.sh b/docker/run-vespa.sh index e69de29bb2d..2ff511cc70b 100644..100755 --- a/docker/run-vespa.sh +++ b/docker/run-vespa.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -e + +if [ $# -ne 1 ]; then + echo "Usage: $0 <vespa version>" + exit 1 +fi + +DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) +cd $DIR + +VESPA_VERSION=$1 +DOCKER_IMAGE=vesparun + +docker build -t "$DOCKER_IMAGE" -f Dockerfile.run . +docker run -d -v $(pwd)/..:/vespa --entrypoint /vespa/docker/run-vespa-internal.sh "$DOCKER_IMAGE" "$VESPA_VERSION" + |