mex-docs

Deploy a VM to MeX

This will walk you through the steps required to deploy a VM using the MeX console.

One slightly confusing bit is that we do refer to the VM as an Application within our interface and within the api calls. For our purposes, you can think of the VM as just one type of application that we can deploy.

Prerequisites:

Download the VM Image File

Upload the VM Image to MeX Artifactory

Upload Example

```

Upload Example

$ curl -q -u demo -T ./CentOS-7-x86_64-GenericCloud.qcow2 "https://artifactory.mobiledgex.net/artifactory/repo-demoorg/CentOS-7-x86_64-GenericCloud.qcow2" --progress
Enter host password for user 'demo':
{
  "repo" : "repo-demoorg",
  "path" : "/CentOS-7-x86_64-GenericCloud.qcow2",
  "created" : "2020-04-09T14:23:27.958Z",
  "createdBy" : "demo",
  "downloadUri" : "https://artifactory.mobiledgex.net/artifactory/repo-demoorg/CentOS-7-x86_64-GenericCloud.qcow2",
  "mimeType" : "application/octet-stream",
  "size" : "941359104",
  "checksums" : {
    "sha1" : "0a60d34921a5e922aeacfeece13bd5ccfb024cb3",
    "md5" : "ec8c38b1656ded3e03a6dc0938e201f1",
    "sha256" : "b376afdc0150601f15e53516327d9832216e01a300fecfc302066e36e2ac2b39"
  },
  "originalChecksums" : {
    "sha256" : "b376afdc0150601f15e53516327d9832216e01a300fecfc302066e36e2ac2b39"
  },
  "uri" : "https://artifactory.mobiledgex.net/artifactory/repo-demoorg/CentOS-7-x86_64-GenericCloud.qcow2"
}%

Deploy the VM via the MeX Console

Create an App

Create an Application Instance

Test Your VM

Create VM via Edge Orchestration API

Note that this section just shows the API calls based on the documentation that is current at the time of this writing. As we do not currently have access to a working endpoint these calls are provided as they are pulled from the documentation base.

Once we have access to an endpoint we will run tests and update this documentation to use the correct payload data.

API Flow

  1. Login and get bearer token.
  2. Create an App.
  3. Create an App Instance.
  4. Retrieve connect information for the created VM Instance.

Login / Retrieve Token

Request

POST api/v1/login
{
  "username": "string",
  "password": "string"
}

Response

{
  "token": "string"
}

Create an App

Request

POST api/v1/auth/ctrl/CreateApp
{
  {
  "Region": "string",
  "App": {
    "key": {
      "name": "string",
      "organization": "string",
      "version": "string"
    },
    "deployment_generator": "string",
    "md5sum": "string",
    "deployment": "string",
    "default_privacy_policy": "string",
    "access_type": 0,
    "delete_prepare": true,
    "image_path": "string",
    "del_opt": 0,
    "image_type": 0,
    "internal_ports": true,
    "default_flavor": {
      "name": "string"
    },
    "revision": 0,
    "fields": [
      "string"
    ],
    "auto_prov_policy": "string",
    "android_package_name": "string",
    "official_fqdn": "string",
    "default_shared_volume_size": 0,
    "scale_with_cluster": true,
    "configs": [
      {
        "kind": "string",
        "config": "string"
      }
    ],
    "command": "string",
    "auth_public_key": "string",
    "deployment_manifest": "string",
    "access_ports": "string",
    "annotations": "key1=val1,key2=val2,key3=\"val 3\""
  }
}
}

Response

{
  "message": "string"
}

Deploy an App Instance

Request

POST api/v1/auth/ctrl/CreateAppInst
{
  "Region": "string",
  "AppInst": {
    "key": {
      "cluster_inst_key": {
        "organization": "string",
        "cluster_key": {
          "name": "string"
        },
        "cloudlet_key": {
          "name": "string",
          "organization": "string"
        }
      },
      "app_key": {
        "name": "string",
        "organization": "string",
        "version": "string"
      }
    },
    "state": 0,
    "flavor": {
      "name": "string"
    },
    "cloudlet_loc": {
      "course": 0,
      "speed": 0,
      "latitude": 0,
      "timestamp": {
        "nanos": 0,
        "seconds": 0
      },
      "horizontal_accuracy": 0,
      "altitude": 0,
      "vertical_accuracy": 0,
      "longitude": 0
    },
    "auto_cluster_ip_access": 0,
    "update_multiple": true,
    "liveness": 0,
    "revision": 0,
    "external_volume_size": 0,
    "fields": [
      "string"
    ],
    "availability_zone": "string",
    "created_at": {
      "nanos": 0,
      "seconds": 0
    },
    "crm_override": 0,
    "mapped_ports": [
      {
        "public_port": 0,
        "tls": true,
        "end_port": 0,
        "path_prefix": "string",
        "proto": 0,
        "fqdn_prefix": "string",
        "internal_port": 0
      }
    ],
    "uri": "string",
    "errors": [
      "string"
    ],
    "health_check": 0,
    "runtime_info": {
      "container_ids": [
        "string"
      ]
    },
    "vm_flavor": "string",
    "configs": [
      {
        "kind": "string",
        "config": "string"
      }
    ],
    "power_state": 0,
    "shared_volume_size": 0,
    "privacy_policy": "string",
    "status": {
      "max_tasks": 0,
      "task_name": "string",
      "task_number": 0,
      "step_name": "string"
    },
    "force_update": true
  }
}

Response

{
  "message": "string"
}

Test Your VM

Get FQDN and Port; payload content is used to filter.

Request

POST api/v1/auth/ctrl/ShowAppInst
{
  "Region": "string",
  "AppInst": {
    "key": {
      "cluster_inst_key": {
        "organization": "string",
        "cluster_key": {
          "name": "string"
        },
        "cloudlet_key": {
          "name": "string",
          "organization": "string"
        }
      },
      "app_key": {
        "name": "string",
        "organization": "string",
        "version": "string"
      }
    },
    "state": 0,
    "flavor": {
      "name": "string"
    },
    "cloudlet_loc": {
      "course": 0,
      "speed": 0,
      "latitude": 0,
      "timestamp": {
        "nanos": 0,
        "seconds": 0
      },
      "horizontal_accuracy": 0,
      "altitude": 0,
      "vertical_accuracy": 0,
      "longitude": 0
    },
    "auto_cluster_ip_access": 0,
    "update_multiple": true,
    "liveness": 0,
    "revision": 0,
    "external_volume_size": 0,
    "fields": [
      "string"
    ],
    "availability_zone": "string",
    "created_at": {
      "nanos": 0,
      "seconds": 0
    },
    "crm_override": 0,
    "mapped_ports": [
      {
        "public_port": 0,
        "tls": true,
        "end_port": 0,
        "path_prefix": "string",
        "proto": 0,
        "fqdn_prefix": "string",
        "internal_port": 0
      }
    ],
    "uri": "string",
    "errors": [
      "string"
    ],
    "health_check": 0,
    "runtime_info": {
      "container_ids": [
        "string"
      ]
    },
    "vm_flavor": "string",
    "configs": [
      {
        "kind": "string",
        "config": "string"
      }
    ],
    "power_state": 0,
    "shared_volume_size": 0,
    "privacy_policy": "string",
    "status": {
      "max_tasks": 0,
      "task_name": "string",
      "task_number": 0,
      "step_name": "string"
    },
    "force_update": true
  }
}

Response

{
  "message": "string"
}

Note that this needs further testing, but it looks like we want to grab the following stanza from the response:

"mapped_ports": [
  {
    "public_port": 0,
    "tls": true,
    "end_port": 0,
    "path_prefix": "string",
    "proto": 0,
    "fqdn_prefix": "string",
    "internal_port": 0
  }
],
"uri": "string"

Now you can ssh into the system (provided the system is running an ssh server and accepting connections on that port)