Skip to content

Startup can fail if mongo server, database, and replica aren't available #4745

@focusaurus

Description

@focusaurus

This issue is the same as reaction-platform issue 16, but since it's really a problem within the reaction codebase, I'm filing this here so we can track it with our normal process.

Issue Description

After running make from the clean reaction-platform folder, the created containers reaction_reaction_1, reaction_mongo-init-replica_1 and reaction-hydra_hydra-migrate_1 show as exited.

The reaction container fails, as it can't connect to the replica set:
docker logs -f reaction_reaction_1

npm WARN [email protected] requires a peer of react-dom@^15.4.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^15.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-dom@^15.3 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

up to date in 18.481s
ERROR: MongoDB replica set not ready in time.
no replset config has been received..%

The replica set fails to connect to the main mongo container:
docker logs -f reaction_mongo-init-replica_1

MongoDB shell version v3.6.3
connecting to: mongodb://mongo:27017/reaction
2018-10-04T11:25:18.048+0000 W NETWORK  [thread1] Failed to connect to 172.30.0.2:27017, in(checking socket for error after poll), reason: Connection refused
2018-10-04T11:25:18.062+0000 E QUERY    [thread1] Error: couldn't connect to server mongo:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed

I checked the internal IP, it seems to be right
docker inspect reaction_mongo_1 | grep IPAddress

"SecondaryIPAddresses": null,
"IPAddress": "",
"IPAddress": "172.30.0.2",

Steps to Reproduce

Please provide starting context, i.e. logged in as a user, configure a particular payment method.

  1. clone the repo
  2. run make and wait for it to finish
  3. run docker ps -a | grep reaction and observe that both reaction_reaction_1 and reaction_mongo-init-replica_1 exited

Possible Solution

Running docker start reaction_mongo-init-replica_1 afterwards seems to make it start - Maybe the build script needs to wait until the main mongodb container finished loading.

Metadata

Metadata

Assignees

Labels

bugFor issues that describe a defect or regression in the released software

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions