Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11/07 graph-explorer #1

Merged
merged 15 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# syntax=docker/dockerfile:1
FROM amazonlinux:2
WORKDIR /
COPY . /neptune-graph-explorer/
WORKDIR /neptune-graph-explorer
RUN yum install -y curl
RUN curl -sL https://rpm.nodesource.com/setup_16.x | bash -
RUN yum install -y nodejs
RUN node --version
RUN npm install -g pnpm
RUN pnpm install
ENV HOME=/neptune-graph-explorer
EXPOSE 5173
EXPOSE 8182
CMD ["pnpm", "dev"]
72 changes: 64 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,73 @@
## My Project
# Neptune Graph Explorer
Open source version for the Neptune Graph Explorer powered by Expero Connected.

TODO: Fill this README out!
## Supported Graph Types
- Labelled Property Graph (LPG) using Gremlin
- Resource Description Framework (RDF) using SPARQL

Be sure to:
### Requirements
- pnpm >=7.9.3
- node >=16.15.1

* Change the title in this README
* Edit your repository description on GitHub
### Run in development mode
- `pnpm i`
- `pnpm start`

## Security
### Build for production
- `pnpm i`
- `pnpm build:prod`
- `dist` folder is created in the client directory.
- Serve the static site using the method of your choice,
for example, using `serve` npm package.

See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
### Environment variables
- `REACT_APP_ENV_ROOT_FOLDER`: Base folder for the public files. By default, `/` (`string`).
- `REACT_APP_STORE_ID`: IndexedDB store identifier, By default, `cge` (`string`).
- `REACT_APP_STORE_NAME`: IndexedDB store name. By default, `default` (`string`).
- `REACT_APP_STORE_VERSION`: IndexedDB store version. By default, `1.0` (`number`).
- `REACT_APP_CONNECTION_URL`: Default connection to Neptune instance. Blank by default (`string`).
- `REACT_APP_CONNECTION_ENGINE`: Default connection query engine work with the Neptune instance.
By default, `gremlin` (`gremlin` or `sparql`).
- `REACT_APP_AWS_AUTH_REQUIRED`: Enable authenticated requests. By default, `false` (`boolean`).
- `REACT_APP_AWS_REGION`: AWS region of your Neptune instance. By default `us-east-1` (`string`).
- `REACT_APP_AWS_SERVICE`: Neptune service name. By default `neptune-db` (`string`).
- `REACT_APP_AWS_CLUSTER_HOST`: Internal Neptune host to sign requests (`string`).
- `PROXY_SERVER_CONNECTION_URL`: Proxy server url.

### Docker Instructions
- To build the image, `docker build -t neptune-graph-explorer .` from the root directory.
- To run the image in a container, run
`docker run -dit -p 5173:5173 -p 8182:8182 --name {container_name} neptune-graph-explorer`.

### Connecting to Gremlin-Server
- Change the channelized type in the configuration file (`/conf/gremlin-server.yaml` by default) being used to support HTTP (ex. org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer)
- Remove “.withStrategies(ReferenceElementStrategy)” from `/scripts/generate-modern.groovy` so that properties are returned.
- Change `gremlin.tinkergraph.vertexIdManager` and `gremlin.tinkergraph.edgeIdManager` in `/conf/tinkergraph-empty.properties` to support string ids.
- Build and run the docker container as normal, substituting the url to access your gremlin-server in the `REACT_APP_CONNECTION_URL` env variable.

### Connecting to BlazeGraph
- Build and run the docker container as normal and connect to BlazeGraph through the proxy server.

### Using the Proxy Server
- Set `PROXY_SERVER_CONNECTION_URL` to the url that accesses your database. If needed you can change the port inside `node-server.js`.
- Set `REACT_APP_CONNECTION_URL` to the url that accesses your proxy server.

### Using Auth
- To use auth, you must run requests through the proxy server. This is where your credentials are resolved and the signing logic is.
- You should ensure that your environment has access to neptune (Read privileges needed, see NeptuneReadOnlyAccess managed policy) and can ideally make HTTPS requests to the private endpoint. (To confirm, you can try a curl to the neptune endpoint)
- For further information on how to properly have credentials resolved, refer to this documentation: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CredentialProviderChain.html

## License
Copyright 2022 Expero Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

