[COOK-3519] Specify Postgres version when using PGDG apt repository

This is essentially the same Pull Request as #72, but since there hasn't been any movement on that in a long time and I'm starting to need this feature myself... I've made the changes requested.  Namely:

- Use groups and pessimistic locks in Gemfile

Please review & merge when ready!