appliance/postgresql: Move wait function to pkg/postgres

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
controller: Wait for postgres to come up

This solves a race condition where bootstrap starts the controller
before postgres is fully available in service discovery.

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
test: Fix race in TestControllerRestart

Creating a client doesn't actually make any connections, so try to
connect to the stream inside of the attempts function.

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>