wso2 api-manager configurations for cluster environment - wso2

Environment
So I have a Clustered environment with an API Manager and two gateway workers (the gateways are on a load balancer) and two Identity Servers as Key Managers (Load Balancer).
I get confused when it comes to configuring the below code.
<Environment type="hybrid" api-console="true">
<Name>Production and Sandbox</Name>
<Description>This is a hybrid gateway that handles both production and sandbox token traffic.</Description>
<!-- Server URL of the API gateway -->
<ServerURL>https://gatemgrdev.byui.edu/services/</ServerURL>
<!-- Admin username for the API gateway. -->
<Username>${admin.username}</Username>
<!-- Admin password for the API gateway.-->
<Password>${admin.password}</Password>
<!-- Endpoint URLs for the APIs hosted in this API gateway.-->
<GatewayEndpoint>http://${carbon.local.ip}:${http.nio.port},https://${carbon.local.ip}:${https.nio.port}</GatewayEndpoint>
</Environment>
</Environments>
</APIGateway>
In my Identity Servers I usually point the Server URL to my API Manager. Like so
<ServerURL>https://apimgr.org/services/</ServerURL>
In my API Manager I usually change the configs to this
<GatewayEndpoint>http://gateworker.org,https://gateworker.org</GatewayEndpoint>
So how should I configure the gateway workers? Do I have to do anything to them? Also, I'm I configuring the two above correctly?

You can find the gateway configurations from [1]
[1] https://docs.wso2.com/display/AM210/Clustering+the+API+Manager#ClusteringtheAPIManager-ConfiguringtheGateway
Thanks
Isura.

Related

WSO2 AM Default Server IP Address

I've setup WSO2 API Manager on Ubuntu and everything seems to be working, except, when I go into the API Store and under API Console. When I want to "Try It Out", it doesn't work.
But more specifically, when it fails, it shows the curl command, and it is showing the incorrect IP address for my server. It is showing the default address of: 172.17.0.1
My Question is how to change this.
I have gone into /repository/conf directory and updated the carbon.xml file to change the HostName and MgtHostName settings to reflect my server's IP address.
Is there another place to set something so that 172.17.0.1 is no longer used or referenced?
Change the <GatewayEndpoint> URLs with the correct hostname, in api-manager.xml
<APIGateway>
<!-- The environments to which an API will be published -->
<Environments>
<!-- Environments can be of different types. Allowed values are 'hybrid', 'production' and 'sandbox'.
An API deployed on a 'production' type gateway will only support production keys
An API deployed on a 'sandbox' type gateway will only support sandbox keys
An API deployed on a 'hybrid' type gateway will support both production and sandbox keys. -->
<!-- api-console element specifies whether the environment should be listed in API Console or not -->
<Environment type="hybrid" api-console="true">
<Name>Production and Sandbox</Name>
<Description>This is a hybrid gateway that handles both production and sandbox token traffic.</Description>
<!-- Server URL of the API gateway -->
<ServerURL>https://localhost:${mgt.transport.https.port}${carbon.context}services/</ServerURL>
<!-- Admin username for the API gateway. -->
<Username>${admin.username}</Username>
<!-- Admin password for the API gateway.-->
<Password>${admin.password}</Password>
<!-- Endpoint URLs for the APIs hosted in this API gateway.-->
<GatewayEndpoint>http://${carbon.local.ip}:${http.nio.port},https://${carbon.local.ip}:${https.nio.port}</GatewayEndpoint>
<!-- Endpoint of the Websocket APIs hosted in this API Gateway -->
<GatewayWSEndpoint>ws://${carbon.local.ip}:9099</GatewayWSEndpoint>
</Environment>
</Environments>
</APIGateway>
showing the incorrect IP address for my server. It is showing the default address of: 172.17.0.1
it show an IP address found as local IP (so it may be a docker container or another of your IP addresses)
As already answered, the address can be changed as GatewayEndpoint parameter
When I want to "Try It Out", it doesn't work
Now I will assume that the default certificate is not trusted for the url. Though you may try to open the dev console in the browser and find out more information about it doesn't work
Please note the service port (8243) is different that the management port (9443) so the ssl certificate may not be trusted by the browser for the url
When having a self-signed ssl certificate, try to put the URL in the curl command to your browser and trust the certificate. Then try to call the API again

WSO2 Distributed setup - no access to API via Gateway

I read a lot of information about this topic but I have no answer.
I have 3 servers with following components
server1 - WSO2 IS + OpenLDAP
server2 - WSO2 Gateway
server3 - Publisher + Store
All of theese servers working with LDAP and I have no problems to login to IS, Gateway, publisher and store with my Ldap login.
In Publisher config file I wrote Gateway server2 but when I publish new test API I have access to this API (server3:8243/ddd/v1/aaa), but via gateway I have no access https://server2:8243/ddd/v1/aaa and I got an Error 404.
How I need to configure my WSO2 Publisher or Gateway.
P.S. At this moment I have no genereated ssl keys in a keystore. Can you tell me how to resolve this problem for testing my TEST API?
When you publish an API from the publisher, it pushes the Synapse artifact of the API to the gateway node. But in your case, as you haven't changed any configuration in Publisher/Store node, it points to the server itself.
You can edit the server 3 and point server 2 which is your gateway node. Edit the api-manager.xml file in APIM/repository/conf location.
<APIGateway>
<Environments>
<Environment type="hybrid" api-console="true">
<Name>Production and Sandbox</Name>
<Description>This is a hybrid gateway that handles both production and sandbox token traffic.</Description>
<ServerURL>https://[API-Gateway-Host-or-IP]:9443/services/</ServerURL>
<Username>${admin.username}</Username>
<Password>${admin.password}</Password>
<GatewayEndpoint>http://[API-Gateway-Host]:8280,https://[API-Gateway-Host]:8243</GatewayEndpoint>
</Environment>
</Environments>
</APIGateway>

