Migrating CloudCenter 3.2.6.x Deployments

Overview

This use case highlights the deployment migration process for VMs running CloudCenter 3.2.6.x (see the CloudCenter 4.8.1 release notes for additional context).

If you are using CloudCenter 3.2.6.x and need to migrate to CloudCenter 4.8.1 in order to use advanced features, you must ensure that vital data from CloudCenter 3.2.6.x (for example, application, services, and so forth) is also migrated to CloudCenter 4.8.1.

You must use CloudCenter APIs to implement this process provided in this section .

Prerequisites and Requirements

To use the CloudCenter-recommended process, you must adhere to the following requirements and prerequisites:

  • This methodology is available if you are migrating from CloudCenter 3.2.6 to 4.8.1 – this path has been tested and verified.

  • Only use CloudCenter APIs for this process, a UI solution is not currently available.

  • Only use Submit Job (v2) for this process, do not use the Submit Job (v1) for this use case.

  • This process assumes that you have already completed the dependent CloudCenter 4.8.1 installation steps on the CCM and CCO VMs. For example, launch a setup using CloudCenter 4.8.1 – This includes but is not restricted to the following tasks:

    • If you are using a private repository, verify that you are using the latest bundles.

    • Verify that you have configured the corresponding agent  bundle properties using the CCO wizard.

  • For this process to succeed, verify that you have configured the following requirements:

    • Any additional repositories used in CloudCenter 3.2.6 deployments must also be configured in your CloudCenter 4.8.1 setup.

    • The instance types, custom services, and application profiles should either be configured or imported into your CloudCenter 4.8.1 setup just as you did in CloudCenter 3.2.6.

Caution

    • Do not copy the quotation marks when copying the Node IDs details.

    • DO NOT INCLUDE the beginning and ending quotation marks for the userData attribute. For example, if the output is:

      "userData":"{
         "jobId":"559",
         "numOfNICs":"1",
         "brokerVirtualHost":"/cliqr",
         "agentType":"worker0",
         "bootstrapConfig":"http://<HOST>:<PORT>/release-4.8.1/bundle/bootstrap.json",
         "agentAutoUpgradeURL":null,
         "ldapuser":"cliqruser",
         "gatewayAddress":"<HOST>:<PORT>",
         "agentBundleURL":"http://<HOST>:<PORT>/release-4.8.1/bundle/bootstrap-cliqr-worker.sh",
         "brokerClusterAddresses":"<HOST>:<PORT>",
         "nodeMetadataURL":"http://<HOST>:<PORT>/release-4.8.1/bundle/cloud-node-metadata.war"
      }"

      Then, only copy:

      {
         "jobId":"559",
         "numOfNICs":"1",
         "brokerVirtualHost":"/cliqr",
         "agentType":"worker0",
         "bootstrapConfig":"http://<HOST>:<PORT>/release-4.8.1/bundle/bootstrap.json",
         "agentAutoUpgradeURL":null,
         "ldapuser":"cliqruser",
         "gatewayAddress":"<HOST>:<PORT>",
         "agentBundleURL":"http://<HOST>:<PORT>/release-4.8.1/bundle/bootstrap-cliqr-worker.sh",
         "brokerClusterAddresses":"<HOST>:<PORT>",
         "nodeMetadataURL":"http://<HOST>:<PORT>/release-4.8.1/bundle/cloud-node-metadata.war"
      }

High-Level Process Flow

