Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant installation #31

Merged
merged 9 commits into from
Jul 13, 2014
Merged

Vagrant installation #31

merged 9 commits into from
Jul 13, 2014

Conversation

ollieglass
Copy link
Contributor

Run Nightscout in a Vagrant VM

Adds a Vagrantfile and setup.sh script. When complete, this pull request will let you install by cloning the repo, running vagrant up, vagrant ssh then ./setup.sh

@ollieglass
Copy link
Contributor Author

Currently facing an issue installing Kudu Sync #30

@bewest
Copy link
Member

bewest commented Jul 1, 2014

Deploy.sh is only used by Azure, other places should not use it.

To run, just run npm install, setup the environment variable and start the
server.
-bewest

On Tue, Jul 1, 2014 at 5:01 AM, Ollie Glass notifications@github.com
wrote:

Currently facing an issue installing Kudu Sync #30
#30


Reply to this email directly or view it on GitHub
#31 (comment)
.

@jasoncalabrese
Copy link
Member

Hi @ollieglass I was using Vagrant for my (project-glu)[https://github.com/jasoncalabrese/project-glu/blob/master/Vagrantfile] to auto deploy to digial ocean. I've been planning to port that over here once I switch back to the community version.

@jasoncalabrese
Copy link
Member

Also, @ollieglass how do you think we could best make a combined Vagrantfile for Nightscout and @scottleibrand's DIYPS

@ollieglass
Copy link
Contributor Author

@jasoncalabrese I'm working on adding Vagrant to DIYPS too, but I was just intending to make local development easier. DIYPS needs apache and php, instead of doing all the symlinking etc. on my Mac I'd rather use a VM.

Deploying to DO is a nice feature to have, I've not looked at that.

No reason why Nightscout and DIPYS can't share a Vagrant setup. One conflict I can see is that they're both serving on port 80, but that's easy to fix by moving them to subfolders.

The other is that they're in separate repos and DIYPS is private. I'm not sure how to handle this, any thoughts?

@ollieglass
Copy link
Contributor Author

Re: this branch, npm install now runs fine, but when I start the server there's nothing on port 80

screen shot 2014-07-05 at 14 08 46

screen shot 2014-07-05 at 14 08 58

Not sure what to do about this - any suggestions?

@ollieglass
Copy link
Contributor Author

BTW I'm using James Wedding's public CGM data (from http://nightscout.info/forum/discussion/comment/148#Comment_148), my database_configuration.json looks like this:

{
    "url": "mongodb://NSTest:NSTest:@ds048537.mongolab.com:48537/weddingcgm",
    "collection": "cgmcollection"
}

@jasoncalabrese
Copy link
Member

@ollieglass by default node.js is running nightscout on port 1337. On my digital ocean server I have nginx running on 80, have vhosts setup for nightscout and diyps.

@ollieglass
Copy link
Contributor Author

Thanks, port 1337 gets me this:

screen shot 2014-07-05 at 17 39 22

I'm still not sure where to go from here, any suggestions?

I'm going to go through the standard installation to Azure and use that as a reference.

@jasoncalabrese
Copy link
Member

Looks like it's not getting data from mongo

@ollieglass
Copy link
Contributor Author

Right. I've set the environment as shown in the installation guide and reset the database_configuration.json file to null but still nothing. And I've checked the vm can reach the internet by pinging google.

Not sure what to check next.

@ollieglass
Copy link
Contributor Author

Testing the VM can actually connect to mongolab and retrieve a record - works fine.

vagrant@precise64:/vagrant$ mongo ds048537.mongolab.com:48537/weddingcgm -u NSTest -p NSTest
MongoDB shell version: 2.0.4
connecting to: ds048537.mongolab.com:48537/weddingcgm
> db.cgmcollection.findOne();
{
    "_id" : ObjectId("538692b5b565427e58d39342"),
    "device" : "dexcom",
    "date" : NumberLong("1401147628000"),
    "dateString" : "05/26/2014 06:40:28 PM",
    "sgv" : "231"
}`

@jasoncalabrese
Copy link
Member

Is there recent data? > db.entries.find({ }).sort({"date": -1}).limit(1) Any errors in the node.js output? Any errors in the browser's JS console?

If not we should add some debug/info logging and make the issue easier to figure out.

@ollieglass
Copy link
Contributor Author

Here's the result of that query:

> db.cgmcollection.find({}).sort({"date": -1}).limit(1) 
{ "_id" : ObjectId("53b85b5ce8e1396802a69d6f"), "device" : "dexcom", "date" : NumberLong("1404590860000"), "dateString" : "07/05/2014 03:07:40 PM", "sgv" : "207", "direction" : "FortyFiveDown" }

Browser console output looks ok. This is from Chrome, I also connected with Safari then closed that connection:

Document was loaded from Application Cache with manifest http://192.168.33.10:1337/nightscout.appcache 192.168.33.10/:1
Application Cache Checking event 192.168.33.10/:1
Application Cache Downloading event 192.168.33.10/:1
Application Cache Progress event (0 of 15) http://192.168.33.10:1337/js/dropdown.js 192.168.33.10/:1
Application Cache Progress event (1 of 15) http://192.168.33.10:1337/audio/alarm2.mp3.gz 192.168.33.10/:1
Application Cache Progress event (2 of 15) http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,300,400,600,700,800 192.168.33.10/:1
Application Cache Progress event (3 of 15) http://192.168.33.10:1337/audio/alarm.mp3.gz 192.168.33.10/:1
Application Cache Progress event (4 of 15) http://192.168.33.10:1337/css/dropdown.css 192.168.33.10/:1
Application Cache Progress event (5 of 15) http://192.168.33.10:1337/js/client.js 192.168.33.10/:1
Application Cache Progress event (6 of 15) http://192.168.33.10:1337/bower_components/jquery/dist/jquery.min.js 192.168.33.10/:1
Application Cache Progress event (7 of 15) http://192.168.33.10:1337/css/main.css 192.168.33.10/:1
Application Cache Progress event (8 of 15) http://192.168.33.10:1337/bower_components/d3/d3.min.js 192.168.33.10/:1
Application Cache Progress event (9 of 15) http://192.168.33.10:1337/favicon.ico 192.168.33.10/:1
Application Cache Progress event (10 of 15) http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700,300italic,400italic,500italic,700italic 192.168.33.10/:1
Application Cache Progress event (11 of 15) http://192.168.33.10:1337/ 192.168.33.10/:1
Application Cache Progress event (12 of 15) http://192.168.33.10:1337/socket.io/socket.io.js 192.168.33.10/:1
Application Cache Progress event (13 of 15) http://192.168.33.10:1337/audio/alarm2.mp3 192.168.33.10/:1
Application Cache Progress event (14 of 15) http://192.168.33.10:1337/audio/alarm.mp3 192.168.33.10/:1
Application Cache Progress event (15 of 15)  192.168.33.10/:1
Application Cache UpdateReady event 192.168.33.10/:1
Client connected to server. client.js:678
number of clients has changed to 2 client.js:702
number of clients has changed to 3 client.js:702
number of clients has changed to 4 client.js:702
number of clients has changed to 3 client.js:702
number of clients has changed to 2 client.js:702
number of clients has changed to 1 client.js:702

Here's the server's output, no errors:

vagrant@precise64:/vagrant$ node server.js 
   info  - socket.io started
http://192.168.33.10:1337/nightscout.appcache
http://192.168.33.10:1337/nightscout.appcache
http://192.168.33.10:1337/nightscout.appcache
http://192.168.33.10:1337/nightscout.appcache
http://192.168.33.10:1337/nightscout.appcache
http://192.168.33.10:1337/nightscout.appcache

@ollieglass
Copy link
Contributor Author

Ah, it works!

screen shot 2014-07-05 at 22 01 01

It was just taking a long time to retrieve and show data.

Ollie Glass added 2 commits July 5, 2014 22:06
…itor into vagrant

* 'master' of https://github.com/nightscout/cgm-remote-monitor: (52 commits)
  travis.yml: removed unused gitter.im hook
  Removing audio.load() per bewest's request
  get sign in bg delta correct
  actually show bgdelta
  Removing unnecessary packages
  Removing unused library
  README: Build & Dependancies
  manually bust cache
  client.js change test successful
  test 2
  alert test1
  fix now-line placement
  HTML App Cache: removed .css and .js files.
  removed test alert
  alert test2
  test alert1
  tweak whitespace
  Added alarm silence for 120 minutes
  Ensure that audio loops once it starts
  re-work audio handling
  ...

Conflicts:
	.gitignore
@ollieglass ollieglass changed the title (Work in progress, do not merge) Vagrant installation (Finished, please review) Vagrant installation Jul 5, 2014
@jasoncalabrese
Copy link
Member

@ollieglass it looks like most of the Vagrantfile is commented out (and I don't see a reference to setup.sh), are you changing it when you run locally? Other config that might be missing from this?

I haven't done a lot with vagrant, but as I mentioned before I did use it to deploy to a new digital ocean droplet. I think that could be added to this Vagrantfile right? Then when you do vagrant up --provider=digital_ocean it would only use the config for that provider?

@jasoncalabrese
Copy link
Member

@ollieglass, let me know what you think about my comment above

@ollieglass
Copy link
Contributor Author

Hi @jasoncalabrese sorry for the delay getting back to you.

The Vagrantfile has all of the settings it needs - just the base box and the private network.

I'd prefer to leave the comments in as I think they make it easier for others who might want to review or edit in the future - in the same way you might leave comments in an Apache config file.

I'm not aware of anything missing from the config.

setup.sh isn't run from the Vagrantfile (thought it could be). I've added instructions to the README about using the VM, showing when to run it.

It is possible to deploy to Digital Ocean with Vagrant, and it is done along the lines you've mentioned. I'm not sure how to do it exactly though, I'd prefer to close this pull request as it and make that addition a new feature. Some kind of automated remote deploy would be great.

jasoncalabrese added a commit that referenced this pull request Jul 13, 2014
Thanks @ollieglass for the base Vagrant installation
@jasoncalabrese jasoncalabrese merged commit 8b6d862 into nightscout:master Jul 13, 2014
@jasoncalabrese jasoncalabrese changed the title (Finished, please review) Vagrant installation Vagrant installation Jul 13, 2014
sulkaharo pushed a commit that referenced this pull request Aug 28, 2019
freddyyi pushed a commit to freddyyi/cgm-remote-monitor that referenced this pull request Apr 22, 2022
tzachi-dar referenced this pull request in tzachi-dar/nightscout-vps Nov 15, 2022
Make the python server friendly with the menu program.
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.

3 participants