I’m trying to use the Neo4j Docker image in CircleCI. See the config for CircleCI at the bottom. In short, the primary container connects to the database in the secondary container.
The primary container runs as it should.
CircleCI is able to start up the neo4j
container, but fails before the database is finished initializing. Below is the log from Neo4j, taken from CircleCI. The Build was canceled
message comes from CircleCI, not from Neo4j.
[INFO tini (7)] Spawned child process '/docker-entrypoint.sh' with pid '12'
Directories in use:
home: /var/lib/neo4j
config: /var/lib/neo4j/conf
logs: /logs
plugins: /var/lib/neo4j/plugins
import: /var/lib/neo4j/import
data: /var/lib/neo4j/data
certificates: /var/lib/neo4j/certificates
run: /var/lib/neo4j/run
Starting Neo4j.
Build was canceled
For reference, the log when the database is fully running is shown below.
Directories in use:
home: /var/lib/neo4j
config: /var/lib/neo4j/conf
logs: /logs
plugins: /var/lib/neo4j/plugins
import: /var/lib/neo4j/import
data: /var/lib/neo4j/data
certificates: /var/lib/neo4j/certificates
run: /var/lib/neo4j/run
Starting Neo4j.
2020-09-03 15:32:32.624+0000 INFO Starting...
2020-09-03 15:32:35.455+0000 INFO ======== Neo4j 4.1.1 ========
2020-09-03 15:32:38.003+0000 INFO Initializing system graph model for component 'security-users' with version -1 and status UNINITIALIZED
2020-09-03 15:32:38.035+0000 INFO Setting up initial user from defaults: neo4j
2020-09-03 15:32:38.036+0000 INFO Creating new user 'neo4j' (passwordChangeRequired=true, suspended=false)
2020-09-03 15:32:38.062+0000 INFO Setting version for 'security-users' to 2
2020-09-03 15:32:38.080+0000 INFO After initialization of system graph model component 'security-users' have version 2 and status CURRENT
2020-09-03 15:32:38.096+0000 INFO Performing postInitialization step for component 'security-users' with version 2 and status CURRENT
2020-09-03 15:32:38.753+0000 INFO Bolt enabled on 0.0.0.0:7687.
2020-09-03 15:32:39.954+0000 INFO Remote interface available at http://localhost:7474/
2020-09-03 15:32:39.955+0000 INFO Started.
I obtained the log above by running the command below, which is the same command as in the CircleCI config.
sudo docker run --entrypoint /bin/bash neo4j -c "/sbin/tini -g -s -v -- /docker-entrypoint.sh neo4j"
Neo4j Docker image
The Dockerfile
for Neo4j v4.1.1 community edition can be found here: https://github.com/neo4j/docker-neo4j-publish/blob/master/4.1.1/community/Dockerfile
This Dockerfile is where I got the command to start up the database. CircleCI messes up some things in Docker images, like entrypoint.
I tried adding various environment variables to the CircleCI config, found in the Dockerfile above, such as the NEO4J_HOME
variable. This did not help.
CircleCI config
version: 2.1
jobs:
build-and-test:
docker:
# Primary container image where all commands run
- image: olavurmortensen/pedgraph
environment:
NEO4J_URI: bolt://localhost:7687
# Service container image available at `host: localhost`
- image: neo4j
entrypoint: /bin/bash
command: -c "/sbin/tini -g -s -v -- /docker-entrypoint.sh neo4j"
environment:
# No user/password needed to connect to DB.
NEO4J_AUTH: none
TINI_VERBOSITY: 3
# This environment variable doesn't help.
#NEO4J_HOME: /var/lib/neo4j
working_directory: /pedgraph
steps:
- run:
command: python pedgraph/test/test.py
name: Test
workflows:
main:
jobs:
- build-and-test
EDIT:
I also posted this on StackOverflow but it didn’t get much traffic. I’m not allowed to post more than two links here, but it can be found by searching in StackOverflow: neo4j-docker-container-stops-during-circleci-build-build-was-canceled