assimilation / assimilation-official

This is the official main repository for the Assimilation project
51 stars 9 forks source link

adding extra config to neo4j docker #46

Closed borgified closed 6 years ago

borgified commented 6 years ago

this last fail is due to the way neokit.GraphServer is coded. it would work if we installed neo4j but since it is inside a docker container, it cannot just look at the files inside without some docker commands. i considered copying the files out of the container using "docker cp" into some temp directory and let that method search there but that felt too much of a hack on top of their hack.

i dont know enough python to override the behavior of neokit.GraphServer with something more appropriate for docker flavored neo4js. perhaps even just hardcoding the neo4j server version since that's a known value since we explicitly pull that image off dockerhub.

______________________ ERROR collecting tests/cma_test.py ______________________
tests/cma_test.py:1460: in <module>
    TestFoo.config_foo()
/usr/local/lib/python2.7/dist-packages/inject.py:336: in injection_wrapper
    additional_args.append(instance(params[arg_name]))
/usr/local/lib/python2.7/dist-packages/inject.py:143: in instance
    return get_injector_or_die().get_instance(cls)
/usr/local/lib/python2.7/dist-packages/inject.py:239: in get_instance
    return binding()
/usr/local/lib/python2.7/dist-packages/inject.py:276: in __call__
    self._instance = self._constructor()
/usr/local/lib/python2.7/dist-packages/inject.py:347: in injection_wrapper
    return func(*args, **kwargs)
cmainit.py:248: in setup_db
    neocredentials.authenticate(hostport)
cmainit.py:141: in authenticate
    self.update()
cmainit.py:115: in update
    server = neokit.GraphServer(home=self.install_dir)
/usr/local/lib/python2.7/dist-packages/neokit.py:314: in __new__
    kernel_jars = [f for f in listdir(lib)
E   OSError: [Errno 2] No such file or directory: '/usr/share/neo4j/lib'
Alan-R commented 6 years ago

I can't recall - but I might use neokit for some other things. Let me look at the code... Looks like I also use it to change passwords. I do that when it's first installed also. I'll send an inquiry about how I'm supposed to do this if it's remote... I could also just deal with the failure and assume everything is OK if the call fails...

Alan Robertson alanr@unix.sh

On Sat, Oct 28, 2017, at 03:09 AM, borgified wrote:

this last fail is due to the way neokit.GraphServer[1] is coded. it would work if we installed neo4j but since it is inside a docker container, it cannot just look at the files inside without some docker commands. i considered copying the files out of the container using "docker cp" into some temp directory and let that method search there but that felt too much of a hack on top of their hack.> i dont know enough python to override the behavior of neokit.GraphServer with something more appropriate for docker flavored neo4js. perhaps even just hardcoding the neo4j server version since that's a known value since we explicitly pull that image off dockerhub.

__ ERROR collecting tests/cma_test.py __ tests/cma_test.py:1460: in TestFoo.config_foo() /usr/local/lib/python2.7/dist- packages/inject.py:336: in injection_wrapper additional_args.append(instance(params[arg_name])) /usr/local/lib/python2.7/dist- packages/inject.py:143: in instance return get_injector_or_die().get_instance(cls) /usr/local/lib/python2.7/dist- packages/inject.py:239: in get_instance return binding() /usr/local/lib/python2.7/dist- packages/inject.py:276: in call self._instance = self._constructor() /usr/local/lib/python2.7/dist- packages/inject.py:347: in injection_wrapper return func(*args, **kwargs) cmainit.py:248: in setup_db neocredentials.authenticate(hostport) cmainit.py:141: in authenticate self.update() cmainit.py:115: in update server = neokit.GraphServer(home=self.install_dir) /usr/local/lib/python2.7/dist- packages/neokit.py:314: in new kernel_jars = [f for f in listdir(lib) E OSError: [Errno 2] No such file or directory: '/usr/share/neo4j/lib'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub[2], or mute the thread[3].>

Links:

  1. http://py2neo.org/v3/neokit.html#neokit.GraphServer
  2. https://github.com/assimilation/assimilation-official/pull/46#issuecomment-340162906
  3. https://github.com/notifications/unsubscribe-auth/ABM0o1yWBwPgnzShUqsG7gBZykxjMNEbks5swu9QgaJpZM4QJ1Wv
Alan-R commented 6 years ago

I've been working forward on this independently of your change, so I'll close this request. I've created a py2neo issue on this item: neokit assumes locally-installed server - cannot work otherwise #640

borgified commented 6 years ago

can this one work in its place? i think it can also change neo4j password

Alan-R commented 6 years ago

It's a totally different API. I think I'd have to rewrite all my code...

borgified commented 6 years ago

how about other options like:

  1. change password via docker container. i can pass ENV to say what the password should be (it spins up the container with that password already set) or
  2. curl -H "Content-Type: application/json" -X POST -d '{"password":"hello"}' -u neo4j:neo4j http://localhost:7474/user/neo4j/password

i tried this on my local neo4j docker and it worked

Alan-R commented 6 years ago

Either one is fine for this. You might run into the code wanting to change the password. It needs to have the password stored in /usr/share/assimilation/crypto.d/neo4j_auth (or something like that). If you do both of those, then that should get the tests limping along. I still want them to fix the issue I pointed out...

Alan Robertson alanr@unix.sh

On Sat, Oct 28, 2017, at 10:45 AM, borgified wrote:

how about other options like:

  1. change password via docker container. i can pass ENV to say what the password should be (it spins up the container with that password already set) or
  2. curl -H "Content-Type: application/json" -X POST -d '{"password":"hello"}' -u neo4j:neo4j http://localhost:7474/user/neo4j/password> i tried this on my local neo4j docker and it worked

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub[1], or mute the thread[2].>

Links:

  1. https://github.com/assimilation/assimilation-official/pull/46#issuecomment-340204094
  2. https://github.com/notifications/unsubscribe-auth/ABM0ow6AAlEOmOrvR3H3Nj1h1Wd7wX7Lks5sw1obgaJpZM4QJ1Wv