verdverm / neo4j-tutorials

Neo4j tutorials translated into Go & neoism
MIT License
13 stars 3 forks source link

Use env DOCKER_HOST #1

Open azr opened 10 years ago

azr commented 10 years ago

Hello there,

Thanks for the tutorial, I'm learning on it right now !

On a mac we have to use boot2docker which says the following

To connect the Docker client to the Docker daemon, please set: export DOCKER_HOST=tcp://192.168.59.103:2375

If set then I think it should be used Here :)

Cheers !

ps: it also panicks because it assumes the container already exists

Removing Neo4j container
panic: No such container: neo4j

By the way, why using docker ??

azr commented 10 years ago

Huah I just replaced RemoveNeo4jDB() by the following code, I was too lazy to fix all the docker pbms relative to a mac.

func RemoveNeo4jDB() {
    deleteDB := `
        MATCH (n)
        OPTIONAL MATCH (n)-[r]-()
        DELETE n,r
    `

    db, _ := neoism.Connect(neo4jHost)
    cq0 := neoism.CypherQuery{Statement: deleteDB}
    db.Cypher(&cq0)

    return
verdverm commented 10 years ago

@Azer- You are welcome

I'm using endpoint as a "DOCKER_HOST". I have both a local and remote registry and prefer not to change environment variables system wide to use both registries.

I used Docker because I have to deploy to different systems and this eases it. I've generally become very fond of Docker after several instances of easing my life.

I remove neo4j with docker because there can be relationship data that doesn't get removed properly in the DB with the code you show. This is probably not the case currently, but hedges against in the long-term. One can also just delete the actual data file for neo4j.