diff --git a/docker-compose.yml b/docker-compose.yml index a8fe32b71706f..04acbb4ba3e87 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -69,3 +69,24 @@ services: volumes: - .:/velox:delegated command: cd /velox && make python-test + + + presto-java: + # Usage: + # docker-compose pull presto-java or docker-compose build presto-java + # docker-compose run --rm presto-java + # or + # docker-compose run -e NUM_THREADS= --rm presto-java + # to set the number of threads used during compilation + image: ghcr.io/facebookincubator/velox-dev:amd64-centos-8-avx + build: + args: + - PRESTO_VERSION=0.284 + context: . + dockerfile: scripts/prestojava-container.dockerfile + environment: + NUM_THREADS: 8 # default value for NUM_THREADS + CCACHE_DIR: "/velox/.ccache" + volumes: + - .:/velox:delegated + command: /bin/bash -c "scl enable gcc-toolset-9 '/velox/scripts/docker-command.sh'" \ No newline at end of file diff --git a/scripts/etc/config.properties.example b/scripts/etc/config.properties.example new file mode 100644 index 0000000000000..ec7a7345949da --- /dev/null +++ b/scripts/etc/config.properties.example @@ -0,0 +1,5 @@ +coordinator=true +node-scheduler.include-coordinator=true +http-server.http.port=8080 +discovery-server.enabled=true +discovery.uri=http://localhost:8080 \ No newline at end of file diff --git a/scripts/etc/jvm.config.example b/scripts/etc/jvm.config.example new file mode 100644 index 0000000000000..f9cf9f0bb6689 --- /dev/null +++ b/scripts/etc/jvm.config.example @@ -0,0 +1,9 @@ +-server +-Xmx1G +-XX:+UseG1GC +-XX:G1HeapRegionSize=32M +-XX:+UseGCOverheadLimit +-XX:+ExplicitGCInvokesConcurrent +-XX:+HeapDumpOnOutOfMemoryError +-XX:+ExitOnOutOfMemoryError +-Djdk.attach.allowAttachSelf=true \ No newline at end of file diff --git a/scripts/etc/node.properties b/scripts/etc/node.properties new file mode 100644 index 0000000000000..6ec0b16f3576b --- /dev/null +++ b/scripts/etc/node.properties @@ -0,0 +1,2 @@ +node.environment=test +node.data-dir=/var/lib/presto/data \ No newline at end of file diff --git a/scripts/prestojava-container.dockerfile b/scripts/prestojava-container.dockerfile new file mode 100644 index 0000000000000..2bada158360ab --- /dev/null +++ b/scripts/prestojava-container.dockerfile @@ -0,0 +1,48 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# Licensed 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. +# Build the test and build container for presto_cpp +# +FROM quay.io/centos/centos:stream8 + +ARG PRESTO_VERSION + +ADD scripts /velox/scripts/ +RUN /velox/scripts/setup-centos8.sh +RUN wget https://repo1.maven.org/maven2/com/facebook/presto/presto-server/${PRESTO_VERSION}/presto-server-${PRESTO_VERSION}.tar.gz +RUN wget https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/${PRESTO_VERSION}/presto-cli-${PRESTO_VERSION}-executable.jar + +ARG PRESTO_PKG=presto-server-$PRESTO_VERSION.tar.gz +ARG PRESTO_CLI_JAR=presto-cli-$PRESTO_VERSION-executable.jar + +ENV PRESTO_HOME="/opt/presto-server" +RUN ls +RUN cp $PRESTO_CLI_JAR /opt/presto-cli + +RUN dnf install -y java-11-openjdk less procps python3 \ + && ln -s $(which python3) /usr/bin/python \ + && tar -zxf $PRESTO_PKG \ + && mv ./presto-server-$PRESTO_VERSION $PRESTO_HOME \ + && chmod +x /opt/presto-cli \ + && ln -s /opt/presto-cli /usr/local/bin/ \ + && mkdir -p $PRESTO_HOME/etc \ + && mkdir -p $PRESTO_HOME/etc/catalog \ + && mkdir -p /var/lib/presto/data \ + && mkdir -p /usr/lib/presto/utils + +COPY scripts/etc/config.properties.example $PRESTO_HOME/etc/config.properties +COPY scripts/etc/jvm.config.example $PRESTO_HOME/etc/jvm.config +COPY scripts/etc/node.properties $PRESTO_HOME/etc/node.properties +COPY scripts/start-prestojava.sh /opt + +WORKDIR /velox \ No newline at end of file diff --git a/scripts/start-prestojava.sh b/scripts/start-prestojava.sh new file mode 100755 index 0000000000000..fcda45d78a8a2 --- /dev/null +++ b/scripts/start-prestojava.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +set -e +echo "node.id=$HOSTNAME" >> $PRESTO_HOME/etc/node.properties + +$PRESTO_HOME/bin/launcher run \ No newline at end of file