Skip to content

badochov/distributed-shortest-path

Repository files navigation

distributed-shortest-path

Project calculating shortest path in a distributed graph.

Local development

Dependencies:

  • Go
  • kind
    • other local version of kubernetes such as minikube may be used, but then you're on your own with setting up the cluster and uploading docker images to it.
  • kubectl
  • docker

Initialization

  1. Setup cluster: kind create cluster --config cluster/local-kind-cluster.yaml
  2. Generate docker images for manager and worker.
      ./src/services/worker/new_version.sh 0.0.1
      ./src/services/manager/new_version.sh 0.0.1
  3. ./cluster/deploy.sh --local

Querying manager

Inspired by this guide. 1.

Uploading OSM map

./import_graph.sh

Updates

Manager

./update_manager.sh <VERSION>

Workers

./update_workers.sh <VERSION>

DB Schema

  1. Update models in src/libs/db/model.
  2. If new models are added adjust the list in src/libs/db/models/list.go.
  3.  (cd src && go generate)
  4. If new models are added adjust the list in func (c*Cleaner) getAllTables() in src/libs/db/cleaner/cleaner.go.

Cleaning postgres

./clean_postgres.sh

GRPC proto

  1. Update grpc proto in src/services/worker/link/proto/link.proto.
  2.  (cd src && go generate)

Manual connecting to Postgres:

kubectl run postgresql-dev-client --rm --tty -i --restart='Never' --namespace postgres --image docker.io/bitnami/postgresql:14.1.0-debian-10-r80 --env="PGPASSWORD=psltest" \
--command -- psql --host postgres -U admin -d postgresdb -p 5432

Sending requests to Manager running on kind:

  1. Setup
    ./setup_curl_container.sh
  2. Performing requests:
    • RecalculateDS

      ./curl.sh /recalculate_ds
    • ShortestPath

      ./curl.sh /shortest_path -H "Content-Type: application/json"  -d '{"from":21911863, "to":21911883}'

About

Project calculating shortest path in a distributed graph.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published