Auth issue for manually installed neo4j instance (>v2.2.2)

neo4j

#1

Hi there,

I’d like to use a more recent version of neo4j than the default neo4j2.2.2 which is installed by specifying:

machine:
  services:
    neo4j

I am manually installing a newer version of neo4j using:


machine:
  environment:
    NEO4J_VERSION:
      "2.2.3"
  post:
    - wget dist.neo4j.org/neo4j-community-$NEO4J_VERSION-unix.tar.gz
    - tar -xzf neo4j-community-$NEO4J_VERSION-unix.tar.gz
    - neo4j-community-$NEO4J_VERSION/bin/neo4j start

Neo4j starts ok, so far so good!

Now to authenticate against neo4j, we either need to create a default user and
define a password or turn off authentication. Neither works for me.

Option 1: Turn off authentication in neo4j-server.properties:

(I found this method here: Neo4j Server Authorization Error).

Prior to the neo4j start command, turn off the auth_enabled:

  - sudo sed -i "s|dbms.security.auth_enabled=true|dbms.security.auth_enabled=false|g" neo4j-community-$NEO4J_VERSION/conf/neo4j-server.properties

Neo4j starts without auth, so connections to http://localhost:7474 should succeed.
Instead I get:

httpstream: INFO: > GET http://localhost:7474/
httpstream: DEBUG: > User-Agent: py2neo/2.0.3 HTTPStream/1.5.0 Python/3.5.0-final-0 (linux)
httpstream: DEBUG: > Host: localhost:7474
httpstream: DEBUG: > X-Stream: true
httpstream: ERROR: ! SocketError: Connection refused

(I’m using py2neo to connect).

Option 2: Create a default user in neo4j, and tests can use that user to authenticate:

I have a separate executable script which creates the user, then sets its password:

#!/usr/bin/env bash
curl -X GET http://localhost:7474/user/neo4j --user neo4j:neo4j -H Accept:application/json -H Content-Type:application/json
curl -X POST http://localhost:7474/user/neo4j/password --user neo4j:neo4j -H Accept:application/json -H Content-Type:application/json -d "{\"password\": \"pass\"}"

The script is run in the machine.post step in circle.yml.
Once configured the tests should be able to authenticate using http://neo4j:pass@localhost:7474.
Unfortunately the curl requests fail with:

curl -X GET http://localhost:7474/user/neo4j --user neo4j:neo4j -H Accept:application/json -H Content-Type:application/json
curl: (7) couldn't connect to host
curl -X POST http://localhost:7474/user/neo4j/password --user neo4j:neo4j -H Accept:application/json -H Content-Type:application/json -d "{'password': 'pass'}"

./configure_neo4j_default_user.sh returned exit code 7

curl: (7) couldn't connect to host Action failed: ./configure_neo4j_default_user.sh

If I fall back and use the CircleCI default neo4j rather than manually installing, methods 1 and 2 both work. They both also work when run against a local (as in, on my laptop) install of neo4j.

Any ideas why they’d fail when run against the manual install neo4j in CircleCI?

Thanks for any help,
Craig


#2

+1
neo has just released v3 with a number of critical improvements: http://neo4j.com/news/introducing-neo4j-3-0/


#3