All API calls are directed through the cloud gateways in the traditional model of API management. This approach has inherent limitations such as the following.
- There may be inefficiencies if only the API backend or only the API consumers are not in the cloud.
- Security concerns associated with API calls going through external gateways.
WSO2 API Cloud offers users the hybrid gateway deployment option for deploying API Gateway(s) on-premise. This enables them to get the best of both the API Cloud and API Manager.
- Rapid deployment model and low total cost of ownership: Most of the API management infrastructure (including management user interfaces, the developer portal, and analytics) is in the cloud, which makes it always accessible to you and your subscribers. This cloud-based infrastructure does not require maintenance.
- High performance, security, and compliance: You can put the API gateway anywhere including your own network. This cuts down the network overhead, ensures security and compliance, and removes the need for VPN or another network connectivity solution.
The following are the options that allow you to test the On-Prem gateway with WSO2 API Cloud.
Option 1 - Run the On-Prem gateway using the downloaded binary file
Follow the steps below to configure and test an On-Prem gateway.
Step 1 - Download your On-Prem Gateway
Log in to WSO2 API Cloud (https://api.cloud.wso2.com) as an Admin User
In the API Publisher, click On-Prem Gateways.
- Click Download On-Prem Gateway to start the download.
- You will receive a notification as shown below, when the download begins.
Step 2 - Configure your On-Prem Gateway
- Configure the Gateway by going to
<ON-PREM_GATEWAY_HOME>/bin, and executing the configuration script:
cloud-init.bat --runOn Linux/Mac OS:
Your Gateway will be configured with the required settings to integrate with the API Cloud.
- Provide your email address, organization key, and password.
Your organization key will be displayed as shown below.
- The status of the On-Prem Gateway will be displayed after completion.
Step 3 - Run the on-premise gateway
- Start the API Gateway by going to
<ON-PREM_GATEWAY_HOME>/bin, and executing the startup script:
wso2server.bat --runOn Linux/Mac OS:
- The status of the On-Prem Gateway will be updated after you start the gateway
Step 4 - Test your on-premise gateway
- Log in to WSO2 API Cloud and create an API.
- Subscribe to and invoke the API.
- Invoke the API using curl .
The curl command to invoke the GET method of the API should be similar to the following:
Replace https://gateway.api.cloud.wso2.com:443 in the above curl command with your on-premise gateway URL as indicated below, and run it. The response to this curl should be identical to that received in the previous step.
Note that you can also use the HTTP port for API invocations. The HTTP port number would be 8280 by default. An example is given below.
When you run multiple On-Premise gateways on the same server or virtual machine (VM), you must change the default port of each Gateway with an offset value to avoid port conflicts. An offset defines the number by which all ports in the runtime (e.g., HTTP/S ports) will be increased. For example, if the default HTTPS port is 8243 and the offset is 1, the effective HTTPS port will change to 8244. For each additional On-Premise Gateway instance that you run in the same server or virtual machine, you have to set the port offset to a unique value. The offset of the default port is considered to be 0.
There are two ways to set an offset to a port:
- Pass the port offset to the server during startup. The following command starts the server with the default port incremented by 1.
- Set the port offset in the Ports section in the
<ON-PREM_GATEWAY_HOME>/repository/conf/carbon.xmlfile as shown below.
If your request is successful, your response will be similar to the following.
Option 2 - Run the On-Prem gateway as a docker container
Before you begin...
Install Docker. For instructions, go here.
Log in to docker.cloud.wso2.com with your username and password.
Pull the docker image. A sample command is given below.
Run the docker container.
- Test your On-Prem gateway.
- If you create/update an API and publish/re-publish it from API Cloud Publisher, it could take up to a maximum of 10 minutes before your changes become effective in the on-premise gateway.
- If you create/update a throttling tier from API Cloud, it could take up to a maximum of 15 minutes before your changes become effective in the on-premise gateway.
- Statistics of API usage in your on-premise gateway are published to API Cloud every 6 - 6.5 hours.
Overriding the default gateway configurations
Replace the default configurations in the
on-premise-gateway.propertiesfile with the required custom configurations.
To customize the synchronization time interval of the API updates:
api.update.task.cronexpression with a custom cron expression.
To customize the synchronization time interval of the Throttling tiers:
throttling.synchronization.cronexpression with a custom cron expression.
To customize the time period it takes for API statistics to get published to API cloud:
file.data.upload.task.cronexpression with a custom cron expression.