linan7788626 / Hoopla

MIT License
1 stars 2 forks source link

Figure out sending JSON model output to the SW Labs database #16

Open drphilmarshall opened 7 years ago

drphilmarshall commented 7 years ago

@RafiKueng You mentioned that we might be able to have the Hoopla "Save mode" function submit a JSON record to a table in the Space Warps Labs database. Is this an easy pull request for you to make, or is it best to provide instructions for @linan7788626 to code up?

RafiKueng commented 7 years ago

The backend database is a http://couchdb.apache.org/ database, so @linan7788626 it should be sufficient for you to make your program able to http POST the resulting json file to such a database.

I however have to figure out how we setup the system, also with respect to security. So far, the database can't be accessed from the internet (firewall) I'll need some time to think about how to solve this..

drphilmarshall commented 7 years ago

Thanks Rafi. Could you set up the authentication the same way you did SpaghettiLens?

RafiKueng commented 7 years ago

@anumore also likes to get updates

RafiKueng commented 7 years ago

No, that won't work because in SpL, I only have a server side processes that write / read to the database, whereas with Hoopla it's all client side if I understood correctly.

There are basically two options:

  1. Opening up the port of the database server to the internet
  2. Writing a small server side script that relays writes / reads to the database.

Even though 2. might involve a bit more work, I think I prefer currently this option, due to security considerations. 1. would involve me explaining to the IT department why I need a non standard open port in the university firewall.

This script could then also allow for some way to retrieve / display the information / json data (like the results pages in SpL: http://labs.spacewarps.org/spaghetti/model/JQA3OBCT52) and / or an interface to all the collected data for you/the scientists.

It could be written in python/django or in php, but it would involve that this script is hosted on our server. So we could either:

  1. include that script into Hoopla directly, where it belongs logically, but with the consequence that we'd need to host Hoopla direclty on labs.spacewarps.org
  2. create a separate repro only consisting of this server side relay process for hoopla.

although the 1. would be "more clean", I guess the second would be easier to bring up and in the end, easier to maintain.

linan7788626 commented 7 years ago

As @RafiKueng mentioned, there are some options for uploading files to a local server. Besides local servers, is it possible that we could add a button to upload JSON files to a public cloud sever, such as Google drive or Dropbox?

RafiKueng commented 7 years ago

Client side, without user authorisation I don't think that's possible. Either you require users to log in to their google/dropbox account to upload, or you create a server side script that logs into those services with your credentials to upload.

Check this: https://www.dropbox.com/developers/saver (for me personally, requiring a google/dropbox login would be a reason not to use the tool ;) )

linan7788626 commented 7 years ago

Hi @RafiKueng Thanks a lot for your explanation, I understand it now.