subfuzion / voting-app

Example containerized microservices Voting App based on the original Docker version. bit.ly/voting-app-with-docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vote app db connection error

ndegory opened this issue · comments

When the vote app starts before the database is ready, an error log is raised, but the container is not killed.

$ kubectl get pods
NAME                                               READY     STATUS    RESTARTS   AGE
unrealistic-chinchilla-database-6c656f4697-wrm6r   1/1       Running   0          12m
unrealistic-chinchilla-queue-849484d6cd-47dxq      1/1       Running   0          12m
unrealistic-chinchilla-vote-f5bb6f476-hjpjm        0/1       Running   0          12m
~/Development/src/github.com/subfuzion/docker-voting-app-nodejs/src/vote(sub-master ✗) kubectl logs -f unrealistic-chinchilla-vote-f5bb6f476-hjpjm
{ MongoNetworkError: failed to connect to server [database.default.svc.cluster.local:27017] on first connect [MongoNetworkError: connection 0 to database.default.svc.cluster.local:27017 timed out]
    at Pool.<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/topologies/server.js:503:11)
    at Pool.emit (events.js:180:13)
    at Connection.<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/connection/pool.js:326:12)
    at Object.onceWrapper (events.js:272:13)
    at Connection.emit (events.js:180:13)
    at Socket.<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/connection/connection.js:256:10)
    at Object.onceWrapper (events.js:272:13)
    at Socket.emit (events.js:180:13)
    at Socket._onTimeout (net.js:393:8)
    at ontimeout (timers.js:466:11)
    at tryOnTimeout (timers.js:304:5)
    at Timer.listOnTimeout (timers.js:267:5)
  name: 'MongoNetworkError',
  message: 'failed to connect to server [database.default.svc.cluster.local:27017] on first connect [MongoNetworkError: connection 0 to database.default.svc.cluster.local:27017 timed out]' }