crowbar/barclamp-crowbar — pull request #720 by VictorLowther (2013-10-06 11:41:08+00:00)
Title: CB 2.0: Switch to Postgres for production, and refactor the provisioner BC to hook it back into the node lifecycle. [1/3]

This pull request is mostly for feedback right now, and does the
following:

* Switch from sqlite to postgres for our production database. Since
we were running several processes in parallel banging on sqlite, we
were getting occasional locking violations that could only be
cleared by restarting Crowbar. Since that problem will only get
worse as we parallelize things, switch to a real database that
handles multiple concurrent connections just fine -- Postgres.
* Refactor the provisioner to hook it back into the node lifecycle.
This lets the provisioner start managing its DHCP and PXE
functionality on a per-node basis again.

For now, I am using Postgres 9.3 from the package repositories
maintained by postgresql.org. This should allow us to start taking
advantage of some of the nicer things that have been happening in the
9.x development branch w.r.t JSON handling. The Crowbar postgres
install is currently restricted to listening on a UNIX socket that it
trusts implicitly, so the only security we have there is that Postgres
is not reachable using IP. This was done to ease bootstrapping and to
not interfere with the Postgres instance that chef-server needs to set up.

crowbar.yml | 6 +
crowbar_framework/Gemfile | 1 +
.../app/controllers/barclamp_controller.rb | 2 +-
.../app/controllers/support_controller.rb | 2 +-
crowbar_framework/app/models/doc.rb | 2 +-
crowbar_framework/app/models/group.rb | 2 +-
crowbar_framework/app/models/nav.rb | 4 +-
crowbar_framework/app/models/node.rb | 4 +-
crowbar_framework/app/models/node_role.rb | 178 ++++++++++-----------
crowbar_framework/app/models/role.rb | 2 +-
crowbar_framework/app/models/user.rb | 14 +-
.../app/views/node_roles/show.html.haml | 2 +-
crowbar_framework/config/database.yml | 19 ++-
.../db/migrate/20120730225300_create_jigs.rb | 2 +-
.../db/migrate/20120731225405_create_barclamps.rb | 4 +-
.../db/migrate/20120731225510_create_roles.rb | 2 +-
.../20120731300000_create_deployment_roles.rb | 4 +-
.../db/migrate/20120731310000_create_node_roles.rb | 8 +-
setup/01-crowbar-rake-tasks.install | 1 +
19 files changed, 138 insertions(+), 121 deletions(-)

Crowbar-Pull-ID: 1894f0c22097ce2fe14718ee0722577a3af82967

Crowbar-Release: development