Posts

WSO2 APIM OpenShift Deployment Experience

Image
Hello Guys, In this blog I am going to share my experience in WSO2 API Manager OpenShift deployment where I faced some issues with respect to Persistent Volumes/ Persistent Volume Claims. Environment OpenShift Version 4.x WSO2 APIM version 3.2.0.x Use Case 1- runAsUser SecurityContext I have tried to apply the template yaml to create the resources, following error encountered [userdemo@mycustomhost yaml]$ oc get pods NAME READY STATUS RESTARTS AGE wso2am-pattern-1-am-analytics-dashboard-deployment-1-deploy 0/1 Error 0 13m wso2am-pattern-1-am-analytics-worker-2-deployment-1-deploy 0/1 Error 0 13m wso2am-pattern-1-am-analytics-worker-deployment-1-deploy 0/1 Error 0 13m [appadmin1@apiextappppsb01 yaml]$ oc logs -f wso2am-pattern-1-am-analytics-dashboard-deployment-1-deploy --> Scaling wso2am-pattern-1-am-analytics-dashboard-deployment-1 to 1 --> FailedCreate: ws...

WSO2 API Manager APICTL api-import error

Image
  WSO2 APIM version: 3.2.0.85 APICTL Version:  3.2.4 Recently I have updated my WSO2 API manager version 3.2.0 with latest patch level 85 and tried using api controller for api export/import to a different environment. Earlier it was working fine with default pack 3.2.0 but api import starts giving error while importing the API. Below is the error stack trace in apictl- APICTL errors: apictl import-api --file D:\test\Test001-API_1.0.0.zip -e dev -k Error importing API. Status: 500 Response: {"code":500,"message":"Internal server error","description":"The server encountered an internal error. Please contact administrator.","moreInfo":"","error":[]} apictl: Error importing API Reason: 500 Exit status 1 wso2carbon logs: [2021-10-15 23:42:49,635] ERROR - GlobalThrowableMapper An unknown exception has been captured by the global exception mapper. com.google.gson.JsonSyntaxException: Oct 14, 2021, 10:26:10 AM    ...

WSO2 API Manager APICTL Commands

Image
WSO2 API Manager apictl commands APICTL version used Version: 3.2.4 Build Date: 2021-10-12 03:45:30 UTC Step#1 Environment Add & Remove apictl add-env -e dev --apim <APIM_URL>  apictl add-env -e dev --apim https://localhost:9443  apictl remove env <ENV> apictl remove env dev Step#2 List environment  apictl list envs Step#3 Login to the environment  apictl login <ENV> -u <USERNAME> -p <PASSWORD> -k  apictl login dev -u admin -p admin -k  Step#4 Set API export directory apictl set --export-directory D:\APIMLab\export [path belongs to windows] Step#5 List APIs apictl list apis -e <ENV> -k apictl list apis -e dev -k  Step#6 Export 1 API apictl export-api -n <API-name> -v <version> -r <provider> -e <environment> -k  apictl export-api -n HelloWorld -v 1.0.0 -r admin -e dev -k  Other options apictl export-api --name <API-name> --version <version> --provider <provider> ...

WSO2 APIM Open Shift Deployment YAML error for '@' value in password

Image
In this blog, I would like to share a small but tricky experience while working with Open Shift Deployment of WSO2 API Manager. Scenario I have been using WSO2 APIM deployment template YAML from official Github repository and customized the same as per the environment. The important change was using external database MSSQL Server where the DB & password for respective databases  were created by DBAs. Problem Statement Once I configured the DB details and executed my YAML, it was successful. However when I checked the POD logs it shows below error- found character '@' that cannot start any token. (Do not use @ for indentation)  in 'string', line 286, column 21:               password: @x!~#321228H Cause The password value specified in YAML file contains '@' symbol in the beginning of the password and YAML considered it as indentation and hence caused error   Solution To overcome this problem, we need to either change the db ...

WSO2 APIM Custom Docker Image Run - Permission Denied

Image
Problem Statement Recently I have been trying to build a custom docker image for WSO2 APIM v3.2.0 where I have customised the package and re-built the image using the updated package. Below is the directory structure - ProjectDirectory -Dockerfile -docker-entrypoint.sh -wso2am_3.2.0.zip I ran the command to build the image as $ docker build -t wso2am:3.2.0_01 . Image built successfully and visible as- $ docker images REPOSITORY         TAG          IMAGE_ID     C REATED            SIZE loclahost/wso2am    3.2.0_01   4bg83jd9abg1   2 minutes ago    1.42 GB When I try to run the contianer of respective docker image, it throws error- $ docker run -it -p 8280:8280 -p 9443:9443 --name apimanager wso2am:3.2.0_01 Error contianer_linux.go 370: starting container process caused: exec: "/home/wso2carbon/docker-entrypoint.sh": permission denied: OCI runtime permission d...

