Set postgres host when creating a test_app

Can be set now with DB_HOST=foo

Fixes #3988
Fix for possible wrong assignment of `on_demand` for a product without variants. I see no point to store old `on_demand` flag for a master variant and the new one on product's instance at the same time. It leads to the inconsistency.

Fixes #4013