loading table of contents...
4.2.2.1.2. Using PostgreSQL with Chef

The following steps show how to modify the deployment to use a PostgreSQL database instead of MySQL. The Chef repository in the workspace is prepared for a PostgreSQL deployment, but the included roles must be changed.

  1. In the base role, set the coremedia.db.type attribute to postgresql so that the PostgreSQL schema creation scripts are used. Depending on your operating system you may need to change several attributes of the PostgreSQL cookbook.

    • For CentOS 6 installations, more attributes need to be adjusted.

      name "base"
      description "The base role for CoreMedia nodes"
      
      override_attributes "java" => {"jdk_version" => "7"},
                          "coremedia" => {"db" => {"type" => "postgresql"}},
                          "mongodb" => {"cluster_name" => "coremedia"},
                          "postgresql" => {
                                  "version" => "9.2",
                                  "dir" => "/var/lib/pgsql/9.2/data",
                                  "server" => {
                                          "service_name" => "postgresql-9.2",
                                          "packages" => ["postgresql92-server"]
                                  },
                                  "client" => {"packages" => ["postgresql92-devel"]},
                                  "enable_pgdg_yum" => true,
                                  "password" => {"postgres" => "coremedia"}
                          }
      
      run_list "recipe[blueprint-yum::default]",
               "recipe[java]"
      

      Example 4.16. base.rb for CentOS 6


  2. In the management and replication roles, replace the mysql::server recipe by the postgresql::server recipe. Adapt the coremedia.configuration attributes.

    name "management"
    description "The role for CoreMedia Management nodes"
    
    override_attributes "coremedia" => {
      "db" => {"schemas" => %w(cm7management cm7master cm7caefeeder cm7mcaefeeder)},
      "configuration" => {
        "configure.CMS_DB_URL" => "jdbc:postgresql://localhost:5432/coremedia",
        "configure.CMS_DB_DRIVER" => "org.postgresql.Driver",
        "configure.MLS_DB_URL" => "jdbc:postgresql://localhost:5432/coremedia",
        "configure.MLS_DB_DRIVER" => "org.postgresql.Driver",
        "configure.WFS_DB_URL" => "jdbc:postgresql://localhost:5432/coremedia",
        "configure.WFS_DB_DRIVER" => "org.postgresql.Driver",
        "configure.CAEFEEDER_PREVIEW_DB_URL" => "jdbc:postgresql://localhost:5432/coremedia",
        "configure.CAEFEEDER_PREVIEW_DB_DRIVER" => "org.postgresql.Driver",
        "configure.CAEFEEDER_LIVE_DB_URL" => "jdbc:postgresql://localhost:5432/coremedia",
        "configure.CAEFEEDER_LIVE_DB_DRIVER" => "org.postgresql.Driver"
      }
    }
    
    run_list "role[base]",
             "recipe[postgresql::server]",
             "recipe[coremedia::db_schemas]",
             "recipe[mongodb]",
             "recipe[coremedia::solr_master]",
             "recipe[coremedia::master_live_server]",
             "recipe[coremedia::content_management_server]",
             "recipe[coremedia::workflow_server]",
             "recipe[coremedia::caefeeder_preview]",
             "recipe[coremedia::caefeeder_live]"
    

    Example 4.17. management.rb


    name "replication"
    description "The role for CoreMedia Replication nodes"
    
    override_attributes "coremedia" => {
      "db" => {"schemas" => %w(cm7replication)},
      "configuration" => {
        "configure.RLS_DB_URL" => "jdbc:postgresql://localhost:5432/coremedia",
        "configure.RLS_DB_DRIVER" => "org.postgresql.Driver",
      }
    }
    
    run_list "role[base]",
             "recipe[coremedia::management_configuration_override]",
             "recipe[postgresql::server]",
             "recipe[coremedia::db_schemas]",
             "recipe[coremedia::solr_slave]",
             "recipe[coremedia::replication_live_server]"
    

    Example 4.18. replication.rb