In this tutorial you will learn how to write your own workflow of deployment, add it to the catalog and use it from the ProActive Cloud-Automation Portal.

To do so, we will use the Clearwater framework as an example of service.

To manage our service, we have to create 2 actions: the deployment and the termination. Those actions will be defined as workflows

Clearwater is an open source implementation of IMS (the IP Multimedia Subsystem) designed from the ground up for massively scalable deployment in the Cloud to provide voice, video and messaging services to millions of users. Clearwater combines the economics of over-the-top style service platforms with the standards compliance expected of telco-grade communications network solutions, and its Cloud-oriented design makes it extremely well suited for deployment in a Network Functions Virtualization (NFV) environment.

1 Write the deployment action


  1. Go to ProActive studio

  2. Register with your credentials that you provided

  3. Create a new workflow : 2 tasks will be added, the first one is used to deploy the service thanks to docker-compose, and the second one to export some variables to the ProActive Cloud Automation in order to integrate with the Portal.

  4. For this deployment, we will use docker and docker-compose. So it will be necessary to have these technologies installed on the machine where you want do deploy your Clearwater instance. For this tutorial, we will do it on the Try platform where we have these both technologies installed.

  5. We want to have the possibility to chose the port where the UI will be accessible, the name that will be given to the instance and which infrastructure will be used to deploy Clearwater. So we will add variables to our workflow.



    #{Try} will be transformed into a list in the Cloud-Automation portal when we will have to fill the fields for launching the workflow, if we wanted more elements, we could have written #{try,Openstack} for instance.

  6. So we will have to create a bash task in order to use docker-compose and the work of MetaSwitch team

    #retrieve the name used for containers
    name_Containers=$variables_instance_name
    
    #write the content of the docker-compose to a new file in order to use it for instanciate our clearwater
    echo -e "version: '2'
    services:
      "${name_Containers}etcd":
        image: quay.io/coreos/etcd:v2.2.5
        command: >
          -name etcd0
          -advertise-client-urls http://etcd:2379,http://etcd:4001
          -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001
          -initial-advertise-peer-urls http://etcd:2380
          -listen-peer-urls http://0.0.0.0:2380
          -initial-cluster etcd0=http://etcd:2380
          -initial-cluster-state new
      "${name_Containers}bono":
        image: martinacti/bono
        links:
          - "${name_Containers}sprout"
        ports:
          - 22
          - "3478:3478"
          - "3478:3478/udp"
          - "5060:5060"
          - "5060:5060/udp"
          - "5062:5062"
      "${name_Containers}sprout":
        image: martinacti/sprout
        links:
          - "${name_Containers}homestead"
          - "${name_Containers}homer"
          - "${name_Containers}ralf"
        networks:
          default:
            aliases:
              - scscf.sprout
              - icscf.sprout
        ports:
          - 22
      "${name_Containers}homestead":
        image: martinacti/homestead
        ports:
          - 22
      "${name_Containers}homer":
        image: martinacti/homer
        ports:
          - 22
      "${name_Containers}ralf":
        image: martinacti/ralf
        ports:
          - 22
      "${name_Containers}ellis":
        image: martinacti/ellis
        links:
          - "${name_Containers}homestead"
          - "${name_Containers}homer"
        ports:
          - 22
          - "$variables_port_redirection_UI:80""> "docker-compose.yml"
    
    #execute the command to launch the cluster
    docker-compose up -d
                                                

  7. Now you need to add a JavaScript task which must be called "end_deployment" that depends on the first one



    //initiate a JSON object
    var myObject = {};
    
    //retrieve name of instance and store it in the id field
    myObject.id=variables.get("instance_name");
    
    //put the status RUNNING
    myObject.status="RUNNING";
    
    //get the endpoint of the application, here, this is the address of the dashboard
    myObject.endpoint= "trydev.activeeon.com:"+variables.get("port_redirection_UI");
    
    //put the string version of the JSon into the task result
    result=JSON.stringify(myObject);
                                                
    The goal of this task is to add the information needed from the ProActive Cloud Automation to show when the instance is deployed.

2 Add your deployment action to the ProActive Cloud Automation


Create your first task

  1. You will need to add Generic Info to your workflow.

  2. Now we will configure the workflow so it will be used by the ProActive Cloud Automation service and available on its portal. To do so, workflows have to contain a set of generic information which describes the action thanks. These generic information is clearly defined and always the same.

    pca.service.model Unique ID for your workflow:
    54
    pca.service.type Type of your instance:
    Application
    pca.service.name Name of your service:
    Clearwater
    pca.service.description Description of your service:
    open source implementation of IMS
    pca.action.type Type of action that workflow will provide:
    create
    pca.action.name Name that you will define for your action, for instance:
    Deploy Clearwater
    pca.action.description Description of the action that your workflow provide, example:
    Create a Clearwater instance
    pca.action.origin_state Instance state needed for launching the workflow:
    null
    pca.action.icon URL for icon of your service, here we can use:
    /cloud-automation/styles/patterns/clearwater.png

  3. Then, when you have added the generic information you can click on the Catalog button in the studio and select the bucket Cloud-automation. You will see the workflows that are already in the Catalog. Now you want to add your workflow.



    Click on Add curent workflow to this bucket

  4. Then you can go on ProActive Cloud Automation Portal and see your service in catalog section



3 Write the termination action


  1. Create a new worflow and with 2 variables, one called instance_name and the other infrastructure_name, then, add a bash task

    #the goal will be to delete containers with this instance_name
    docker rm -fv $(docker ps -a -q --filter "name=^[^\w\s]\d*_$variables_instance_name(bono|sprout|ellis|homestead|homer|ralf)_\d$")
                                            
  2. Once the worflow is finished, you will need to add same generic information to the workflow that previously. The important is to put the same pca.service.model for the both worflow, deployement and delete. It is the way that Cloud Automation Portal can link these both workflows together. Here are the information to provide :



    So we have the same pca.service.model, the pca.action.type is delete and pca.action.origin.state is RUNNING because the instance of Clearwater needs to be RUNNING so we can apply the delete on it.

  3. Now, you juste have to add it in the bucket Cloud-automation in the catalog.

  4. You can click on the bin and see that your instance has disappeared.