Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

TigerGraph Docker cheatsheet

Information

docker ps -a | grep tiger

List all containers with tiger in their name or image name.

docker logs -f tiger-local-development

Inspect the log for container tiger-local-development

Container management

docker run -p 9000:9000 -p 14240:14240 --name tiger-local-development -d -t openc/tigergraph

Run the openc/tigergraph image, exposing its port 9000 on localhost:9000 and its port 14240 (GraphStudio) on localhost:14240 naming it tiger-local-development

docker run -p 9090:9000 --name tiger-local-test -d -t openc/tigergraph

Run the openc/tigergraph image, exposing its port 9000 on localhost:9090 naming it tiger-local-test

docker stop tiger-local-test

Stop container called tiger-local-test

docker rm tiger-local-test

Remove container called tiger-local-test

Interacting with a container

docker exec -it tiger-local-development /bin/bash

Run a bash shell in the container tiger-local-development

e.g.

$ docker exec -it tiger-local-test /bin/bash
tigergraph@9e6c59199f54:/$ gsql
Welcome to TigerGraph Developer Edition, for non-commercial use only.
GSQL-Dev > CREATE VERTEX entity (PRIMARY_ID ar_id INT, name STRING, class STRING)
The vertex type entity is created.
GSQL-Dev > CREATE DIRECTED EDGE shareholder_of (FROM entity, TO entity, confidence FLOAT) WITH REVERSE_EDGE="share_issuer_to"
The edge type shareholder_of is created.
The reverse edge type share_issuer_to is created.
GSQL-Dev > CREATE GRAPH oc (entity, shareholder_of, share_issuer_to)

Restarting gse gpe restpp ...

Finish restarting services in 17.835 seconds!
The graph oc is created.

Pushing a new version

docker ps -a | grep tiger
docker commit de633745c44c openc/tigergraph # Container ID of the desired container
docker tag openc/tigergraph docker-registry.opencorporates.com/opencorporates/tigergraph:my_version_tag
docker image ls # Your new image should have the my_version_tag tag
docker push docker-registry.opencorporates.com/opencorporates/tigergraph
The push refers to repository [docker-registry.opencorporates.com/opencorporates/tigergraph]
abc6965e6bae: Pushed 
516e484b7eee: Pushed 
d5139ac61688: Pushed 
5d8894afcd53: Pushed 
75b79e19929c: Layer already exists 
4775b2f378bb: Layer already exists 
883eafdbe580: Layer already exists 
19d043c86cbc: Layer already exists 
8823818c4748: Layer already exists 
latest: digest: sha256:68da8ad6b6b087b8b23cf232cbe373bcc986c0a3ab8254f8435b8eaf13aa5eac size: 2200

One of the layers takes a long time to push.

Building a container from a clean image

Download the image from TigerGraph

brew install wget # if on MacOS and not already installed
wget http://dl.tigergraph.com/tigergraph-developer-docker-beta.tar.gz

Load it into an image

docker load < tigergraph-developer-docker-beta.tar.gz

Run it in a container

docker run -p 9000:9000 -p 14240:14240 --name tiger-local-development -d -t tigergraph

Generate the schema and queries.

  1. Edit your tiger_graph.yml so that your development environment points to the new container with a graph named oc
  2. bin/rake tiger_graph:ddl
  3. docker exec -it tiger-local-development /bin/bash
  4. Use vim to add the generated schema and queries from your tmp/tiger_graph/development directory to the container:
tigergraph@9a9340034c7f:/$ cd ~
tigergraph@9a9340034c7f:~$ vim oc_schema.gsql
tigergraph@9a9340034c7f:~$ gsql oc_schema.gsql
The vertex type entity is created.
The edge type shareholder_of is created.
The reverse edge type share_issuer_to is created.
The edge type has_subsidiary is created.
The reverse edge type is_subsidiary is created.
The edge type controls is created.
The reverse edge type is_controlled_by is created.

Restarting gse gpe restpp ...

Finish restarting services in 20.566 seconds!
The graph oc is created.
tigergraph@9a9340034c7f:~$ vim oc_many_hops.gsql
tigergraph@9a9340034c7f:~$ gsql oc_many_hops.gsql
Using graph 'oc'
Query oc_many_hops could not be found.
The query oc_many_hops has been added!
Start installing queries, about 1 minute ...
oc_many_hops query: curl -X GET 'http://127.0.0.1:9000/query/oc/oc_many_hops?seed=VALUE&hops=VALUE&effective_date=VALUE&confidence=VALUE&ownership_percentage=VALUE&child_edge_types=VALUE'. Add -H "Authorization: Bearer TOKEN" if authentication is enabled.

[========================================================================================================] 100% (1/1) 
tigergraph@9a9340034c7f:~$ exit
  1. Back in your local machine:
docker ps -a | grep tiger
docker commit 9a9340034c7f openc/tigergraph # using the container's tag from the previous command
git rev-parse HEAD # to gt a label for the new image version
docker tag openc/tigergraph docker-registry.opencorporates.com/opencorporates/tigergraph:342e57a75adf0c465025cd827407ee35c1cfb654 # using the label from the previous command
docker push docker-registry.opencorporates.com/opencorporates/tigergraph # will push all your local versions
  1. Edit docker-compose.yml to change the label for the TigerGraph image to your new version
  2. Push and watch your tests go green
@CountCulture

This comment has been minimized.

Copy link

CountCulture commented Dec 23, 2018

Should we maybe also change port 14240 (the Graph studio port)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.