Deploy an API Builder Standalone application to AMPLIFY Runtime Services
This topic describes how to create, Dockerize, and publish an API Builder Standalone application to the AMPLIFY Runtime Services cloud. Prerequisites, instructions, and references are provided to help you successfully deploy and publish your application to the AMPLIFY Runtime Services cloud and to test your published application.
The following sections describe the prerequisites.
AMPLIFY Platform account
You need to have an account on https://platform.axway.com.
The installation of Docker is via a dedicated installer for your specific operating system. For additional Docker installation information, refer to the Docker documentation.
API Builder CLI
The API Builder CLI is a node module published in the npm public repository.
$ npm install -g @axway/api-builder
For additional API Builder CLI installation information, refer to the API Builder Getting Started Guide.
AMPLIFY Cloud Services (ACS) CLI
The AMPLIFY Cloud Services CLI (ACS) is a node module published in the npm public repository. To install, execute the following command:
For additional AMPLIFY Cloud Services CLI information, refer to the AMPLIFY Runtime Services Command-Line Interface Reference.
Create your application
API Builder CLI usage can be found here. This the setup found in the API Builder Getting Started Guide. This will create a "myproject" sub-directory.
$ api-builder init myproject
Create your Platform application
Log in to the AMPLIFY Platform using your https://platform.axway.com username and password. Create a project in the cloud with the same name as your "myproject" sub-directory. Then, configure your project to use PORT 8080. This is because the container is built with PORT 8080 by default.
$ acs login
$ acs new myproject --force
$ acs config --set PORT=8080 myproject
Build a Docker image
To build a Docker image of your project, execute the following commands.
$ cd ./myproject
$ docker build --tag demo-image ./
Publish image to Platform
To publish the Docker image of your project to the Platform, execute the following command.
$ acs publish myproject --delete_oldest --force --image demo-image --app_version 0.1
Once the image is written, note the URL, as you will use it to test your API, for example:
App will be available at https://<guid>.cloudapp-enterprise.appcelerator.com
Check publish status
Even though your image was sent to ARS, it can take up to 10 minutes to start (for example,
Status: Deploying). You should check the
Status of your project before trying to access your service that is running in the cloud. The service will not be available until status shows
You can also check the log of your project to see if it started properly.
Try your application
To try your application in the cloud, you will require your API key, which can be found in "myproject/conf/default.js". On successful publication of your project, you also received a URL with a GUID prefix to access your application from the Internet. Replace the <key> and <guid> with the API key and GUID values in the following command.
$ curl -u "<key>:" https://<guid>.cloudapp-enterprise.appcelerator.com/api/greet?username=Bob