WSO2 API Manager, new gateway endpoint not woking

I have hosted WSO2 API Manager into my virtual machine with static ip address.
I can open my Carbon, Publisher and Store page by entering these addresses:
https://my.ip.address:9443/publisher
https://my.ip.address:9443/store
https://my.ip.address:9443/carbon
When I add my API in my publisher page, it creates endpoint in 172.x.x.x.x address which is only for internal use.
So in order to have access to my endpoints outside I have written these lines in my \wso2\wso2am-2.1.0\repository\conf\api-manager.xml into APIGateway:
<APIGateway>
<Environments>
<Environment type="hybrid" api-console="true">
<Name>Production and Sandbox</Name>
<Description>This is a hybrid gateway that handles both production and sandbox token traffic.</Description>
<!-- Server URL of the API gateway -->
<ServerURL>https://localhost:${mgt.transport.https.port}${carbon.context}services/</ServerURL>
<!-- Admin username for the API gateway. -->
<Username>${admin.username}</Username>
<!-- Admin password for the API gateway.-->
<Password>${admin.password}</Password>
<!-- Endpoint URLs for the APIs hosted in this API gateway.-->
<GatewayEndpoint>http://${carbon.local.ip}:${http.nio.port},https://${carbon.local.ip}:${https.nio.port},http//my.ip.address:${http.nio.port},https://my.ip.address:${https.nio.port}</GatewayEndpoint>
</Environment>
</Environments>
</APIGateway>
Now when I publish my APIs Production and Sandbox URLs are:
http://my.ip.address:8280/path/to/my/api
https://my.ip.address:8243/path/to/my/api
However, when I try to make requests to my API urls, I get timeout errors.
Why this is happening?
The main problem was that my system administrator didn't open 8280 and 8243 ports for users that outside of local network.

WSO2 Publisher/Store api-manager.xml config GatewayEndpoint with gateway clustering

If i have multiple gateway worker nodes, how can i config the GatewayEndpoint?
I read the post of setup gateway endpoint, it that case just has one gateway worker node. I also had nginx node before WSO2 clustering, so we also need to display final endpoint URL in store to end users. for ServerURL, i can config it as url: "https://mgt.gw.devzone.com/services/" .
<APIGateway>
<Environments>
<Environment type="hybrid" api-console="true">
<Name>Production and Sandbox</Name>
<Description>This is a hybrid gateway that handles both production and sandbox token traffic.</Description>
<ServerURL>https://<API-Gateway-Host>:9443/services/</ServerURL>
<Username>${admin.username}</Username>
<Password>${admin.password}</Password>
<GatewayEndpoint>http://<API-Gateway-Host>:8280,https://<API-Gateway-Host>:8243</GatewayEndpoint>
</Environment>
</Environments>
</APIGateway>
Yes for the ServerURL you should point to the GW Manager node. When specifying the GW worker URLs you need to point to NginX. The GatewayEndpoint you are including here should resolve to NginX and NginX will loadbalance the request between the worker nodes. The URL you add here will be shown in the API Store.

How can I configure WSO2 ESB like Gateway to publish from WSO2 API Manager?

In WSO2 API Manager, I want to use an WSO2 ESB instance in local to publish API. I mean, I configure in /repository/conf/api-manager.xml an ESB instance like Gateway, like this:
<APIGateway>
<Environments>
<Environment type="hybrid" api-console="true">
<Name>Production and Sandbox</Name>
<Description> Description of environment</Description>
<!--ServerURL>https://${carbon.local.ip}:${mgt.transport.https.port}${carbon.context}/services/</ServerURL-->
<ServerURL>https://localhost:8243/services/</ServerURL>
<!--Username>${admin.username}</Username-->
<Username>admin</Username>
<!--Password>${admin.password}</Password-->
<Password>admin</Password>
<!--GatewayEndpoint>http://${carbon.local.ip}:${http.nio.port},https://${carbon.local.ip}:${https.nio.port}</GatewayEndpoint-->
<GatewayEndpoint>http://localhost:8280,https://localhost:8243</GatewayEndpoint>
</Environment>
</Environments>
<EnableGatewayKeyCache>true</EnableGatewayKeyCache>
<EnableGatewayResourceCache>true</EnableGatewayResourceCache>
<ClientDomainHeader>referer</ClientDomainHeader>
</APIGateway>
I followed this article https://docs.wso2.com/display/AM190/Publish+through+Multiple+API+Gateways and I just changed the configuration according to my ESB instance.
The problem is in API publisher, when I want to publish a new API I get follow error:
Failed to change the life cycle status : Invoking lifecycle action "Publish" failed
NOTE: I changed port of serviceURL from 9443 to 8243 because I couldn't show service list of ESB in my browser, and with 8243 I can see it.
Have you done a feature installation on ESB ?
By default WSO2 ESB does not contain certain features that are required for it to serve as the gateway in this scenario. It is not possible to use ESB here, without a feature installation.
Therefore we recommend you to use an instance of WSO2 API Manager itself as the gateway.
The HTTPS servlet transport port of the Gateway needs to be given as the gateway's <serverURL>.