Skip to content

Conversation

@skalahonza
Copy link

@skalahonza skalahonza commented Jun 27, 2020

I edited the Dockerfile so it can be acutally built. I also added a docker-compose file so you can run nightscout and mongodb locally using docker-compose up.

This is also related to

Because it is now possible to run Docker images pushed to DockerHub in the Azure AppService.

Building official Docker image

It is now possible to let DockerHub build image for you. All you need to do is to link it with the official repository.
https://docs.docker.com/docker-hub/builds/

You can build images with tag dev from dev branch and official latest/production images from master branch with ease.

PORT: 1337
TIME_FORMAT: "24"
DISPLAY_UNITS: "mmol"
WAIT_HOSTS: "database:27017"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work for me. I had to use something like

command: sh -c "sleep 5; node server.js"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pls post the std out output in the comments? It works fine on my machine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I am not using your branch, but my docker compose file is very similar. I've also added WAIT_HOSTS. I think it is a timing problem. As you can see in the startup sequence the nightscout-app is not waiting long enough. Although nightscout-app makes afterward a successful connection, Nightscout doesn't work. I didn't have this problem with the same docker-compose.yml file before upgrading to 14.0.7.

nightscout-db | 2020-11-27T16:01:00.060+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=a6370c7791ae

...

nightscout-app | Error connecting to MongoDB: {"name":"MongoNetworkError"} - retrying in 3 sec
nightscout-app | ERROR CONNECTING TO MONGO Error: MongoDB connection failed! Double check the MONGODB_URI setting in Heroku.
nightscout-app |     at MongoClient.connect.then.catch.err (/opt/app/lib/storage/mongo-storage.js:75:30)
nightscout-app |     at process._tickCallback (internal/process/next_tick.js:68:7)
nightscout-app | Mongo Storage system ready

...

nightscout-db | 2020-11-27T16:01:01.177+0000 I NETWORK  [initandlisten] waiting for connections on port 27017

...

nightscout-app | Successfully established a connected to MongoDB
nightscout-app | Mongo user role seems ok: [ { role: 'root', db: 'admin' } ]
nightscout-app | Mongo Storage system ready

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WAIT_HOSTS is not a built in functionality, I had to add support for it in the Dockerfile

## Add the wait script to the image
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.7.3/wait /wait
RUN chmod +x /wait


services:
nightscout:
image: "skalahonza/nightscout"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be obsolete and should be discarded.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Discarded.

@sulkaharo
Copy link
Member

Apologies for the long latency - DEV now has working Docker setup, coupled with Github Actions Docker build. More improvements to land soon. https://hub.docker.com/r/nightscout/cgm-remote-monitor/tags?page=1&ordering=last_updated

@sulkaharo sulkaharo closed this Jan 1, 2021
@m-a-v
Copy link
Contributor

m-a-v commented Jan 1, 2021

@sulkaharo No worries for the long latency. I have running a similar setup like in this PR for several months. I think it would be important also to add a docker compose solution for the people. If you want to I could review and test @skalahonza in more detail.

@sulkaharo
Copy link
Member

@pazaan is working on the compose - we were discussing supporting both compositions that only contain the Nightscout Node component but also one that has Mongo as well, which would be a fully self contained image.

@m-a-v
Copy link
Contributor

m-a-v commented Mar 6, 2021

@pazaan Is there some progress for docker compose?

@pazaan
Copy link
Collaborator

pazaan commented Mar 6, 2021

See #6903

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants