usnistgov / SpectrumBrowser

ITL
12 stars 11 forks source link

Split web services into multiple containers. #189

Closed ranganathanm closed 9 years ago

ranganathanm commented 9 years ago

Currently there is only one web service (flaskr.py). This will be split into two web services.

Admin.py will run as a separate process and will support service restart of the other services (i.e. data streaming and flaskr ( the main service ) as well as all the admin function and resource monitoring. Admin.py will run in its own service container. flaskr.py (to be renamed MSOD.py) will run the main MSOD functions.

In addition, there will be two other services ...

DataStreaming.py will run the DataStreaming service. OccupancyAlert.py will run the Occupancy alert services. Each will run as an indivdual process.

Each service except for Admin will be individually started/stopped using buttons in the admin interface, thus giving control to the administrator.

ranganathanm commented 9 years ago

commit 876671dac514a3c4c1c5741dc5b7769cebfe9321

ranganathanm commented 9 years ago

Need to build service wrappers for OccupancyAlert and Admin.py ( these have been split off from flaskr.py and DataStreaming.py)

I've updated the test startup scripts (i.e. start-gunicorn.sh) . Please restart nginx (note that nginx.conf has changed).

djanderson commented 9 years ago

Currently there are 3 services scripts: gunicorn (flask/gunicorn), streaming (DataStreaming.py), and msod (wrapper service script).

Sounds like "gunicorn" is maybe not the best name, since there are now 2 distinct services behind it, flask and Admin.

You mentioned renaming flaskr to "MSOD", but we are using that service name for the wrapper service.

Could we use "spectrumbrowser" for flaskr/gunicorn instead of MSOD? Or the other way around and make "spectrumbrowser" the wrapper service name?

ranganathanm commented 9 years ago

There will be two instances of gunicorn - one for flaskr.py and one for Admin.py. Yes we can use spectrumbrowser instead of MSOD ( makes sense ).

Hence we need TWO separate guncorn services one for spectrumbrowser and one for Admin. Actually, we could directly run Admin as a python service (it does not need load balancing).

msod could start all of the required services for MSOD.


From: Douglas Anderson notifications@github.com Sent: Thursday, June 4, 2015 10:42 PM To: usnistgov/SpectrumBrowser Cc: Ranganathan, Mudumbai Subject: Re: [SpectrumBrowser] Split web services into multiple containers. (#189)

Currently there are 3 services: gunicorn (flask/gunicorn), streaming (DataStreaming.py), and msod (wrapper service script).

Sounds like "gunicorn" is maybe not the best name, since there are now 2 distinct services behind it, flask and Admin.

You mentioned renaming flaskr to "MSOD", but we are using that service name for the wrapper service.

Could we use "spectrumbrowser" for flaskr/gunicorn instead of MSOD? Or the other way around and make "spectrumbrowser" the wrapper service name?

Reply to this email directly or view it on GitHubhttps://github.com/usnistgov/SpectrumBrowser/issues/189#issuecomment-109142789.

ranganathanm commented 9 years ago

This has been completed. Please review the new services added. Thanks.

djanderson commented 9 years ago

Looks good. I moved "gunicorn" to "spectrumbrowser" in 9c1f61b as per our discussion.

I wasn't able to do a full test because I still don't know how to "enable" streaming (in other words, Config.isStreamingEnabled() returns False). Let me know how to flip that switch and I'll give it a more thorough test.

Only thing I'd like to see before we close this issue is migrating the print statements in DataStreaming.py, Admin.py, and Occupancy.py to use the logging subsystem so that what ends up in the logfile is a bit more descriptive (timehacks, etc).

ranganathanm commented 9 years ago

You can enable streaming as follows:

Go to the Sensors page; add a sensor and click on "streaming settings".

I have a test setup you can use to set up sensors. It is called flask/unit-tests/setup-test-sensors.py which will set up the sensor xxxW5XS for streaming.

You can test out streaming by running sh test-streaming-socket.sh ( in flask/unit-tests)

This will send a stream read from the .dat file included in that directory to the sensor. You can browse the stream by selecting the icon in the map page etc.

Let me know if you have further questions - I leave for 12 days starting tomorrow afternoon.


From: Douglas Anderson notifications@github.com Sent: Tuesday, June 9, 2015 11:50 AM To: usnistgov/SpectrumBrowser Cc: Ranganathan, Mudumbai Subject: Re: [SpectrumBrowser] Split web services into multiple containers. (#189)

Looks good. I moved "gunicorn" to "spectrumbrowser" in 9c1f61bhttps://github.com/usnistgov/SpectrumBrowser/commit/9c1f61b91a2d615c5d21bf6b5679210957a64f2a as per our discussion.

I wasn't able to do a full test because I still don't know how to "enable" streaming (in other words, Config.isStreamingEnabled() returns False). Let me know how to flip that switch and I'll give it a more thorough test.

Only thing I'd like to see in the future is migrating the print statements in DataStreaming.py, Admin.py, and Occupancy.py to use the logging subsystem so that what ends up in the logfile is a bit more descriptive (timehacks, etc).

Reply to this email directly or view it on GitHubhttps://github.com/usnistgov/SpectrumBrowser/issues/189#issuecomment-110410303.

ranganathanm commented 9 years ago

Implementation is completed and it works so I am closing this issue.