This is the high-level process to deploy applications using unmanaged VMs:

  1. Import the CloudCenter 3.2.6.x VM(s) - See the Import VM to CloudCenter API for additional details.

  2. Launch a new deployment using the Submit Job (v2) API (using this API – you can specify the Node ID for each tier in the application and the API creates a new job deployment with the given set of VMs and returns a new Job ID, the job continues to be in the in progress state until the VM starts communicating with the CCO. All actions, except Terminate and Hide are blocked for this job deployment as long as the job is in the in progress state).

    If you need to execute this use case, you must use the correct Node ID in the the submit job API – the exact Node ID that belongs to the tier that you need to specify.

  3. Retrieve the VM user data for the specified job using the View VM User Data API (this API returns the user data for all the child tiers/jobs associated with each Parent Job ID/Child ID ).

  4. Run the Agent Migration Script (see the next section) on each VM that needs to be imported and launched as part of the submitted job. This script accepts user input and automatically upgrades the agent to the CloudCenter 4.8 version.

  5. After the Agent Migration Script execution, the new agent begins communicating with the CCO through RabbitMQ and you will be able to view the deployed job state and corresponding VM actions.

The Agent Migration Script

This script is intended to ease your migration process from CloudCenter 3.2.6.x to 4.8.1.

You must log into each of the worker VMs and run this script. This script accepts nodeId, userData, and agentBundleURL (fetched using the REST API mentioned in the High-Level Process Flow section above) as input for each VM.

  •  Linux Script

    Use the Linux script as a simple bash script and run it directly.

    #!/bin/bash
     
    if [[ -f /usr/local/osmosix/etc/cloud && $(cat /usr/local/osmosix/etc/cloud) == "vmware" ]]; then
      read -p "Enter the node-id: "
      vmtoolsd --cmd "info-set guestinfo.cliqr.instanceId $REPLY"
    fi
    read -p "Enter the user-data: "
     
    echo "$REPLY" > /tmp/user-data
     
    sed 's/\\//g' /tmp/user-data
     
    echo "Copying the user-data.."
     
    \cp /tmp/user-data /usr/local/osmosix/etc
      
    read -p "Enter the agent bundle URL (Complete URL of the file bootstrap-cliqr-worker.sh): "
    agentBundleURL=$REPLY
     
    touch /tmp/.cliqrNodeAssociation
     
    if [ ! -f "/tmp/.cliqrNodeAssociation" ];
    then
       echo "Lock file does not exist. Aborting.."
       exit 0;
    fi
    if [ -d "/usr/local/agentlite" ];
    then
        echo "Uninstalling Agent Lite.."
        bash /usr/local/agentlite/bin/uninstall.sh
    fi
     
    #check for cliqruser sudo access
    if ! grep -wq "cliqruser" "/etc/sudoers"; then
        if grep -wq "cliqradmin" "/etc/sudoers"; then
            olduser=$(cat /etc/sudoers | grep cliqradmin)
            echo $olduser | sed 's/cliqradmin/cliqruser/g' >> /etc/sudoers
        fi
    fi
      
    echo "Downloading the installer file.."
     
    wget -P /tmp $agentBundleURL
     
    chmod 700 /tmp/bootstrap-cliqr-worker.sh
     
    echo "Running the installer.."
     
    bash /tmp/bootstrap-cliqr-worker.sh upgrade
    

    You must explicitly provide the agentBundleURL based on your setup. For example:

    http://<your bundle server>/bootstrap-cliqr-worker.sh

  •  Windows Script

    Use the Windows script by saving it as a .ps1 file – for example, upgrade.ps1 and execute it using the following command:

    powershell.exe -ExecutionPolicy bypass -file upgrade.ps1
    $file ="C:\Program Files\osmosix\etc\cloud"
    $text = "vmware"
    If(([System.IO.File]::Exists($file))-and (Get-Content $file).Contains($text))
    {
      $nodeId= Read-Host -Prompt "Enter the vmware node id"
      & 'C:\Program Files\VMware\VMware Tools\vmtoolsd.exe' --cmd "info-set guestinfo.cliqr.instanceId $nodeId"
    }
      
    $outputFile = "C:\Program Files\osmosix\etc\user-data"
    Read-Host -Prompt 'Enter user data' | Out-File $outputFile
    Write-Host "Copying the user-data.."
    (Get-Content $outputFile) -replace '\\', '' | Set-Content $outputFile
     
    $url= Read-Host -Prompt "Enter the agent bundle URL (Complete URL of the file bootstrap-cliqr-worker.ps1): "
     
      
    $path = "c:\temp\cliqrNodeAssociation"
    New-Item -itemtype file $path
     
    if(![System.IO.File]::Exists($path)){
       Write-Host "Lock file does not exist. Aborting.."
       exit
    }
    $uninstall = "c:\opt\agentlite\bin\uninstall.ps1"
    if([System.IO.File]::Exists($uninstall)){
       Write-Host "Uninstalling Agent Lite.."
       & $uninstall
     }
     
    Write-Host "Downloading the installer file.."
     
    $storageDir = "c:\temp"
    $webclient = New-Object System.Net.WebClient
    $file = "$storageDir\bootstrap-cliqr-worker.ps1"
    $webclient.DownloadFile($url,$file)
     
    Write-Host "Running the installer.."
     
    if(![System.IO.File]::Exists($file)){
       Write-Host "bootstrap-cliqr-worker.ps1 does not exist. Aborting.."
       exit
    }else{
       Write-Host "Running bootstrap-cliqr-worker.ps1"
       & $file -action upgrade -exec_id 3.2.6
    }

    You must explicitly provide the agent bundle URL based on your setup. For example:

    http://<your bundle server>/bootstrap-cliqr-worker.ps1

