Tuesday, May 18, 2021

Can't update npm to newest version on Ubuntu

First, I install npm

sudo apt-get install -y npm

Which installs npm version 3.5.2. Then I try to update it to newest version and it fails. Could not find a proper solution for this.

sudo npm install npm@latest -g
▌ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine npm@7.5.2: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine npm@7.5.2: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":/usr/local/lib
└── (empty)

npm ERR! Linux 4.15.0-135-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "npm@latest" "-g"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! path /usr/local/lib/node_modules/.staging/@npmcli/ci-detect-c7bf9552
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/@npmcli/ci-detect-c7bf9552' -> '/usr/local/lib/node_modules/npm/node_modules/@npmcli/ci-detect'
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/@npmcli/ci-detect-c7bf9552' -> '/usr/local/lib/node_modules/npm/node_modules/@npmcli/ci-detect'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /home/some/path/npm-debug.log
npm ERR! code 1

Sulution

I had the exact same issue, after some research I found this post. Several options are given in this article, Option 1 with nvm installation worked for me.

sudo apt update

sudo apt install build-essential checkinstall libssl-dev

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.1/install.sh | bash

nvm --version

nvm ls-remote

nvm install [version.number]

More info in this post: https://phoenixnap.com/kb/update-node-js-version


REF: https://superuser.com/questions/1623517/cant-update-npm-to-newest-version-on-ubuntu

 

Sunday, May 16, 2021

WSO2 - ESB Create Mediator with JSON

 Create CustomMediator extend AbstractMediator 


import org.apache.synapse.commons.json.JsonUtil;

import org.apache.synapse.mediators.AbstractMediator;


public class CustomMediator extends AbstractMediator {

 public boolean mediate(MessageContext context) {

   //Read JSON from  Axis2 context

   String jsonAsString =  JsonUtil.jsonPayloadToString(((Axis2MessageContext) context)

                    .getAxis2MessageContext());

   ..........

    //Write JSON to  Axis2 context

    String convertedJsonPayloadObject =....;

    JsonUtil.newJsonPayload(((Axis2MessageContext) context).getAxis2MessageContext(),convertedJsonPayloadObject, true, true);

   return  true;

 }

}

Nginx Ingress with rewrite annotation

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: abc-ingress
  namespace : default
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
    nginx.ingress.kubernetes.io/ssl-ciphers: "ALL"
    nginx.ingress.kubernetes.io/ssl-prefer-server-ciphers: "true"
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  tls:
  - hosts:
    - abc.com
  rules:
  - host: abc.com
    http:
      paths:
      - path: /something(/|$)(.*)
        backend:
          serviceName: abc-service
          servicePort: 8080
  tls:
  - hosts:
    - abc.com
    secretName: abc-secret

With config above:
  • The request https://abc.com/something will send to backend as  https://abc.com/
  • The request https://abc.com/something/somepath will send to backend as  https://abc.com/somepath 

Thursday, May 13, 2021

debezium - Oracle Connector

 If you want to use the Oracle connector it is necessary to add dependencies that are not part of the image due to licensing restrictions. In this case you should create a new image derived from this one and bake-in Oracle Instant Client JAR files.

The files in question are available as oracle Instant Client for Linux. Please follow an example so see how the resulting image should be structured.




ARG DEBEZIUM_VERSION
FROM debezium/connect:$DEBEZIUM_VERSION
ENV KAFKA_CONNECT_JDBC_DIR=$KAFKA_CONNECT_PLUGINS_DIR/kafka-connect-jdbc
ENV INSTANT_CLIENT_DIR=/instant_client/

USER root
RUN yum -y install libaio && yum clean all

USER kafka
# Deploy Oracle client and drivers

COPY oracle_instantclient/* $INSTANT_CLIENT_DIR
COPY oracle_instantclient/xstreams.jar /kafka/libs
COPY oracle_instantclient/ojdbc8.jar /kafka/libs

Helm Loop over a range to N

 {{$count := .Values.replicas | int }}

{{range $i, $e := until $count }}

{{$i}} {{end}}

Wednesday, May 12, 2021

HTTPS backend-protocol not working- Ingress NGINX

 Anotation nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" is not wroking.

Solution: Install the below Ingress NGINX

https://kubernetes.github.io/ingress-nginx/deploy/


Ref: https://github.com/kubernetes/ingress-nginx/issues/6721

Tuesday, May 11, 2021

Switches the form rendering between Business Central and KIE Server

 Add  following Properties in java argument ( or standard*.xml) 

  • org.jbpm.wb.forms.renderer.ext: Switches the form rendering between Business Central and KIE Server. By default, the form rendering is performed by Business Central. Default value: false.

  • org.jbpm.wb.forms.renderer.name: Enables you to switch between Business Central and KIE Server rendered forms. Default value: workbench.

Install and use xorg-server on macOS via Homebrew

  The instructions to install and use xorg-server on macOS via Homebrew: Install Homebrew (if you haven't already): /bin/bash -c ...