-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from bmeg/feature/graphql-reader
[WIP] Feature/graphql reader
- Loading branch information
Showing
95 changed files
with
194,637 additions
and
2,035 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,4 +132,6 @@ dmypy.json | |
.idea/ | ||
|
||
# scratch | ||
tmp/ | ||
tmp/ | ||
.DS_Store | ||
gencli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,20 +6,16 @@ ENV PATH="/go/bin:${PATH}" | |
ADD ./ /go/src/github.com/bmeg/grip-graphql | ||
WORKDIR /go/src/github.com/bmeg/grip-graphql | ||
|
||
RUN go install github.com/bmeg/grip@54c6baa9a315aec2c5916ec11116609773bfc9b0 | ||
RUN make all | ||
|
||
RUN go install github.com/bmeg/[email protected] | ||
RUN go build --buildmode=plugin ./graphql_gen3 | ||
RUN go build --buildmode=plugin ./gen3_writer | ||
RUN go build --buildmode=plugin ./grip-graphql-endpoint | ||
|
||
|
||
FROM alpine | ||
WORKDIR /data | ||
VOLUME /data | ||
ENV PATH="/app:${PATH}" | ||
COPY --from=build-env /go/src/github.com/bmeg/grip-graphql/graphql_gen3.so /data/ | ||
COPY --from=build-env /go/src/github.com/bmeg/grip-graphql/gen3_writer.so /data/ | ||
COPY --from=build-env /go/src/github.com/bmeg/grip-graphql/grip-graphql-endpoint.so /data/ | ||
COPY --from=build-env /go/src/github.com/bmeg/grip-graphql/config/gen3.js /data/config/ | ||
COPY --from=build-env /go/src/github.com/bmeg/grip-graphql/mongo.yml /data/ | ||
COPY --from=build-env /go/bin/grip /app/ | ||
#FROM alpine | ||
#WORKDIR /data | ||
#VOLUME /data | ||
#ENV PATH="/app:${PATH}" | ||
#COPY --from=build-env /go/src/github.com/bmeg/grip-graphql/gql-gen.so /data/ | ||
#COPY --from=build-env /go/src/github.com/bmeg/grip-graphql/gen3_writer.so /data/ | ||
#COPY --from=build-env /go/src/github.com/bmeg/grip-graphql/grip-graphql-endpoint.so /data/ | ||
#COPY --from=build-env /go/src/github.com/bmeg/grip-graphql/config/gen3.js /data/config/ | ||
#COPY --from=build-env /go/src/github.com/bmeg/grip-graphql/mongo.yml /data/ | ||
#COPY --from=build-env /go/bin/grip /app/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
|
||
all: grip-graphql-endpoint.so gen3_writer.so grip-graphql-proxy | ||
all: grip-graphql-endpoint.so gen3_writer.so gql-gen.so grip-graphql-proxy | ||
|
||
gen3_writer.so : $(shell find gen3_writer -name "*.go") | ||
go build --buildmode=plugin ./gen3_writer | ||
|
||
grip-graphql-endpoint.so : $(shell find grip-graphql-endpoint -name "*.go") | ||
go build --buildmode=plugin ./grip-graphql-endpoint | ||
|
||
gql-gen.so: $(shell find gql-gen -name "*.go") | ||
go build --buildmode=plugin ./gql-gen | ||
|
||
grip-graphql-proxy : $(shell find cmd/grip-graphql-proxy -name "*.go") | ||
go build ./cmd/grip-graphql-proxy | ||
|
||
graphql_gen3 : $(shell find graphql_gen3 -name "*.go") | ||
go build --buildmode=plugin ./graphql_gen3 | ||
|
||
clean: | ||
rm grip-graphql-proxy grip-graphql-endpoint.so gen3_writer.so | ||
rm grip-graphql-proxy grip-graphql-endpoint.so gen3_writer.so gql-gen.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,24 +5,24 @@ | |
``` | ||
go install github.com/bmeg/grip | ||
go build --buildmode=plugin ./gen3_writer | ||
grip server -w graphql=gen3_writer.so | ||
grip server -w writer=gen3_writer.so | ||
``` | ||
|
||
Note: the -w graphql=gen3_writer.so option can be stacked to include multiple endpoints and long as you have | ||
Note: the -w writer=gen3_writer.so option can be stacked to include multiple endpoints and long as you have | ||
built the .so file to the corresponding endplint as shown above. Ex: | ||
|
||
`grip server -c mongo.yml -w graphql=gen3_writer.so -w reader=grip-graphql-endpoint.so -l reader:config=./config/gen3.js -l reader:graph=CALIPER` | ||
`grip server -c mongo.yml -w writer=gen3_writer.so -w reader=grip-graphql-endpoint.so -l reader:config=./config/gen3.js -l reader:graph=CALIPER` | ||
|
||
## Example queries: | ||
|
||
Note: ENV var ACCESS_TOKEN is a valid Gen3 jwt token. An access token is needed for all queries except GET \_status and GET list-graphs | ||
|
||
### Delete an edge and then grep for it to see if it has been deleted or not. Format: | ||
|
||
_http://localhost:8201/graphql/[graph-name]/del-edge/[edge-id]/[gen3-project-id]_ | ||
_http://localhost:8201/writer/[graph-name]/del-edge/[edge-id]/[gen3-project-id]_ | ||
|
||
``` | ||
curl -X DELETE http://localhost:8201/graphql/CALIPER/del-edge/fb60e763-e799-4d59-82a3-66977cc6696c/ohsu-test | ||
curl -X DELETE http://localhost:8201/writer/CALIPER/del-edge/fb60e763-e799-4d59-82a3-66977cc6696c/ohsu-test | ||
-H "Content-Type: applicationjson" \ | ||
-H "Authorization: bearer $ACCESS_TOKEN" | ||
|
@@ -31,10 +31,10 @@ grip query CALIPER "E()" | grep fb60e763-e799-4d59-82a3-66977cc6696c | |
|
||
### Bulk load some edges from a file: | ||
|
||
_http://localhost:8201/graphql/[graph-name]/bulk-load/[gen3-project-id]_ | ||
_http://localhost:8201/writer/[graph-name]/bulk-load/[gen3-project-id]_ | ||
|
||
``` | ||
curl -X POST "http://localhost:8201/graphql/CALIPER/bulk-load/ohsu-test" \ | ||
curl -X POST "http://localhost:8201/writer/CALIPER/bulk-load/ohsu-test" \ | ||
-H "Authorization: bearer $ACCESS_TOKEN" \ | ||
-F "types=edge" \ | ||
-F "[email protected]" | ||
|
@@ -55,48 +55,25 @@ With required keys "label", "from", "to", and "gid" and optional key "data" with | |
|
||
### Get the data from a vertex given a known vertex id | ||
|
||
_http://localhost:8201/graphql/[graph-name]/get-vertex/[vertex-id]/[gen3-project-id]_ | ||
_http://localhost:8201/writer/[graph-name]/get-vertex/[vertex-id]/[gen3-project-id]_ | ||
|
||
``` | ||
curl -X GET http://localhost:8201/graphql/CALIPER/get-vertex/875ddaf8-42da-5d72-b5c5-39c2b16151cd/ohsu-test \ | ||
curl -X GET http://localhost:8201/writer/CALIPER/get-vertex/875ddaf8-42da-5d72-b5c5-39c2b16151cd/ohsu-test \ | ||
-H "Authorization: bearer $ACCESS_TOKEN" | ||
``` | ||
|
||
### Get the list of graphs present | ||
|
||
``` | ||
curl http://localhost:8201/graphql/list-graphs | ||
curl http://localhost:8201/writer/list-graphs | ||
``` | ||
|
||
### Revproxy Setup -- | ||
|
||
The above curl commands assume that you are acessing this grip plugin from within the cluster. equivalent queries can be used from outside the cluster by changing the nginx paths to the form: | ||
|
||
`https://[your_instance_endpoint]/grip/writer/graphql/list-graphs` for the writer or | ||
`https://[your_instance_endpoint]/grip/writer/writer/list-graphs` for the writer or | ||
`https://[your_instance_endpoint]/grip/reader` for the reader api | ||
|
||
These paths assume you have checked out to the grip branch of helm and reployed | ||
|
||
## Tests: | ||
|
||
Tests can be run locally by specifying that you want to turn on the plugin in testing mode using the `TEST` Graph. For example: | ||
|
||
``` | ||
grip server -w graphql=gen3_writer.so \ | ||
-w reader=grip-graphql-endpoint.so \ | ||
-l reader:config=./config/gen3.js \ | ||
-l reader:graph=TEST \ | ||
-l graphql:test=true \ | ||
-l reader:test=true | ||
``` | ||
|
||
then cd to gen3_writer directory and run: | ||
|
||
`go test` or `go test -v` for logs or `go test -run [specific_test_name]` to run only a specific test | ||
|
||
If the graph name is `TEST` and the config is setup for test=true, mock auth will be used, and these tests can be run locally outside of a gen3 instance. | ||
|
||
## Version | ||
|
||
go version go1.22.6 |
1 change: 0 additions & 1 deletion
1
gen3_writer/fixtures/combio-examples-grip/DocumentReference.in.edge.json
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
gen3_writer/fixtures/combio-examples-grip/DocumentReference.out.edge.json
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
gen3_writer/fixtures/combio-examples-grip/DocumentReference.vertex.json
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
gen3_writer/fixtures/combio-examples-grip/Specimen.in.edge.json
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
gen3_writer/fixtures/combio-examples-grip/Specimen.out.edge.json
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.