simonsobs / sisock

Sisock ('saɪsɒk): streaming of Simons Obs. data over websockets for quicklook
Other
2 stars 0 forks source link

Allow for easy modularisation of data node servers #31

Open ahincks opened 5 years ago

ahincks commented 5 years ago

WIth #28, it should now be much easier to run sisock out-of-the box using docker-compose. But we should also make it easy for someone to run a single data node server on a remote computer, without necessarily having to use docker.

BrianJKoopman commented 5 years ago

I think one thing that would make this easier would be if a data node server took arguments for the SISOCK_HOST and SISOCK_PORT variables which are hardcoded into sisock.base. This would allow one to expose the needed port on the crossbar server to the host system and then specify localhost and the port (which doesn't necessarily have to be the same as the one used in the container) when starting up the data server.

Right now this happens per data server, perhaps building the runner should be moved to within sisock. The user would then need to have .crossbar/server_cert.pem in place.

ahincks commented 5 years ago

Yes, agreed. When I working on PR #28 I was going to make SISOCK_HOST and SISOCK_PORT environment variables, but ran into a problem that you identified earlier: it's not clear how to pass environment variables into the crossbar JSON configuration file. Have you any more thoughts about how to do this? Not that this is exactly the same issue that you are raising, but it is related since it helps motivate removing these variables from sisock.base.

As regards your specific proposal, how do you suggest that these arguments be passed to the data servers? Maybe each data server should have a local config file?

BrianJKoopman commented 5 years ago

Ah, I was thinking we'd pass them to the ApplicationRunner in each data server, much like environment variables are passed to the runner.run() call. For instance:

runner = ApplicationRunner("ws://%s:%d/ws" % (environ['SISOCK_HOST'],
                                              environ['OCS_PORT']),
                           sisock.base.REALM)

(We aren't really using different realms, but this could be passed similarly.)

I don't think you'd want to change the crossbar config for this. The scenario I imagined based on your initial post was that the crossbar server is running on another computer already, and I have a single data server that I want to run on my laptop. I need to be able to tell the data server, "connect to the crossbar server on this host, using this port", rather than using the hardcoded 'sisock-crossbar' address.

ahincks commented 5 years ago

Yes, of course. You're right.