I am building a system that has dependencies such as Apache, Postgresql, and mod_wsgi. As part of my deployment process, I would like to write a sanity-checking script that tries to determine whether the server environment conforms to various assumptions, the most basic of which is whether the dependencies are installed.
Checks I have considered:
- Check the service is responding, e.g. make an HTTP request, connect to a database, etc.
- Check somehow that a service is running, e.g. maybe grepping
ps ax
? (This seems unreliab开发者_如何学运维le) - Check that the package is installed, e.g. through querying dpkg.
These obviously go in order of decreasing specificity, the hope being that if one test fails, I might find out why by running a more specific test.
But where do I stop? How many levels of specificity should I check? Are there any best practices for doing this sort of thing?
Thanks!
I would run the program and do proper try..except at place of first use of feature in informative message to user for what is missing (not installed db, installed but not running etc)
精彩评论