Giter Site home page Giter Site logo

nginx-server-neo4j-graph-db's Introduction

NGINX Server for NEO4J Graph DB

Nginx server for NEO4J Graph Database and NEO4J REST API

Configuration directions

Do this prior to running the container command:

  • Open up ports on your servers firewall that match nginx.conf and docker-compose file(s) if needed ~~- Change <hostname> in nginx.conf to your hostname.
  • Create a folder named ssl inside ./nginx folder, & generate SSL certs:
    • Open the command line and run these commands inside the ssl folder to generate a self signed certificate:

      openssl req -new -newkey rsa:4096 -x509 -sha512 -days 365 -nodes -out nginx.crt -keyout nginx.key

    • Generate the DH Params: With Forward Secrecy, if an attacker gets a hold of the server's private key, it will not be able to decrypt past communications. The private key is only used to sign the DH handshake, which does not reveal the pre- master key. Diffie-Hellman ensures that the pre-master keys never leave the client and the server, and cannot be intercepted by a MITM. This takes bout 3-5 min to generate:

      openssl dhparam -out dhparam.pem 4096

  1. Go into the root folder and run:

docker-compose up -d --build

  1. https is avail on:

https://<hostname>/browser/ or https://localhost/browser


Access REST API

Get service root The service root is your starting point to discover the REST API. It contains the basic starting points for the database, and some version and extension information.

Example request:

  ### Graph DB REST API Route & header info.
  url = "http://localhost:7474/db/data/transaction/commit"
 
  # Base64 encode user:pass with colon, this example uses 
  # neo4j:superpassword must change in Neo4J admin first.
  headers = {
      'Content-Type': 'application/json',
      'Accept': 'application/json;charset=UTF-8',
      'Authorization': 'Basic ' + 'bmVvNGo6c3VwZXJwYXNzd29yZA=='
  }

  ### CQL - Cypher Query Language to $POST meta objects to graph structure, with student example
  create_student = {
      "statements": [
          {
              "statement":'MERGE (student:Student { student_id:"' + str(student["id"]) +'"})' +
                          'MERGE (teacher:Teacher { classroom_graph: "classroom" })' +
                          'MERGE (teacher)-[:STUDENT_TEACHER]->(student)' +
                          'RETURN student, teacher'
          }
      ]

  }
  r = requests.request("POST", url, data=json.dumps(create_student), headers=headers, verify=False)

Addt'l documentation on the REST API can be found here: https://neo4j.com/docs/rest-docs/3.5/


Add Addt'l users

1. Add a user

The following commands can be entered inside the NEO4J UI where you eneter your Cypher queries.

  1. The following example creates a user with the username 'johnsmith' and password 'h6u4%kr'. When the user 'johnsmith' logs in for the first time, he will be required to change his password.

CALL dbms.security.createUser('johnsmith', 'h6u4%kr', true)

2. Delete a user

The following example deletes a user with the username 'janebrown'.

CALL dbms.security.deleteUser('janebrown')

nginx-server-neo4j-graph-db's People

Contributors

daddydrac avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.