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

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.

Related

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 api-manager configurations for cluster environment

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.

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>.

How do I configure WSO2 API Manager Gateway and Key Manager Cluster settings?

I'm working on implementing WSO2 API Manager with the following architecture:
A single publisher/store node.
A 2 node cluster that both servers run the Gateway and key Manager on.
When I'm following: http://docs.wso2.org/display/CLUSTER420/Clustering+API+Manager#ClusteringAPIManager-Configuringcomponentfeatures
and I get to the step for "Configuring the connections among the components" for api-manager.xml
I'm confused when configuring the gateway for:
<APIKeyManager>
<ServerURL>https://keymanager.apim-wso2.com:9444/services/</ServerURL>
<Username>admin</Username>
<Password>admin</Password>
...
</APIKeyManager>
Should each gateway/key manager node for API Key Manager point to itself?
Further since my Publisher and Store are on a different server when I configure their api-manager.xml for the authmanager and APIGateway do I point that to the cluster name?
When configuring:
<AuthManager>
<ServerURL>https://keymanager.apim-wso2.com:9444/services/</ServerURL>
<Username>admin</Username>
<Password>admin</Password>
</AuthManager>
<APIGateway>
<Environments>
<Environment type="hybrid">
<ServerURL>https://gwmanager.apim-wso2.com:9445/services/</ServerURL>
<Username>admin</Username>
<Password>admin</Password>
<GatewayEndpoint>http://gwmanager.apim-wso2.com:8282,https://gwmanager.apim-
wso2.com:8245</GatewayEndpoint>
</Environment>
</Environments>
</APIGateway>
Before answering your question let me explain the how they pointed.
When configuring the gateway, you need to specify keymanager.
When configuring the store, you need to specify both keymanager and gateway.
When configuring the publisher, you need to specify gateway.(Before 1.4.0 publisher also needed key manager too)
First one is needed since the gateway get requests for accessing APIs, those requests must be authenticated. So gateway should know the endpoints of keymanager.
On the other hand when creating new APIs its needed to trigger gateway about them, hence publisher needed to know the endpoints of gateway as in 3rd.
Similarly Store needed to about both Keymanager and gateway.
This is also illustrated by the diagram given in "Configuring the connections among the components"
Assuming (according to [1]) the gateway+keymanager is in the same node of your deployment, yes element in gateway+keymanager node should be configured to point to itself.
For example,
<APIKeyManager>
<ServerURL>https://gateway-plus-keymanager.apim-wso2.com:9444/services/</ServerURL>
<Username>admin</Username>
<Password>admin</Password>
...
</APIKeyManager>
And similarly if you have store+publisher node
<APIKeyManager>
<ServerURL>https://gateway-plus-keymanager.apim-wso2.com:9444/services/</ServerURL>
<Username>admin</Username>
<Password>admin</Password>
...
</APIKeyManager>
<AuthManager>
<ServerURL>https://gateway-plus-keymanager.apim-wso2.com:9444/services/</ServerURL>
<Username>admin</Username>
<Password>admin</Password>
</AuthManager>
<APIGateway>
<Environments>
<Environment type="hybrid">
<ServerURL>https://gateway-plus-keymanager.apim-wso2.com:9444/services/</ServerURL>
<Username>admin</Username>
<Password>admin</Password>
<GatewayEndpoint>http://gateway-plus-keymanager.apim-wso2.com:8281,https://gateway-plus-keymanager.apim-wso2.com:8244</GatewayEndpoint>
</Environment>
</Environments>
</APIGateway>
Here note that the node gateway+keymanager node has the host name gateway-plus-keymanager.apim-wso2.com and started the server with a port offset 1.
[1] How do I configure WSO2 API Manager Gateway and Key Manager Cluster settings?
If you are using a DNS round robin then both the serverURL's should point to https://gateway-plus-keymanager.apim-wso2.com:9444/services/ and your DNS should be configured to have the IP's of both GW/KM servers
Hi I believe you have a issue in the deployment architecture. There is no point in having two Gateway (GW) nodes if you are not fronting them with a load balancer (LB). So your GW/KM 2 nodes should be fronted with Load balancer. The KM URL you point in the GW nodes should actually point to the (LB) that can distribute the traffic among two KM nodes.