In the quest to make the MiniBookDb database readable from outside my home network, I tried to use a microservice in Pythn/Flask.
While the approach work, I had the problem that the same site name is resolved with different IP depending on where I am: on my private network the site name is resolved with an private IP, on the outside it issolved as a public IP.
On my private network, I also run the DNS, so that I can assign a specific IP to MiniBookDB on the Raspberry, so since the site is accessible with the same name both from outside and inside the private network, when the Raspberry call the microservice on the public server, in the end it call itself and fail.
Since I don't want to use different site name, I had to let go the microservice and use another way.
Remembering how I deploy this site (and the other one) I decide to use git and the old good cron, with some python magic.
The pyhton magic is just a script that execute some simple actions: - extract all the books from the MongoDB, selecting only the needed fields - store them in a SQLite file - generate the HTML files from the SQLite db - commit them to a git repository
Once the file are pushed to the git repository which is on the public server, an hook extract the HTML files and copy them in the correct directory where the site live.
The operation is executed every day at midnight using a cron job on the Raspberry.
All the sensible operations are done on the Raspberry, so inside my private network and I ditched also the need for authentication when calling the microservice, since it is handled by git using the usual ssh key.
The hook on the server is pretty simple, copied and adapted from the one I use for this site.
After the initial problems in the tests, the system work very well. The only downside is that the public pages are update once a day, but that is acceptable.