Mongodb Charts: stitchServer not running

612 views
Skip to first unread message

Marc Monroy

unread,
Jul 14, 2018, 12:49:56 AM7/14/18
to mongodb-user
Hi everyone,

I am trying to evaluate mongodb charts, but the final step of the installation is failing.
I have the following error:

mongodb-charts_charts.1.9k0qf69qe58v@picsv02    |  ✔ encryptionKeyPath
mongodb-charts_charts.1.9k0qf69qe58v@picsv02    |  ✔ tokens
mongodb-charts_charts.1.9k0qf69qe58v@picsv02    |  ✔ stitchConfigTemplate
mongodb-charts_charts.1.9k0qf69qe58v@picsv02    |  ✔ stitchConfig
mongodb-charts_charts.1.9k0qf69qe58v@picsv02    |  ✔ stitchConfigWritten (true)
mongodb-charts_charts.1.9k0qf69qe58v@picsv02    |  ✔ mongoDBReachable (true)
mongodb-charts_charts.1.9k0qf69qe58v@picsv02    |  ✔ stitchChildProcess
mongodb-charts_charts.1.9k0qf69qe58v@picsv02    |  ✖ stitchServerRunning failure: Can't connect to Stitch Server at http://localhost:8080. Too many failed attempts. Last error: connect ECONNREFUSED 127.0.0.1:8080

Could you someone give some advices on how to fix this, please? 
I followed all the installation steps and everything went fine.

Cheers,
Marc

Tom Hollander

unread,
Jul 14, 2018, 2:45:54 AM7/14/18
to mongodb-user
Hi Marc -

That seems to show that the internal Stitch server failed to start, despite the database being reachable.

To help diagnose this further, you can retrieve the Stitch startup logs using the following command:

docker exec -it $(docker container ls --filter name=_charts -q) cat /mongodb-charts/logs/stitch-startup.log

Can you please run this and send any errors (making sure to redact anything sensitive should it be included). 

Can you also tell me a bit about your MongoDB connection - is it a replica set? Can you send the URI you used (again redacting passwords etc)?

thanks
Tom
Message has been deleted

Robin van Breukelen

unread,
Aug 2, 2018, 6:06:18 PM8/2/18
to mongodb-user
Hi Tom, 

I have the same issue as Marc.

The command you provided  gives me the output:

cat: /mongodb-charts/logs/stitch-startup.log: No such file or directory


Here's some more information:

mongodb-charts docker ps
CONTAINER ID        IMAGE                                                 COMMAND                  CREATED             STATUS              PORTS                                            NAMES
d169080afa5f        quay
.io/mongodb/charts:v0.9.0                         "/bin/sh -c '/usr/bi…"   3 minutes ago       Up 3 minutes        80/tcp                                           mongodb-charts_charts.1.u1t4hw00gwmusr7gyje137dzc


docker service ls
mongodb
-charts docker service ls
ID                  NAME                    MODE                REPLICAS            IMAGE                           PORTS
59nkt8t15sd8        mongodb-charts_charts   replicated          1/1                 quay.io/mongodb/charts:v0.9.0   *:80->80/tcp


I'm connecting to a replicaSet named rs0.

Any thoughts?

Thanks,

Robin

Tom Hollander

unread,
Aug 2, 2018, 6:10:01 PM8/2/18
to mongodb-user
Hi Robin -

Can you show me the result of cat /mongodb-charts/logs/charts-cli.log within the container (making sure to redact any passwords if present)?

Tom

Robin van Breukelen

unread,
Aug 3, 2018, 2:08:45 AM8/3/18
to mongod...@googlegroups.com
Hi Tom,

Here’s the output:

mongodb-charts docker exec -it a69d0951a035 /bin/bash
root@charts:/# cat /mongodb-charts/logs/charts-cli.log
2018-08-02T19:34:00.245+00:00 INFO  called charts-cli startup with arguments {"_":["startup"],"debug":false,"help":false,"version":false,"d":"/mongodb-charts","directory":"/mongodb-charts","$0":"mongodb-charts/bin/charts-cli.js"}
2018-08-02T19:34:00.271+00:00 INFO  encryptionKeyPath task success
2018-08-02T19:34:00.324+00:00 INFO  tokens task success
2018-08-02T19:34:00.326+00:00 INFO  stitchConfigTemplate task success
2018-08-02T19:34:00.330+00:00 INFO  stitchConfig task success
2018-08-02T19:34:00.341+00:00 INFO  stitchConfigWritten task success (true)
2018-08-02T19:34:00.426+00:00 INFO  waiting for MongoDB, attempt #1 to connect to MongoDB at mongodb://host.docker.internal/?replicaSet=rs0.
2018-08-02T19:34:00.682+00:00 WARN  waiting for MongoDB, attempt #1 failed: failed to connect to server [3d94f0a57b6a:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND 3d94f0a57b6a 3d94f0a57b6a:27017]

<some more of the same>

And ends with:

2018-08-03T06:03:41.413+00:00 ERROR mongoDBReachable task failure: Can't connect to MongoDB at mongodb://host.docker.internal/?replicaSet=rs0. Too many failed attempts. Last error: failed to connect to server [3d94f0a57b6a:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND 3d94f0a57b6a 3d94f0a57b6a:27017]
2018-08-03T06:03:41.413+00:00 INFO  startup successful

So I’m guessing the docker swarm network cannot connect to my other docker container, what am I doing wrong?

Thanks,

