Good microservice design
What makes a good microservice? By good I mean stable, maintainable, easy to operate, easy to use, etc.
1. It should do one thing and one thing only
This classic Unix philosophy, it was relevant back then and it's as relevant today. This is probably the most import criteon for good design as far as I'm concerned, because if you at least have clear focus on what the service is doing you can always fix the other stuff. You tend to lose control of features and stability when a service does more than one thing because as some point those multiple things start conflicting with each other.
2. It needs to have as few dependencies as possible.
A dependency is a point of weakness. That can be another service, or something internal like a database when you could have just used the file system to store your data. Don't bolt on a dependency because it's cool or interesting, it needs to serve an actual perpose.
3. It should be easy to setup and configure
A service should be launchable from a docker-compose file. It's base config should be stored in that file, or a YML config file. You should not have to start a container, shell into it, and run a bunch of commands to get it to a running state.
4. Log everything
This took me a long time to realize. Rather overlog than underlog, you can always find a way to clean out log data.
5. It needs to expose it's health via HTTP
A surprising number of services are difficult to diagnose while running. Oftentimes, the container will run but the service inside is non-responsive, and debugging this requires shelling into the container. Fact : your service is going to get containerized anyway, you might as well give it a way to broadcast it's health to either the container via docker healthcheck, or via HTTP.
6. It should be easy to backup and restore.
If your service writes everything to file on-the-fly you're safe, simply backup/restore your volume folder and you're golden. If your service stores stuff in memory you need to provide to flush this out in order to backup.