Skip to content

Commit

Permalink
add sample Docker file (#21)
Browse files Browse the repository at this point in the history
Here's the Dockerfile and instructions I used to test #20.
  • Loading branch information
isaacbrodsky authored Mar 28, 2024
1 parent 618b5a3 commit 78a0387
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 1 deletion.
32 changes: 32 additions & 0 deletions contrib/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# From https://prestodb.io/docs/current/installation/deployment.html#an-example-deployment-with-docker

FROM openjdk:8-jre

# Presto version will be passed in at build time
ARG PRESTO_VERSION

# Set the URL to download
ARG PRESTO_BIN=https://repo1.maven.org/maven2/com/facebook/presto/presto-server/${PRESTO_VERSION}/presto-server-${PRESTO_VERSION}.tar.gz

# Update the base image OS and install wget and python
RUN apt-get update
RUN apt-get install -y wget python less

# Download Presto and unpack it to /opt/presto
RUN wget --quiet ${PRESTO_BIN}
RUN mkdir -p /opt
RUN tar -xf presto-server-${PRESTO_VERSION}.tar.gz -C /opt
RUN rm presto-server-${PRESTO_VERSION}.tar.gz
RUN ln -s /opt/presto-server-${PRESTO_VERSION} /opt/presto

# Download the Presto CLI and put it in the image
RUN wget --quiet https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/${PRESTO_VERSION}/presto-cli-${PRESTO_VERSION}-executable.jar
RUN mv presto-cli-${PRESTO_VERSION}-executable.jar /usr/local/bin/presto
RUN chmod +x /usr/local/bin/presto

# Copy configuration files on the host into the image
COPY plugin /opt/presto/plugin
COPY etc /opt/presto/etc

# Specify the entrypoint to start
ENTRYPOINT ./opt/presto/bin/launcher run
30 changes: 30 additions & 0 deletions contrib/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Sample Docker File

It can be difficult to test h3-presto if you don't have a Presto server running already. These instructions help you get a Presto node with h3-presto running for development. (These instructions are based on the [Presto Docker deployment](https://prestodb.io/docs/current/installation/deployment.html#an-example-deployment-with-docker) instructions.)

To build, starting from the root of the repository:

```sh
mvn clean package -DskipTests
cd contrib/docker
cp ../../target/h3-presto-4.0.0.jar plugin/h3/h3-presto-4.0.0.jar
docker build -f Dockerfile -t presto --build-arg PRESTO_VERSION=0.286 .
```

To run:

```sh
docker run -p 8080:8080 --rm -it presto
```

And then in another terminal, run the [Presto command line interface](https://prestodb.io/docs/current/installation/cli.html):

```sh
./presto
```

And try a sample query:

```sql
select h3_latlng_to_cell(0,0,0);
```
8 changes: 8 additions & 0 deletions contrib/docker/etc/config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
query.max-memory=2GB
query.max-memory-per-node=1GB
discovery-server.enabled=false
#discovery.uri=http://example.net:8080

8 changes: 8 additions & 0 deletions contrib/docker/etc/jvm.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-server
-Xmx8G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
3 changes: 3 additions & 0 deletions contrib/docker/etc/node.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/data
Empty file.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<presto.version>0.277</presto.version>
<presto.version>0.286</presto.version>
<junit-jupiter.version>5.8.2</junit-jupiter.version>
<maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
Expand Down

0 comments on commit 78a0387

Please sign in to comment.