Robin
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/4a3372b8-77f6-4d39-b87d-b18cf753e2a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tom Hollander

unread,
Aug 3, 2018, 2:21:50 AM8/3/18
to mongodb-user
Oh, you have your mongod running in a different Docker container? In that case I think you need to put both containers into your compose file, and have them share a single "network".

For example, in your compose file:
services:
  mongod:
     ...settings for your mongod container
    networks:
      - mynetwork
  charts:
    ...settings for your charts container
    networks:
      - mynetwork
networks:
  - mynetwork
volumes:
   ...
secrets:
   ...

And then you can set your URI to be mongodb://mongod. 
Let me know if that works?

Tom
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.

Robin van Breukelen

unread,
Aug 3, 2018, 3:44:06 AM8/3/18
to mongodb-user
Hi Tom,

I had to adjust my own compose file a bit since we are using docker-compose 2.
Everything seems to start-up fine, but I don't see any front-end?

docker ps:


nobilex
-parent git:(feature/NBX-875) docker ps                                                                                                                                                    git:(feature/NBX-875|●12

CONTAINER ID        IMAGE                                                 COMMAND                  CREATED             STATUS              PORTS                                            NAMES
b7e7465dec8d        quay.io/mongodb/charts:v0.9.0                         "/bin/sh -c '/usr/bi…"   7 minutes ago       Up 3 minutes        0.0.0.0:9999->80/tcp                             nobilex_charts_1
277bc351153d        mongo:3.6-jessie                                      "docker-entrypoint.s…"   7 minutes ago       Up 3 minutes        0.0.0.0:27017->27017/tcp                         nobilex_mongodb_1

and the logging of the charts-cli:

root@charts:/# cat /mongodb-charts/logs/charts-cli.log
2018-08-03T07:28:11.082+00:00 INFO  called charts-cli startup with arguments {"_":["startup"],"debug":false,"help":false,"version":false,"d":"/mongodb-charts","directory":"/mongodb-charts","$0":"mongodb-charts/bin/charts-cli.js"}
2018-08-03T07:28:11.152+00:00 INFO  startup successful
2018-08-03T07:28:11.156+00:00 INFO  tokens task success
2018-08-03T07:28:11.158+00:00 INFO  encryptionKeyPath task success
2018-08-03T07:28:11.158+00:00 INFO  stitchConfigTemplate task success
2018-08-03T07:32:33.288+00:00 INFO  called charts-cli startup with arguments {"_":["startup"],"debug":false,"help":false,"version":false,"d":"/mongodb-charts","directory":"/mongodb-charts","$0":"mongodb-charts/bin/charts-cli.js"}
2018-08-03T07:32:33.297+00:00 INFO  encryptionKeyPath task success
2018-08-03T07:32:33.307+00:00 INFO  startup successful
2018-08-03T07:32:33.312+00:00 INFO  tokens task success
2018-08-03T07:32:33.313+00:00 INFO  stitchConfigTemplate task success

I have set the docker-compose file to use an external file as a secret, because docker secret create only works in swarm mode.

So my docker-compose file looks like this:

  charts:
image: quay.io/mongodb/charts:v0.9.0
hostname: charts
ports:
# host:container port mapping. If you want MongoDB Charts to be
# reachable on a different port on the docker host, change this
# to <port>:80, e.g. 8888:80.
- 9999:80
volumes:
- keys:/mongodb-charts/volumes/keys
- db-certs:/mongodb-charts/volumes/db-certs
environment:
# This environment variable controls the built-in support widget and
# metrics collection in MongoDB Charts. To disable both, set the value
# to "off". The default is "on".
CHARTS_SUPPORT_WIDGET_AND_METRICS: "on"
# Directory where you can upload SSL certificates (.pem format) which
# should be considered trusted self-signed or root certificates when
# Charts is accessing MongoDB servers with ?ssl=true
SSL_CERT_DIR: /mongodb-charts/volumes/db-certs
# networks:
# - backend
secrets:
- charts-mongodb-uri

<some more stuff>

volumes:
keys:
db-certs:


secrets:
charts-mongodb-uri:
file: ./secret.txt

and secret.txt is a file next to the compose file which simply contains:

mongodb://mongodb/?replicaSet=rs0


Now when I try to add the first user I get the following response:

add-user command error: ENOENT: no such file or directory, open '/run/secrets/charts-mongodb-uri'

Any ideas?

Thanks,

Robin


To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.

Tom Hollander

unread,
Aug 3, 2018, 4:09:12 AM8/3/18
to mongodb-user
Hi Robin -

The current beta won't easily run with docker-compose (vs Swarm) due to the dependency on Docker Secrets. When you add the secret, it results in a file being created in the /run/secrets directory. Docker-compose doesn't support secrets, hence the error. You could try copying the file in there manually I guess but I'm not sure if that will work.

The next update to Charts will have the option to provide the secret via an environment variable instead of a secret, which will make this easier.

Is there a reason why you're unable to use Docker Swarm mode?

Tom

Robin van Breukelen

unread,
Aug 3, 2018, 4:30:26 AM8/3/18
to mongod...@googlegroups.com
Hi Tom,

Ah that explains it.

No reason why we wouldn’t be able to use docker swarm, it’s just not how we’ve set it up right now.

Do you know when the next release will be?

Robin

Tom Hollander

unread,
Aug 5, 2018, 1:18:16 AM8/5/18
to mongodb-user
We plan to have a minor update within the next few weeks, which will include this change.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages