How do you configure WS02 to use different endpoints URIs in different environments? - wso2

We are evaluating multiple ESB products currently (Mule, Fuse and WSO2), and one of our key requirements is to easily migrate services between multiple environments. I can see how this can be done in WSO2 with g-reg for the most part, but am struggling to see how we would parametrise the endpoint uris and maintain them separately in each environment? (This seems fairly trivial in Mule and Fuse).

The preferred way is:
Create/save ALL endpoints as registry resource (either using management console or Developer Studio)
Since the endpoints are saved in the registry, now the ESB configuration is totally independent of the environment. (We can create a Carbon Application out of this, which is basically can be deployed in any environment)
So, if you need to move the configuration from dev->qa, you can use the same .car file created

Related

What is the best Practices to exporting wso2

What is the best to exporting API & EndPoint & DataService on WSo2 ?
usually I export the API & EndPoint in same car.file then exporting dataservice in other carbon file
If your APIs and the Dataservices depend on each other it may be best to package them together. If not, packaging them together would introduce unnecessary downtime to the other service when updating one service. (Redeploying an API would redeploy the Data services). Also, Carbon Applications are deployed in alphabetical order. So if you have anything that depends on the deployment order you can prefix the carbon application with a number or a letter. For example 1_APIServices.car, 2_AppDataServies.car. So they will always be deployed in a certain order on server restart.
This is based on the use cases and requirements. If you want to reuse the data service or the API, then you can have them in separate car files and deploy. Otherwise you can have those in a single car file.

WSO2 APIM - api file deployment

deploying the WSO2 APIM 2.1.0 using puppet, we consider to deploy the API itself with the CICD as well.
In theory - I could copy (template) the synapse files (proxy, api) and the api is available for the call, however - the API is not visible in the store. I assume there's more data in the database than just a synapse config file.
Is there a way to define / deploy API (including to the store) using the configuration files or it needs to be done manually?
Edit:
I thought there's a way to deploy API using the API Admin Services. But when calling addAPI with the metadata XML, looks ok. But trying to see the API in the publisher throws an exception
ERROR - index:jag org.wso2.carbon.apimgt.api.APIManagementException: Unable to find the API: admin-myapi-v1.0.0 in the database
Thank you for any hint
g.
Based on your requirements it looks like you can use one of the following options.
Migrate APIs - You can export APIs from one environment and import those APIs to the new environment. When you import APIs in the new environment, those APIs will be in created state. You need to manually publish those APIs. May be using the jaggery API or REST API you will be able to publish the APIs.
REST API
Jaggery API - This is deprecated at the moment and discourage for using this.
Once you create the APIs, APIs related details will be saved in the database. Additionally, synapse configuration can be found in the file system. If you point the previous database to the new deployment and deploy the synapse artifacts, APIs will work. But then again API creation/publishing and entire flow will not be tested. For CICD, you need to consider above mentioned options. In the future releases, there is more focus towards the REST API and it will be more useful for the CICD.

WSO2 ESB How to upload app config xml files

I need to work around a weird behaviour of WSO2 ESB. Whenever the ESB is started, all carbon files are redeployed. This means to reset all changes made in files after last deploy(restart), such us, configuration xml files (endpoints, custom config files...) .
So I guess the only way to avoid modifing this configuration files during the start up is to take them out from the carbon file. Thus, I would upload app files as carbon app, and app config files (EP, custom config files...) using an alternative way.
So, in this situation, how could I upload these config files in and easy and automatic way?
Regards
I presume you are using a CApp (Carbon Application) to deploy the esb artifacts like endpoints. The number rule for this procedure is that you need to do all the modifications you need to do via the WSO2 Developer Studio, build a CApp, and re-deploy it in WSO2 ESB. You should try to avoid using management console to perform esb artifact (proxy services, endpoints, sequences, templates etc.) modifications. You can of course use the management console for other administrative tasks like configuring data-sources, BAM mediation data publishing etc.
If you are using the Management console to modify artifacts, then you can do that too, but avoid using CApps as the method of deploying esb artifacts. You should probably copy all the config xml files to relevant folders at $ESB_HOME/repository/deployment/server/synapse-configs/default/. And then go ahead with your modifications via mgt console.

limitations of running WSO2 Carbon 4.x and WSO2 Carbon based products in webapp mode?

WSO2 Carbon is not officially supported in webapp mode (see the selected answer here). However, I have no choice - If I want to run carbon, it must be run in webapp mode.
There are some detailed instructions here for setting up carbon 4.x in webapp mode.
I am concerned is that standalone mode is strongly recommended by WSO2.
My Questions are: What are the limitations:
when running Carbon 4.x in webapp mode?
when running other Carbon based products (e.g. ESB, AS, etc) in webapp mode?
If possible, please provide a detailed list of the limitations.
Limitations:
When you take the ESB, as you might have seen it exposes ports 8280/8243 (HTTP/HTTPS) in addition to 9763/9443 which is exposed through the servlet transport. In the case of ESB you need (and want) to use port 8280/8243 when you're interacting with the ESB because those are the two non-blocking high performant transports. When you deploy ESB on top of another web container, you're limited by the servlet transports provided by the container. So we can't get the desired performance out of the ESB for proxying and other scenarios.
Complexities involving using web container functionalities. Carbon has its own clustering/caching/security etc... infrastructure. When you deploy Carbon as a webapp then we should look at supporting all those functions provided by the container for different containers. Which is complex, not consistent and in some cases sub-optimal
IMHO those were the two most important factors why it's discouraged to deploy Carbon on top of other containers. Going with a standalone deployment approach it has contributed immensely to not include web container specific "hacks" into the platform to get things done and have a much cleaner consistent platform.
One issues with deploying Carbon in web-app mode is that this deployment model is not supported by WSO2. I will add more issues to this answer as I encounter them...
AFAIK, webapp is not supported... Please refer this thread :Running WSO2 Carbon as Web Application in Tomcat
Regards,
Mohan

Best way to deploy a web site alongside an axis2 web service via Tomcat?

I am using Axis2 (1.5.3 currently) and Tomcat (6.0.26 currently) and am running a web service. I would like to also host HTML pages for configuring the web service.
What is the best way to go about this? I assume keeping the same context is key, but perhaps it is not.
My current distribution is located under a folder structure similar to this:
Tomcat/webapps/mycompany
With the actual service code here:
Tomcat/webapps/mycompany/WEB-INF/services/myService
In a browser, I can hit my web service by going to here:
/mycompany/services/myService
I note that I can drop actual HTML files in this path and Tomcat will, indeed serve them up.
For instance, if I put "index.html" under Tomcat/webapps/mycompany, I can navigate to /mycompany/index.html and see my html.
What I want to do is have this HTML be attached to JAR/class files that can interact with the already-existing service class files in the same context as the service. Therefore, I can have the browser configure the web service directly.
Is this possible, and is there a tutorial or something out there that will help me with this? Note that I have been working with Tomcat and Axis2 for a while now for this particular web service, but I have never actually deployed a web application/html using Tomcat before.
Thanks.
First of all what do you mean by a configuring a service. Normally in SOA world services are analogous to interfaces. IMHO you can just change a service, since their are other users that rely on the services you are exposing.
If i want to change a service i would rather introduce a new version of the service after deprecating the existing one.
Are you talking about applying QoS to existing serviecs. Then that makes sense.
Anyway, If you want to have a web-app alongside with axis2 service engine, it is possible. If you look inside the axis2 war file you'll find the web.xml entry to Axis2Servlet. It is this servlet that serves the web services requests.
So, what you need is the Axis2Servlet mapping in your web-app along with your usual servlet-mappings. Number of possible ways to configure your services using web-app files. One options is to use web-services call itself to (with authentication) to configure it.
By "configure a service", take this example:
The service has a set of datasets.
Each dataset exists in a separate database.
The service can manage 0..n datasets.
The service must be configured to know about each dataset.
This is what I'm configuring. I'm not trying to configure Axis itself or redefine the service.
I would like to host the HTML using the same instance of Tomcat that I'm hosting the web service with. It needs to manage sessions, have login capability, an whatnot, and has to be able to configure the web service live.
From what I'm reading, it's probably best to make an interface to the web service that the web application module can call into from a different context.
Is there a better way?