martonperei / emulated_roku

MIT License
7 stars 5 forks source link

Adding docker functionality to allow for easy deployment #2

Open NotChristianGarcia opened 4 years ago

NotChristianGarcia commented 4 years ago

Not sure if you want this, but I think it's incredibly useful for users. Basically allows users to deploy a Docker "container" that completely isolates the emulated_roku server and allows it to be easily updated, and ran with a simple command.

Along with that, with docker-compose users can have an always on server that automatically restarts when a computer runs.

Useful for things like headless Raspberry Pi nodes (my use case).

You're able to host the image under your own account name, I left the files aliased with {username} for now. That means that people could just run docker run mindigmarton/emulated_roku and have a working server. (Though they would need the net and volume flags as mentioned in the expanded README.md)

I don't know. I think it's useful. Hope you do too. Just felt like helping!

NotChristianGarcia commented 4 years ago

Oh! Also added a rudimentary second example with a custom command handler class.

martonperei commented 4 years ago

Thanks, this looks great! I think it would be best if the docker image used it's own server.py instead of the example. We should also support environment variables for configuration as you cannot map ports with host networking. (and 8060 will most likely conflict with other stuff) I can have a deeper look sometime this week!

NotChristianGarcia commented 4 years ago

Awesome! Just updated the Dockerfile to point towards docker_server.py instead. Said server has a custom commandHandler so users can see that in action.

The port issue should not be an issue! The lack of port-forwarding is on Docker's side, so Docker can't forward the API port to something else as there's no layer between the container and host networking. But because the API port is set in the server.py file it will still be set and used just as it was before Docker.

martonperei commented 4 years ago

Not sure when I'll have the time to look at this deeper, kind of got busy with life: ( (don't even have a dev env set up) I'm kinda split about merging the Dockerfile as is, because it's not much more than a python venv with the package installed. When giving end-users a tool (which this library is not, currently) I usually prefer a no-configuration set up that is able to give an example functionality out of the box, which is configurable, that's why I mentioned configuration variables, as I was thinking of having a hook-in script that is imported from docker_server.py which has the command handler. (having to copy paste boiler-plate code makes it harder to get started) If needed, one can overwrite docker_server.py, but it shouldn't be neccessary. Ideally I'd like the image to contain advertise.py too so it's an all in one package.