Docker

Installing Graph Server in Docker

Installing Graph Server is pretty straight forward but there are a few things to consider.

This will show how to install in Docker, but you’ll be able to adopt for whatever deployment model you want to use.

Begin with downloading the Graph SAerver package and a the latest and greatest of Java 11.

https://www.oracle.com/java/technologies/downloads/#java11
https://www.oracle.com/database/graph/downloads.html

Now with this in place you unzip and put both rpms in the same directory. Create a “Dockerfile” in the same directory with this content.

ROM oraclelinux:8-slim

ARG VERSION_JDK
ARG VERSION_OPG
ARG JDBC_URL

COPY ./jdk-${VERSION_JDK}_linux-aarch64_bin.rpm /tmp
COPY ./oracle-graph-${VERSION_OPG}.x86_64.rpm /tmp

RUN microdnf install -y unzip numactl gcc libgfortran python3.8 findutils ncurses \
 && microdnf clean all \
 && rm -rf /var/cache/yum/* \
 && rpm -ivh /tmp/jdk-${VERSION_JDK}_linux-aarch64_bin.rpm \
 && rpm -ivh --ignorearch /tmp/oracle-graph-${VERSION_OPG}.x86_64.rpm \
 && rm -f /usr/bin/python3 /usr/bin/pip3 \
 && ln /usr/bin/python3.8 /usr/bin/python3 \
 && ln /usr/bin/pip3.8 /usr/bin/pip3 \
 && pip3 install oracle-graph-client==24.2.0

ENV JAVA_HOME=/usr/lib/jvm/jdk-11-oracle-aarch64
ENV PATH=$PATH:/opt/oracle/graph/bin
ENV SSL_CERT_FILE=/etc/oracle/graph/ca_certificate.pem
ENV PGX_SERVER_KEYSTORE_PASSWORD=changeit

RUN keytool -importkeystore \
    -srckeystore /etc/oracle/graph/server_keystore.jks \
    -destkeystore $JAVA_HOME/lib/security/cacerts \
    -deststorepass changeit \
    -srcstorepass changeit \
    -noprompt

RUN sed -i "s|<REPLACE-WITH-DATABASE-URL-TO-USE-FOR-AUTHENTICATION>|${JDBC_URL}|" /etc/oracle/graph/pgx.conf
RUN sed -i '1 a  "scheduler": "basic_scheduler",' /etc/oracle/graph/pgx.conf

EXPOSE 7007

WORKDIR /opt/oracle/graph/bin

CMD ["sh", "/opt/oracle/graph/pgx/bin/start-server"]

A couple of things worth noting:

  • I use 8-slim to make the image smaller. It leads to a few extra dependencies and you use microdnf rather than the usual dnf command.
  • Line 23 sets a password for the keystore, change this value to the password you want it to have.
  • Line 32 puts the url for the database into the config.
  • Line 33 changes the scheduler from enterprise to basic. This is only needed if you’re not installing on x86.

With this in place you can now create the docker image.

docker build . \
-f Dockerfile \
--tag graph-server:23.4.0 \
--build-arg VERSION_OPG=24.2.0 \
--build-arg VERSION_JDK=11.0.23 \
--build-arg JDBC_URL=jdbc:oracle:thin:@oracledb_19_19/pdb19

Nothing unusual here really. The first two build arguments defines the versions you install and are used to construct the filename of the RPMs. The last is a connect string for your database. My current play database happens to have that name and you can tell I’m testing this with 19c.

Once that completes the container can be instantiated.

docker run \
--name graph-server \
--network oranet \
--publish 7007:7007 \
--env JAVA_TOOL_OPTIONS="-Xms1G -Xmx2G" \
--detach \
graph-server:23.4.0

The one thing to note is the third line. I have set up a network in docker named oranet. You will want to modify that after how you have docker networking setup in your environment.

That completes the install and if everything has worked you should reach a login prompt if you point your web browser to https://localhost:7007/ui/.

Next step is to add a bit of data and get your very first graph displayed. But that is the content for tomorrows post.

Leave a Comment

Your email address will not be published. Required fields are marked *

*