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

config neo4j in docker-compose.yml? #12

Open
alexw668 opened this issue Sep 1, 2015 · 5 comments
Open

config neo4j in docker-compose.yml? #12

alexw668 opened this issue Sep 1, 2015 · 5 comments

Comments

@alexw668
Copy link

alexw668 commented Sep 1, 2015

Hi,

I am new to Docker. I have a Rails app that uses Neo4j graph database, and I would like to run this app in docker. I'd want to use a docker-compose.yml to have two services, one is neo4j and the other is web that links to neo4j. In neo4j service part, I would like to use the neo4j image you created (and hosted in Docker Hub):

neo4j:
image: tpires/neo4j
ports:
- "7474:7474"
....

web:
build .
...
links:
- neo4j

I'd want to run the neo4j image with authentication enabled and a username/password set, just like what you mentioned:

docker run -i -t -d -e NEO4J_AUTH=username:password --name neo4j --cap-add=SYS_RESOURCE -p 7474:7474 tpires/neo4j

How would I do it from within my docker-compose.yml? If neo4j's authentication can't be set in docker-compose.yml, where can I do it?

Thanks for your any input.

Alex

@tpires
Copy link
Owner

tpires commented Sep 1, 2015

Hi @alexw668

You can see here the reference for environmental variable on docker-compose.yml .

For you case you could either add:

neo4j:
image: tpires/neo4j
environment:
 - NEO4J_AUTH: username:password
cap_add:
 - SYS_RESOURCE
ports:
- "7474:7474"

Or create a env file, .env and:

neo4j:
image: tpires/neo4j
env_file: .env
cap_add:
 - SYS_RESOURCE
ports:
- "7474:7474"

And your .env file would be:

NEO4J_AUTH=username:password

TP

@alexw668
Copy link
Author

alexw668 commented Sep 1, 2015

Thanks for your help! I got it running in a docker container! Since I expose the 7474 port to my host (a MacBook Pro), I thought I should be able to browse my database from the browser; I used boot2docker ip to get the host's IP (192.168.59.103), and went http://192.168.59.103:7474, but I got webpage not available response. I remember read it somewhere that with OS X one has to do something for for it to work, but I forget where. Do you have any idea on this?

Again, I appreciate your any help.

Alex

@alexw668
Copy link
Author

alexw668 commented Sep 1, 2015

Another question for you, if you don't mind. When I ran both services (neo4j and web) in docker, I saw that my Rails app cannot connect to the neo4j database with the username/password I set in NEO4J_AUTH. Looking at your shell script (build_auth_string.sh) that creates the auth file (under data/dbms), it starts with the user name I set. Looking at the auth file in our other neo4j instance, it always starts with neo4j even though the user name we set is not neo4j. Is it possible that the auth file created by the script is not in the format neo4j demands?

Thanks.
Alex

@Joshfindit
Copy link

Quick note: In neo4jrb/activegraph#949, it's mentioned that the environment variable of choice is NEO4J_URL (which is the entire URL, including username/pass)

@maurice1er
Copy link

define Neo4j password with docker-compose

neo4j:
   image: 'neo4j:4.1'
   environment:
      NEO4J_AUTH: 'neo4j/your_password'
   ports:
      - "7474:7474"
   volumes:
      ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants