mercredi 28 février 2018

What is the best software architecture for coordinator Python app

I am currently building Python console/daemon smart home coordinator application to be run on Raspberry Pi, and would like to understand, what is now considered the right way to structure such apps.

Global requirements:

  1. App must coordinate several devices with cloud platform
  2. It should have internal DB (mainly for case when it's offline and cloud is not reachable), SQlite suits fine.
  3. It should be easily auto-tested (using virtual devices and maybe dev cloud environment), including integration tests to be run automatically without any human help.

Input/output streams:

  1. Inbound/outbound communications through serial port (with several devices of different types), e.g. get statuses of devices, post them to the cloud, and send commands back.
  2. Inbound/outbound communications through REST API in the cloud, e.g. send device statuses, receive commands to be passed to devices.

The app is not very complex, but contains a lot of logic and communications, and it's quickly becomes very challenging to keep all the interconnections in one's head.

My main concern now is should it be monolithic app with classes/functions that implement different parts of logic, or should it be several microservices (e.g. logic service, serial port service, cloud communication service) that run concurrently and communicate, let's say, by means of local message broker like RabbitMQ/ZeroMQ? Or maybe some other third way?

The microservices approach looks like an overkill (for example, my services will never be deployed independently), but some classes right now are a mess, so I wonder where you draw the line?

P.S. If you happen to know any resource/book/reference architecture which can help - please let me know!

Thanks!

Aucun commentaire:

Enregistrer un commentaire