From 3a915435c50576bb450b395d0505eb642cbc416c Mon Sep 17 00:00:00 2001 From: Matthew Andres Moreno Date: Fri, 16 Feb 2024 23:39:12 -0500 Subject: [PATCH 1/2] Prompt user for potentially-destructive init op --- scripts/init/make_init_data.cypher.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/init/make_init_data.cypher.sh b/scripts/init/make_init_data.cypher.sh index 6598e56..fc2ca69 100755 --- a/scripts/init/make_init_data.cypher.sh +++ b/scripts/init/make_init_data.cypher.sh @@ -24,5 +24,11 @@ CALL apoc.cypher.runMany("MATCH(n) DETACH DELETE n; CREATE (:User {provider: 'google', id: '${USER_ID}', deprecated: false})-[:CONTAINS_DETAILS {from: datetime(), version: 1}]->(:UserDetails {role: 'admin'});", {}); EOF -#cat init_data.cypher | docker exec --interactive phylodb-neo4j sh -c "cypher-shell -u neo4j -p password" +echo "Initialize phylodb-neo4j container with init_data.cypher?" +echo "WARNING: Performs a potentially destructive full delete operation." +read -p "Continue? (y/n):" user_input +if [[ "$user_input" = y* ]]; then + echo "Initializing container with init_data.cypher..." + cat init_data.cypher | docker exec --interactive phylodb-neo4j sh -c "cypher-shell -u neo4j -p password" +fi From cee3aa9050dd6b0da9affe16cef9f076ae908689 Mon Sep 17 00:00:00 2001 From: Matthew Andres Moreno Date: Sat, 17 Feb 2024 00:19:21 -0500 Subject: [PATCH 2/2] Add direct instructions for example --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 75518c1..9224ee1 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,26 @@ The script [`example.sh`](scripts/example/example.sh) illustrates the API use ca It is important that a Google account is registered as admin, and that you have a valid token. Check the initialization step in the [`example.sh`](scripts/example/example.sh) script, and/or the [template for data initialization](scripts/init/init_data.cypher). +To run the example, + + export TOKEN="YOUR_TOKEN" + export USER_ID="YOUR_USER_ID" + git clone https://github.com/phyloviz/phyloDB.git phyloDB.git + cd phyloDB.git/ + sed 's|#spring.data.neo4j.uri=bolt://phylodb-neo4j:7687|spring.data.neo4j.uri=bolt://phylodb-neo4j:7687|g' -i phylodb/bin/main/application.properties + sed 's|spring.data.neo4j.uri=bolt://localhost:7687|#spring.data.neo4j.uri=bolt://localhost:7687|g' -i phylodb/bin/main/application.properties + ./configure.sh + cd docker + ./build-docker.sh + ./start-docker.sh + cd ../scripts/example + echo y | ./example.sh + +To generate `YOUR_TOKEN`, access , sign in, and click 'Authorize +APIs' with the custom scope `https://www.googleapis.com/auth/userinfo.email`. +Click in 'Exchange authorization code for tokens' and use the provided 'Access token'. +Use the account email associated with this token as `YOUR_USER_ID`. + # More documentation The [Wiki](https://github.com/phyloviz/phyloDB/wiki) of this project documents several topics, namely archictecural views, deployment, authentication and API definition (usage).