Use database connections as context managers
Get rid of sleep - loop until postgres is ready