This project is licensed under the Apache-2.0 License.
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
19 changes: 19 additions & 0 deletions bitbucket-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
image: cypress/browsers:node16.17.0-chrome106
definitions:
caches:
pnpm: $BITBUCKET_CLONE_DIR/.pnpm-store
pipelines:
pull-requests:
"**": # this runs as default for any branch not elsewhere defined
- step:
size: 2x
name: Build for development
caches:
- node
- pnpm
script:
- cd packages/client
- curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@7
- cat .pipelines.npmrc >> .npmrc
- pnpm install
- pnpm build:dev
45 changes: 45 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "@expero/neptune-cge",
"version": "1.0.0-pre",
"description": "Neptune Graph Explorer powered by Expero Connected",
"packageManager": "[email protected]",
"engines": {
"node": ">=16.15.1"
},
"scripts": {
"prepare": "husky install",
"precommit": "lint-staged && pnpm types:check",
"lint": "pnpm -F @expero/neptune-graph-explorer lint",
"format": "pnpm -F @expero/neptune-graph-explorer format",
"test": "pnpm -F @expero/neptune-graph-explorer test",
"types:check": "pnpm -F @expero/neptune-graph-explorer types:check",
"start": "pnpm -F @expero/neptune-graph-explorer start",
"build:dev": "pnpm -F @expero/neptune-graph-explorer build:dev",
"build:prod": "pnpm -F @expero/neptune-graph-explorer build:prod",
"start:proxy-server": "pnpm -F @expero/neptune-proxy-server start",
"dev": "concurrently \"pnpm start:proxy-server\" \"pnpm start\""
},
"author": {
"name": "Expero Inc.",
"url": "https://www.experoinc.com"
},
"license": "Apache-2.0",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.41.0",
"concurrently": "^7.5.0",
"eslint": "^7.32.0",
"eslint-plugin-react": "^7.31.10",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.0",
"lint-staged": "^13.0.3",
"prettier": "2.1.2",
"typescript": "^4.8.4"
},
"lint-staged": {
"*.{ts,tsx}": [
"eslint --fix",
"prettier --write"
]
}
}
9 changes: 9 additions & 0 deletions packages/client/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
REACT_APP_STORE_ID=neptune-cge
REACT_APP_STORE_NAME=neptune-cge
REACT_APP_STORE_VERSION=1.0
REACT_APP_CONNECTION_URL=
REACT_APP_AWS_AUTH_REQUIRED=false
REACT_APP_AWS_REGION=
REACT_APP_AWS_SERVICE=neptune-db
REACT_APP_AWS_CLUSTER_HOST=
PROXY_SERVER_CONNECTION_URL=
9 changes: 9 additions & 0 deletions packages/client/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
REACT_APP_STORE_ID=neptune-cge
REACT_APP_STORE_NAME=neptune-cge
REACT_APP_STORE_VERSION=1.0
REACT_APP_CONNECTION_URL=
REACT_APP_AWS_AUTH_REQUIRED=false
REACT_APP_AWS_REGION=
REACT_APP_AWS_SERVICE=neptune-db
REACT_APP_AWS_CLUSTER_HOST=
PROXY_SERVER_CONNECTION_URL=
43 changes: 43 additions & 0 deletions packages/client/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* About ESLint configuration:
* react-app extends from ESLint Recommended:
* https://github.com/eslint/eslint/blob/master/conf/eslint-recommended.js
* react-app definition: https://github.com/facebook/create-react-app/blob/master/.eslintrc.json
*/
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"plugin:react/jsx-runtime"
],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint"],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"react-hooks/exhaustive-deps": "error",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"react/prop-types": "off",
"@typescript-eslint/no-empty-function": "off",
"react/display-name": "off",
"no-console": ["error", { "allow": ["warn", "error"] }]
},
"settings": {
"react": {
"version": "17"
}
}
}
2 changes: 2 additions & 0 deletions packages/client/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
auto-install-peers=true
engine-strict=true
1 change: 1 addition & 0 deletions packages/client/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16
2 changes: 2 additions & 0 deletions packages/client/.pipelines.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
workspace-concurrency = 1
child-concurrency = 2
3 changes: 3 additions & 0 deletions packages/client/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
node_modules/
dist/
14 changes: 14 additions & 0 deletions packages/client/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"arrowParens": "avoid",
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"proseWrap": "always",
"quoteProps": "as-needed",
"semi": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"singleQuote": false,
"bracketSpacing": true,
"printWidth": 80
}
6 changes: 6 additions & 0 deletions packages/client/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
presets: [
"@babel/preset-env",
["@babel/preset-react", { runtime: "automatic" }],
],
};
37 changes: 37 additions & 0 deletions packages/client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%REACT_APP_ENV_ROOT_FOLDER%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Neptune Graph Explorer powered by Expero Connected"
/>
<link rel="apple-touch-icon" sizes="180x180" href="%REACT_APP_ENV_ROOT_FOLDER%/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="%REACT_APP_ENV_ROOT_FOLDER%/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="%REACT_APP_ENV_ROOT_FOLDER%/favicon-16x16.png">
<link rel="mask-icon" href="%PUBLIC_URL%/safari-pinned-tab.svg" color="#FFFFFF">
<meta name="theme-color" content="#ffffff">
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%REACT_APP_ENV_ROOT_FOLDER%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Neptune Graph Explorer</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
9 changes: 9 additions & 0 deletions packages/client/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { Config } from "jest";

const config: Config = {
verbose: true,
preset: "ts-jest",
testEnvironment: "jsdom",
};

export default config;
Loading