Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Quick Start: Deploy To Apigee Edge

wwitman edited this page Sep 28, 2015 · 24 revisions

Deploying your Apigee-127 project to Apigee Edge

Why deploy to Apigee Edge?

When Apigee-127 applications are deployed to the Apigee Edge platform, they will take advantage of local optimizations so that they run with the best possible availability, scalability, and performance.

Prerequisites

To deploy your Apigee-127 project to Apigee Edge you'll need:

  • An account on Apigee.com. If you do not have an Apigee.com account, you'll be prompted to create one when your run this command. You can take advantage of an Edge Free account. See the note below for details.
  • An Apigee-127 account configured with your Apigee.com account information. For example: $ a127 account create <my_account>

Note: An Edge Free account includes all of the features of Apigee Edge and can be used for up to 5 million API calls per quarter. While it does not include technical support, you are free to use the Apigee Edge Community forum to ask questions. For details about Edge Free and other pricing options, see Apigee Edge Pricing Features.

Basic steps

Important: If you are using OAuth in your API, see "If you are using OAuth" for steps you must follow before you generate an access token for your API.

If you do not have one, you must create an Apigee-127 account with your Apigee Edge account information. Enter this command and follow the prompts:

a127 account create <my-account>

From the root directory of your Apigee-127 project, run:

a127 project deploy

Apigee-127 bundles up your project and deploys it to Edge. It uses the Apigee account information stored in the currently active Apigee-127 account.

Detailed description

The $ a127 project deploy command uses apigeetool behind the scenes to deploy your Apigee-127 project to Apigee Edge.

The $ a127 project deploy command includes these options:

  • -h or --help

    Prints usage information to standard output

  • -a or --account [account]

    Lets you specify which Apigee-127 account to use. By default, the command takes the currently active account. To see which account is active, do a127 account list.

  • -i or --import-only

    Imports the project to Edge, but does not deploy it.

  • -n or --name [name]

    Overrides the default name for the project. The default name is a127-<project_root_folder_name>. For example, a127-example-project.

  • -main or --main [main]

    Overrides the main Node.js application file. In a new Apigee-127 project, the main file is <project-folder>/app.js.

  • -b or --base [path]

    Overrides the base path for the Apigee Edge API proxy deployment. By default, the base path is /<project-name>.

  • -d or --docs [path]

    Overrides the base path from where your API's documentation is accessed. The default is /docs.

  • -u or --upload

    Uploads Node.js modules to Edge instead of resolving them on Edge. Without this option, it's like running npm install on Edge.

Recommendations on the -u option

When deploying for production, we recommend that you either:

  • use npm shrinkwrap or
  • use the -u option.

If you do neither, the actual version of npm packages that you get may differ from your local environment. If -u is not specified, Edge excutes an npm install, using the package.json file as its reference.

After your project is deployed, Edge will not subsequently update or change any of the modules, unless you redeploy. It's a good practice to lock down the package versions in package.json before deploying your project to a production environment.

Test your API on Edge

$ curl http://ORG-ENV.apigee.net/PROJECT-NAME

Substitute the name of your organization on Apigee Edge, the name of the environment to deploy to (e.g., test), and the name of the deployed project. By default, the name is a127-<project-name>, where <project-name is the name of your Apigee-127 project. You can specify a different name if you deploy with the -n option.

##Examples

$ a127 project deploy -n myproxy

Deploys the project to Apigee Edge as an API proxy named myproxy.

$ a127 project deploy -m myfile.js

Deploys the project to Apigee Edge and configures the main Node.js file to be myfile.js.

If you're using OAuth

If you apply OAuth security to any of your API endpoints, you must follow the steps described here before you generate an access token. You need to add a "/" resource to the product associated with the developer app where you will obtain the keys to generate an access token.

  1. Log on to the Apigee Edge management UI.
  2. Select Publish > Developer Apps and open the developer app that contains the Consumer Key and Consumer Secret that you intend to use to generate an access token.
  3. Click the link to the product that's associated with the app.
  4. In the Product page, click Edit.
  5. In the Paths section under Resources, click + Custom Resource.
  6. Enter "/" as the custom resource (without quotes).
  7. Click Save.
  8. Now you can generate an access token.
Clone this wiki locally