Skip to content

Latest commit

 

History

History
128 lines (85 loc) · 5.03 KB

3.docker-deployment.md

File metadata and controls

128 lines (85 loc) · 5.03 KB

Docker Deployment

This document introduces the creation and download of Docker images for TuGraph Compile and TuGraph Runtime.

1.Introduction

  • TuGraph Compile Image: Provides a compilation environment and can be used for TuGraph compilation and testing.
  • TuGraph Runtime Image: Provides a binary executable environment with TuGraph library and executable files.
  • TuGraph Mini Runtime Image: Provides a binary executable environment without Java and Python functions in TuGraph, no C++ plugin compilation and execution, only so upload.

2.Existing Docker Images

2.1.Image Download

The images are hosted on DockerHub and can be downloaded and used directly.

For the latest version of Docker address, see the TuGraph-Latest-Version section in Guide.

2.2.Naming Convention

2.2.1.TuGraph Compile Image

Provides a compilation environment and can be used for TuGraph compilation.

tugraph/tugraph-compile-[os name & version]:[tugraph compile version]

For example: tugraph/tugraph-compile-centos7:1.2.0

2.2.2.TuGraph Runtime Image

Provides a binary executable environment with TuGraph library and executable files.

tugraph/tugraph-runtime-[os name & version]:[tugraph-runtime version]

For example:tugraph/tugraph-runtime-centos7:3.4.0

2.2.3.TuGraph Mini Runtime Image

Provides a binary executable environment without Java and Python functions in TuGraph, no C++ plugin compilation and execution, only so upload.

tugraph/tugraph-mini-runtime-[os name & version]:[tugraph-runtime version]

For example: tugraph/tugraph-mini-runtime-centos7:3.4.0

2.3.Common Docker Operations

Docker is generated from Dockerfile. Note that creating images requires downloading dependencies, so network issues may cause slow creation or creation failure. Do not overwrite images unless the tag is latest.

build Compile image

docker build -f tugraph-compile-centos7-Dockerfile -t tugraph/tugraph-compile-centos7:1.2.0 .

build Runtime / Mini Runtime image

docker build --build-arg FILEPATH="${rpm_path_in_oss}" --build-arg FILENAME="${rpm_name}" -f tugraph-compile-centos7-Dockerfile -t tugraph/tugraph-runtime-centos7:1.2.0 .

Modify image name

docker tag ${image_name}:${image_tag} tugraph/tugraph-runtime-centos7:3.3.0

push image

docker push tugraph/tugraph-compile-centos7:1.2.0 .

pull image

docker pull tugraph/tugraph-compile-centos7:1.2.0

save image

docker save ${image_name}:${image_tag} | gzip > lgraph_latest.tar.gz

load image

docker load --input lgraph_latest.tar.gz

Refer to the docker official documentation for other Docker operations.

2.4. M1 Supports

Running amd64 containers on M1-chip machines may cause unknown errors. TuGraph provides arm64 images for M1 machines. Contains compile and runtime images.

In tugraph-runtime-centos7:3.6.0 and tugraph-compile-centos7:1.2.7 and later, tugraph-runtime-centos7 and tugraph-compile-centos7 provide images of two architectures: linux/amd64 and linux/arm64/v8. You can obtain the arm64 architecture image through docker pull on the M1 machine.

2.5. Running service

  1. Pull the docker images

    docker pull tugraph/tugraph-runtime-centos7:${VERSION}
  2. Start docker

     docker run -d -p 7070:7070  -p 7687:7687 -p 9090:9090 -v /root/tugraph/data:/var/lib/lgraph/data  -v /root/tugraph/log:/var/log/lgraph_log \
     --name tugraph_demo ${REPOSITORY}:${VERSION}
    
    # ${REPOSITORY} is the image address,${VERSION}is the version number.
    # 7070  is default http port,for tugraph-db-browser accessing..
    # 7687 is bolt port, for neo4j client accessing.
    # 9090 is default RPC port,for RPC client accessing.
    
    # The default data directory is /var/lib/lgraph/data and the default log directory is /var/log/lgraph_log,
    # which is configured in the tugraph configuration file at /usr/local/etc/lgraph.json inside the docker.
    # This command mounts the data directory and log directory to /root/tugraph/ on the host for persistence,
    # which you can modify according to your actual situation.

3. Best Practice in Using and Developing Docker Images for TuGraph-DB

Please carefully read the points below and follow them if you are new to contribute to TuGraph.

  • To get rid of too much docker layer, please add your dependency to the Docker with the style writing ENV and RUN in a single line.
  • For the packages/resources you need to build the dependency, use the original ones instead of tweaking them without tracking by VCS. And then contact TuGraph team to upload it to OSS to accelerate the building process, as the urls you see in the Dockerfiles.
  • To make the development more efficient, you would better start from adding dependencies to base TuGraph Compile Images and then reproduce the process in the Dockerfile after confirming the enviroment works.
  • CI uses the docker images. Please check the dependency problems if your CI fails.