WSO2 APIM Docker Image Customization

Image
WSO2 Products Docker Image Customization I have got a use case where I have to do the containerized deployment of WSO2 APIM & Analytics (v3.2.0) on OpenShift. Also, there was a requirement to customize the docker image prior to the deployment on OpenShift. Below are the steps I used to deploy the customized docker image of apim & analytics (dashboard+worker) on OpenShift Cluster- 1. Download the apim, analytics base pack (3.2.0) from official WSO2 WebSite 2. For APIM/Analytics extract the zip package 3. Navigate to $PRODUCT_HOME/bin 4. Locate the file wso2update_linux and make sure file has execute permission or do [chmod +x wso2update_linux] 5. Execute the file ./wso2update_linux [below snippets are for in-place updates for analytics, same applies to apim as well] --------------------------------------------------------------------------------------------- [kumar@dev001 bin]$ ./wso2update_linux Initializing updates with credentials Please press 'enter' to c...

WSO2 APIM Analytics Dashboard Loading Error - SSL Issue

Image
Problem Statement I have configured WSO2 APIM 3.2.0 with Analytics 3.2.0 and configured custom hostname as mydomain in WSO2 API Manager (Custom Hostname Configuration) . I have also disabled the hostname Verification attribute in Analytics dashboard configuration (dashboard.yaml) hostnameVerificationEnabled: false however, when I started analytics dashboard, it shows the success message in the console but once I hit the dashboard url  https://mydomain:9643/analytics-dashbaord, it just came with a black screen with browser console message as- Error getting SSO Auth URL The dashboard logs shows the below message- Unmapped exception feign.RetryableException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target executing GET https://mydomain:9443/api/am/admin/v1/custom-urls/carbon.super ttps://mydomain:9443/api/am/admin/v1/custom-urls/carbon.super Cause The Anal...

WSO2 APIM Changing the hostname for web portals

Image
  Hello WSO2 guys! In this post, I'll show how can you customise the hostname of the respective web portals of API Manager viz. devportal, publisher portal, carbon console and the admin console. Below environment I am using for this demonstration- WSO2APIM 3.2.0 Ubuntu Linux 18.x Do hostfile entry in VM by editing the hostfile as vi /etc/hosts 127.0.0.1       api.mydomain.com First download the WSO2 API Manager from here  (I am using v3.2.0)  Unzip the package as unzip wso2am-3.2.0.zip Navigate to the bin directory <APIM_HOME>/bin Start API Manager as ./wso2server.sh Open the browser and go to https://api.mydomain:9443/carbon & login with default credentials as admin/admin (it works because of hostfile entry)   Navigate to the Service providers If you don't see any provider in the list, then just open two URLs https://localhost:9443/publisher & https://localhost:9443/devportal respectively and refresh the carbon console ...

Installing Docker CE on RHEL 7.7

Image
Installing Docker CE on RHEL 7.7 Configure the Docker Repo This is the scenario where we don't have yum facility to directly pull the packages, rather manually needs to add the repository and then apply yum command to install docker    sudo yum-config-manager - -add-repo   https://download.docker.com/linux/centos/docker-ce.repo Linux Package Requirement Download Link container-selinux-2.74-1.el7.noarch.rpm  http:...

WSO2 API Manager Token API with Password Grant

Image
WSO2 API Manager Token API with Password Grant Recently I came across a situation where I have to use the 'Password' grant type for accessing the token API for WSO2 API Manager.  Problem Statement The default token API access using cURL is available in developer portal as shown in the below screenshot- The corresponding cURL command is-  curl -k -X POST https://localhost:8243/token \ -d " grant_type=password&username=Username&password=Password " \ -H " Authorization: Basic ZmIzOUxXVXRJbm5LcElzRHVFU3RkblRqeGJzYTpxUjMyUmpPNkpZenJFRVZzN1NnbzRyeXo2WHNh " Even, in postman all the parameters are supplied in URL itself. However, this request is more URL centric towards passing the grant type, username& password. In this way the credentials are exposed in the URL itself. So how can we prevent the same to be passed but not in URL i.e. typically in header or body. Solution WSO2 token API facilitates to pass the parameters url-encoded by attaching an extra...