DevOps & Delphix : Chef recipes

July 16th, 2014

Delphix Engines expose all features via a stable WEB API built on top of HTTP and JSON.

Clients choose an HTTP client to interact with Delphix and integrate within their environment.

Delphix Engines are bundled with a command line interface which guides users for automation and integration with third party tools.

Delphix CLI example

Adding a SQL Server Source Environment:

Enter these commands through the command line interface:


   set type=HostEnvironmentCreateParameters;

   set hostEnvironment.type=WindowsHostEnvironment;
   set<Source environment name>;
   set hostEnvironment.proxy=<target host name>;

   set hostParameters.type=WindowsHostCreateParameters;
   set"<Source host IP address or hostname>";

   set primaryUser.credential.type=PasswordCredential;
   set primaryUser.credential.password=<password>;




Delphix Curl API example

Example of refreshing a virtual database back to the newest version of the source database

  curl -v -X POST -k --data @- http://delphix-server/resources/json/delphix/database/ORACLE_DB_CONTAINER-13/refresh  \
    -b ~/cookies.txt -H "Content-Type: application/json" <<EOF
       "type": "OracleRefreshParameters",
       "timeflowPointParameters": {
               "type": "TimeflowPointSemantic",
               "timeflow": "ORACLE_TIMEFLOW-13",
               "location": "LATEST_SNAPSHOT"



 Chef as a database provisioning tool

Chef is an automation platform for provisioning physical or virtual environments to a specific state in a controlled and repeatable way.

Chef may install binaries, control users, configuration.

Chef as a database provisioning tool:

  • Install binaries of the DBMS
  • Configure the DBMS
  • Provision data

Installing the binaries and configuring the database might be standard work for Chef but actually provisioning the data such as a copy of a source database is generally out of the purview of Chef, at least until now. Now with Delphix provisioning of the data, no matter the size, can be done in minutes with a few API calls.

With chef, one usually does not describe actions to take (“provision a VDB”), but the desired state of the system (“There must be a VDB running on that port”). This allows rules to be applied to heterogeneous systems in different states and continuously compared the actual with the desired state of the system (for instance, if a new server is added after the fact, it will notice that it needs to provision a VDB to get to the desired state). This is achieved through the separation of resources provider and recipes. The resource provider is the “library” which knows about the low level details of the implementation (is there a VDB running? how do I connect to a Delphix Engine? Which steps needs to be taken to go from the current state to a VDB being provisioned?). The “recipe” describe the state leveraging the resource providers.


Chef: Provisioning data from Delphix

Chef cookbooks (recipes) can use the Delphix Engine API to provision data.

Screen Shot 2014-07-14 at 2.10.14 PM

Chef recipes describe the desired state of the system.

Chef & Delphix example to provision a virtual database

In the following “dlpx_pgsql_vdb” is the block in the recipe which indicates the state of the system. It means “We want a postgresql (pgsql) VDB running”.

dlpx_pgsql_vdb "HR" do
        action :provision
        port node[:dlpx][:port] || 5443
        container "HR"
        delphix_server node[:dlpx][:delphix_server]
In this code details the following means:
dlpx_pgsql_vdb “HR”; do
We are describing the desired state of a postgresql Delphix VDB, and the Chef name for that is “HR”
action :provision
We want the VDB to be provisioned (as opposed to deleted or refreshed daily for instance)
port node[:dlpx][:port] || 5433
The port is read from the host configuration and defaults to 5433 (the recipes could be shared by many hosts or servers, each of them with their own config)
container “HR”
We want Delphix to name that VDB “HR”
delphix_server node[:dlpx][:delphix_server]
Look at the configuration for the hostname and credentials of the Delphix engine

Chef Providers build the library of utilities which can be leveraged in recipes. A Delphix Chef Provider can be built on top of the HTTP API.

def provision(group, mount_base, name)
    response ="#{@url}/database/provision", {
      :type => "OracleProvisionParameters",
      :container => {
        :type => "OracleDatabaseContainer",
        :name => name,
        :group => group
      :source => {
        :type => "OracleVirtualSource",
        :mountBase => mount_base
      :content_type => 'application/json',
      :cookies => @cookies

In this exmple

  • source –  hard coded as OracleVirtualSource
  • group – the delphix user group
  • mount_base –  nfs mount location on the target
  • name –  the new VDB name




  1. Trackbacks

  2. No trackbacks yet.

  2. No comments yet.

one − = 0