Use Case Flow

  1. Import the CloudCenter 3.2.6.x VM(s) - See the Import VM to CloudCenter API for additional details.

  2. Use the Submit Job V2 API with nodeIds as input for each tier level. In case of a scaled job, provide a list of Node IDs for a particular tier (in the following N-Tier deployment example, b5f49223-132d-4b9f-bab0-099268377d2b and fd276f61-60f6-4f0b-a86b-90de83cf61a8). You do not need to specify the instance type in this payload.

    {
        "appId": "33",
        "appVersion": "1.0",
        "name": "jenkins-14",
        "environmentId": 1,
        "parameters": {
            "cloudParams": {
                "cloudRegionId": 1,
                 "cloudProperties": [
                                {
                                    "name": "TenantId",
                                    "value": "xyz"
                                }
                ]
                    }
         },
        "jobs": [{
            "tierId": "34",
            "nodeIds": ["b5f49223-132d-4b9f-bab0-099268377d2b", "fd276f61-60f6-4f0b-a86b-90de83cf61a8"],
             "parameters": {
                  "appParams": [], 
                  "cloudParams" : {
                    "nics": [{
                           "id": "95845aef-995e-42d9-8d63-f2572e3cff9f",
                           "allocationMode": "DHCP",
                           "allocatePublicIp":true,
                           "order": 1
                           }]
                    }
             }
        }]
    }
  3. You can provide one of two Job IDs at this point: You must provide the userData string in the response to the agent migration mentioned in the next step.

    Copy the string that maps to the userData listed in the API response and provide the string to the agent upgrade script when prompted. Do not alter any value in the string. Some of these values are variables that may change based on your cloud usage.

    You can provide either the Parent Job Id or the Child Job ID at this point to View VM User Data. If you use the Child Job ID, be sure to run it for each tier.

    1. Provide the Parent Job ID in the request payload for the View VM User Data API to return the user data for all the child tiers associated with this/these VMs

    2. Provide the Child Job ID for the View VM User Data API to return the user data for the specified job.

      When you copy the userData string, only select the information that is within the double quotes "{...}", but NOT the double quotes themselves. For example, copy just the following information in this example:

      {
               "jobId":"559",
               "numOfNICs":"1",
               "brokerVirtualHost":"/cliqr",
               "agentType":"worker0",
               "bootstrapConfig":"http://<HOST>:<PORT>/release-4.8.1/bundle/bootstrap.json",
               "agentAutoUpgradeURL":null,
               "ldapuser":"cliqruser",
               "gatewayAddress":"<HOST>:<PORT>",
               "agentBundleURL":"http://<HOST>:<PORT>/release-4.8.1/bundle/bootstrap-cliqr-worker.sh",
               "brokerClusterAddresses":"<HOST>:<PORT>",
               "nodeMetadataURL":"http://<HOST>:<PORT>/release-4.8.1/bundle/cloud-node-metadata.war"
      }
      [
         {
            "jobId":"559",
            "nodeIds":[
               "b5f49223-132d-4b9f-bab0-099268377d2b",
               "fd276f61-60f6-4f0b-a86b-90de83cf61a8"
            ],
            "userData":"{
               "jobId":"559",
               "numOfNICs":"1",
               "brokerVirtualHost":"/cliqr",
               "agentType":"worker0",
               "bootstrapConfig":"http://<HOST>:<PORT>/release-4.8.1/bundle/bootstrap.json",
               "agentAutoUpgradeURL":null,
               "ldapuser":"cliqruser",
               "gatewayAddress":"<HOST>:<PORT>",
               "agentBundleURL":"http://<HOST>:<PORT>/release-4.8.1/bundle/bootstrap-cliqr-worker.sh",
               "brokerClusterAddresses":"<HOST>:<PORT>",
               "nodeMetadataURL":"http://<HOST>:<PORT>/release-4.8.1/bundle/cloud-node-metadata.war"
            }"
         }
      ]
      
  4. Apply the script to upgrade the agent – log into each application (worker) VM and run the script provided earlier in the page. This script accepts user input fetched using the View VM User Data API explained in the previous step for the specified node. This example uses the Linux script.

    You must apply the script Each of the worker VMs (application VMs)

    For example, an average WordPress application typically contains three VMs for three tiers – one for the MySQL tier, one for Tomcat tier, and one for the Load balancer tier. Log into each VM for each tier and copy the script using either the Linux or Windows options provided above and run the script on that tier for that node and the agent will be upgraded to CloudCenter 4.8.1. During this process, you must provide the user data details for this tier, which you can retrieve using the View VM User Data API as mentioned in the previous step.

    #!/bin/bash
     
    if [[ -f /usr/local/osmosix/etc/cloud && $(cat /usr/local/osmosix/etc/cloud) == "vmware" ]]; then
      read -p "Enter the node-id: "
      vmtoolsd --cmd "info-set guestinfo.cliqr.instanceId $REPLY"
    fi
    read -p "Enter the user-data: "
     
    echo "$REPLY" > /tmp/user-data
     
    sed 's/\\//g' /tmp/user-data
     
    echo "Copying the user-data.."
     
    \cp /tmp/user-data /usr/local/osmosix/etc
      
    read -p "Enter the agent bundle URL (Complete URL of the file bootstrap-cliqr-worker.sh): "
    agentBundleURL=$REPLY
     
    touch /tmp/.cliqrNodeAssociation
     
    if [ ! -f "/tmp/.cliqrNodeAssociation" ];
    then
       echo "Lock file does not exist. Aborting.."
       exit 0;
    fi
    if [ -d "/usr/local/agentlite" ];
    then
        echo "Uninstalling Agent Lite.."
        bash /usr/local/agentlite/bin/uninstall.sh
    fi
     
    #check for cliqruser sudo access
    if ! grep -wq "cliqruser" "/etc/sudoers"; then
        if grep -wq "cliqradmin" "/etc/sudoers"; then
            olduser=$(cat /etc/sudoers | grep cliqradmin)
            echo $olduser | sed 's/cliqradmin/cliqruser/g' >> /etc/sudoers
        fi
    fi
      
    echo "Downloading the installer file.."
     
    wget -P /tmp $agentBundleURL
     
    chmod 700 /tmp/bootstrap-cliqr-worker.sh
     
    echo "Running the installer.."
     
    bash /tmp/bootstrap-cliqr-worker.sh upgrade

    Once deployed, this VM is at the same level as any VM that you may have imported if you used the UI procedure.


  • No labels