Where's the data??

52 views
Skip to first unread message

Scott Seidman

unread,
Mar 14, 2019, 1:49:03 PM3/14/19
to Rhythm Badges
OK!!! I now have the server running (dev mode), the badges programmed, the hubs seeing the badges, badges and beacons entered correctly in the server, the hub running in server mode.  The whole thing just came together.

Now, where does the data live in the server?  I see the "last seen" info on the server admin page.  I get a 404 when I click "view site", though.  Is there a log file somewhere on the server?  

Next steps (other than analysis) would probably be configuring an NTP server, setting the Pi's to get the time on boot, and then run the hub in server mode -- then I can clone the Pi's to make more hubs.  

Oren Lederman

unread,
Mar 15, 2019, 12:49:13 AM3/15/19
to Rhythm Badges
The data is saved inside the container that runs on the server, under the /media/data folder. In this folder, there's a folder for each project (using the project key), and there a file per hub, per day, per data type (audio and proximity)

There are two main ways to get to the data:
1. Using docker cp (copy) command. You'll need to find the ID of the container running django, and use the docker cp command. I'm not going to explain this method right now (too tired)

2. Using the web browser. In this method, you simply access a link and download the data. The tricky part is that you'll need to download multiple files, since there is a file for every hub, and for every day. We used a script. Here's an example for a url:
http://openbadgeserver.media.mit.edu/media/data/YUDJSDZ9JC/badgepi-24_proximity_2018-08-16.txt

where:
  • YUDJSDZ9JC is the project key (you can find yours in the project settings, where you define badges and beacons
  • badgepi-24 - the name of the hub
  • proximity - the data type. proximity and/or audio
  • 2018-08-16 - the date in YYYY-MM-DD format

This might not work in dev mode. If it doesn't let me know and I'll try and explain a different method.

Let me know if you run into any issues. If you do, one thing you can do is to connect to the container running the webserver using shell. to do that:
  • Use docker-machine to set the machine you are working with (if deploying to a remote machine)
  • run: docker-compose run --entrypoint /bin/bash django (or, if in dev mode, docker-compose -f dev.yml run --entrypoint /bin/bash django)
  • Then do to /media/data and see if your files are there.
Hope this helps. Sorry it's a bit messy

Scott Seidman

unread,
Mar 22, 2019, 3:33:06 PM3/22/19
to Rhythm Badges
I found the data,  When I enter with --entrypoint/bin/bash I end up in a /app directory.  One directory up from there, I see the media directory, with the key directory and the files for the hub.  I just can't figure out the 

If I'm trying to get the data from dev running on the localhost, what do I use for the url??  This isn't on a registered domain.  I do have the IP address, obviously.

When I get a listing of docker containers, I see openbadge-server_postgres_data_dev and openbadge-server_posgres_backup_dev.  Will one of those work to get the data with docker cp?  I tried, but get "no such container" errors.  It seems like the syntax is picky

Oren Lederman

unread,
Apr 2, 2019, 6:31:42 PM4/2/19
to Rhythm Badges
apologies - I thought I answered this one. not sure where the naswer disappeared to. 

1. You can use the IP in the URL. Not 100% sure this works in dev mode
2. docker cp won't work here. What you describe below are the volumes ("disks"), not the containers. These containers are the postgres (the databsae), not posgres

If using the URL doesn't work, there's actually an easier way - you can easily access the files on the computer running the docker (the host). Files are located in "../media/data" relative to the directory you run the docker from.
Reply all
Reply to author
Forward
0 new messages