Hosted Targets overview (Beta)

Hosted Targets lets you run Node.js applications in a native runtime environment hosted by Apigee. The goal of Hosted Targets is simple: allow you to deploy applications in a native, secure, scalable, and isolated environment where Edge API proxies can call them as target services.

For example, as shown below, an Edge API proxy calls a Node.js application that is deployed to the Hosted Targets environment. Note that the Hosted Targets environment is scoped within an Apigee organization/environment.

As explained in the following sections, getting an Edge API proxy to talk to a properly built and deployed Hosted Targets application requires a simple configuration in the proxy's Target Endpoint.

What application runtimes does Hosted Targets support?

You can only deploy Node.js apps to Hosted Targets.

Installing Hosted Targets

Hosted Targets Beta is available in all Edge Public Cloud orgs. You do not need to install anything to use Hosted Targets.

Verifying that the Hosted Targets is enabled

To verify that your organization has Hosted Targets enabled, get your organization details and ensure that the features.isEdgeFunctionsEnabled property is set to true. The property is read-only.

For example:

https://api.enterprise.apigee.com/v1/organizations/myorg

  {
     "createdAt":1507572884047,
     "createdBy":"jdoe@apigee.com",
     "displayName":"myorg",
     "environments":[
        "prod",
        "dev",
        "test",
        "portal"
     ],
     "lastModifiedAt":1507578673194,
     "lastModifiedBy":"jdoe@apigee.com",
     "name":"jdoe",
     "properties":{
        "property":[
           {
              "name":"features.isSmbOrganization",
              "value":"false"
           },
           {
              "name":"self.service.virtual.host.enabled",
              "value":"true"
           },
           {
              "name":"features.isCpsEnabled",
              "value":"true"
           },
           {
              "name":"features.isEdgeFunctionsEnabled",
              "value":"true"
           }
        ]
     },
     "type":"paid"
  }
  

What you need to know about Hosted Targets

Hosted Targets allows Node.js applications to run in a native environment that does not depend on any Apigee-specific run-time technology. You can debug and test your app locally before deploying it and be assured that the deployed version will work exactly as it does locally. At deployment time, you can choose any application runtime version for running your application in Hosted Targets. For example, you might specifically choose to run a Node.js app in a v8.10.0 environment.

In a nutshell

If you are familiar with Edge proxy development, you only need to learn a few simple steps to use Hosted Targets successfully. Essentially, you create, deploy, and manage Edge proxies for Hosted Targets just as you do for any other Edge proxy.

To use Hosted Targets, you need to do these tasks:

  • Develop and test your Node.js application locally.
  • Create a manifest file in the root directory of your application project. The manifest is a YAML file that specifies information needed to build and deploy the application.
  • Add your application to the Edge proxy as a hostedresource type.
  • In the proxy's Target Endpoint, add an empty <HostedTarget/> tag. This tag tells Edge to deploy the Node.js application to the Hosted Targets environment. For example:
  •         <?xml version="1.0" encoding="UTF-8"?>
            <TargetEndpoint name="default">
               <PreFlow name="PreFlow">
                  <Request />
                  <Response />
               </PreFlow>
               <PostFlow name="PostFlow">
                  <Request />
                  <Response />
               </PostFlow>
               <Flows />
               <HostedTarget />
            </TargetEndpoint>

We'll walk you through these tasks in the tutorials

Scope of Hosted Targets applications

Hosted Targets applications are scoped to an Edge organization-environment. This scoping is the same as for any Edge proxy.

How Hosted Targets differs from existing custom Node.js application support in Edge

Apigee Edge has supported the use of Node.js applications in API proxies for a long time. This section describes how this traditional support differs from a Hosted Targets approach.

Traditional Edge Node.js support relies internally on an open-source bridge application (Trireme) and a JavaScript interpreter (Rhino) that allow Node.js code to execute in the Edge Java runtime environment.

There are several limitations associated with this approach. For example:

  • Only an older version of Node.js (0.10.32) is supported.
  • There are subtle differences in behavior between the standard Node.js environment and the Trireme/Rhino environment.
  • Debugging Node.js apps after they are deployed to Edge is difficult.

Node.js apps deployed to Hosted Targets do not depend on any Apigee-specific Node.js run-time technology. Your Node.js app will run in Hosted Targets exactly as it runs in your local development environment.

Can Hosted Targets applications access proxy data?

Hosted Targets apps do not currently have access to the proxy runtime environment. This means that you can't access flow variables, caches, and other entities directly from Hosted Targets applications.

Migrating existing application code to Hosted Targets

There is currently no automated migration path from traditional Node.js code to Hosted Targets. However, you can convert existing application code to Hosted Targets manually. For an example, see Migrating an existing Node.js proxy to a Hosted Targets proxy.