Skip to content

Commit

Permalink
Add preliminary support for prestojava container image.
Browse files Browse the repository at this point in the history
  • Loading branch information
kgpai committed Dec 7, 2023
1 parent 57a35c0 commit ff84e1d
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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=<NUMBER_OF_THREADS_TO_USE> --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'"
5 changes: 5 additions & 0 deletions scripts/etc/config.properties.example
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions scripts/etc/jvm.config.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-server
-Xmx1G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
-Djdk.attach.allowAttachSelf=true
2 changes: 2 additions & 0 deletions scripts/etc/node.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node.environment=test
node.data-dir=/var/lib/presto/data
47 changes: 47 additions & 0 deletions scripts/prestojava-container.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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 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
19 changes: 19 additions & 0 deletions scripts/start-prestojava.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
# 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.

set -e
echo "node.id=$HOSTNAME" >> $PRESTO_HOME/etc/node.properties

$PRESTO_HOME/bin/launcher run

0 comments on commit ff84e1d

Please sign in to comment.