# Can't connect to neo4j server during build

**URL:** <https://discuss.circleci.com/t/cant-connect-to-neo4j-server-during-build/684>\
**Category:** Build Environment\
**Tags:** neo4j\
**Created:** [November 22, 2015, 11:08pm UTC](https://discuss.circleci.com/t/cant-connect-to-neo4j-server-during-build/684 "2015-11-22T23:08:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikemarsian](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/mikemarsian/32/444_2.png) [@mikemarsian](https://discuss.circleci.com/u/mikemarsian)\
**Post date:** [November 22, 2015, 11:08pm UTC](https://discuss.circleci.com/t/cant-connect-to-neo4j-server-during-build/684/1 "2015-11-22T23:08:40Z")

</div>

Hi,  
I have a simple rails app built on top of neo4j db. In my circle.yml I defined the steps needed to set-up neo4j like this:

`database: override: - rake neo4j:install[community-latest,test] - rake neo4j:config[test,7475] - rake neo4j:start[test]`

During build, the db set-up seems to work fine:

> rake neo4j:start[test]  
> Starting Neo4j test…  
> Starting Neo4j Server…WARNING: not changing user  
> process [11935]… waiting for server to be ready… OK.  
> [http://localhost:7475/](http://localhost:7475/) is ready.

But when rspec starts to run, I get the following message:

> connection refused: localhost:7475

When I ssh to the build machine, and take a look at the neo4j logs, I see the following:

> Server started on: [http://localhost:7475/](http://localhost:7475/)  
> Remote interface ready and available at [[http://localhost:7475/](http://localhost:7475/)]  
> — SERVER STARTED END —  
> Neo4j Server shutdown initiated by request

So for some reason, it seems like neo4j is being shut-down before specs are run. If I start neo4j manually on the build machine using `rake neo4j:start[test]`, and run rspec, all works as expected. I tried moving the rake start command to `test->pre` section of `circle.yml`, but that didn’t help.

Any idea what’s going on here?

---

<div class="post-metadata">

**Author:** ![levlaz](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/levlaz/32/36978_2.png) [@levlaz](https://discuss.circleci.com/u/levlaz)\
**Post date:** [November 23, 2015, 5:46pm UTC](https://discuss.circleci.com/t/cant-connect-to-neo4j-server-during-build/684/2 "2015-11-23T17:46:23Z")

</div>

Is [this](https://discuss.circleci.com/t/neo4j-server-authorization-error/692) related?

---

<div class="post-metadata">

**Author:** ![frank](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/frank/32/124_2.png) [@frank](https://discuss.circleci.com/u/frank)\
**Post date:** [November 23, 2015, 7:36pm UTC](https://discuss.circleci.com/t/cant-connect-to-neo4j-server-during-build/684/3 "2015-11-23T19:36:11Z")

</div>

Hi @mikemarsian,

Can you try starting neo4j by including it as a service in your circle.yml? You’ll also need to disable auth as demonstrated [here](https://discuss.circleci.com/t/neo4j-server-authorization-error/692).

tl;dr Add the following to your circle.yml:

```auto
machine:
  pre:
    - sudo sed -i "s|dbms.security.auth_enabled=true|dbms.security.auth_enabled=false|g" /etc/neo4j/neo4j-server.properties
  services:
    - neo4j

```

Cheers,  
Frank

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:37am UTC](https://discuss.circleci.com/t/cant-connect-to-neo4j-server-during-build/684/4 "2018-06-18T11:37:38Z")

</div>


