Skip to content

Instantly share code, notes, and snippets.

View chanakaudaya's full-sized avatar
💭
Keep looking, don't settle

Chanaka Fernando chanakaudaya

💭
Keep looking, don't settle
View GitHub Profile
@chanakaudaya
chanakaudaya / chainingSeq.xml
Created March 30, 2023 13:11
Mediation policy to call a backend and enrich payload in the request flow in WSO2 APIM
<sequence xmlns="http://ws.apache.org/ns/synapse" name="chainingSeq">
<!-- reading the author ID-->
<property name="uri.var.id" expression="json-eval($.author}" />
<!-- copying the original payload to a variable-->
<enrich>
<source type="body" clone="true"/>
<target type="property" property="original_request"/>
</enrich>
<!-- Saving the URL postfix that is required when calling the backend -->
<property name="rest_postfix" expression="$axis2:REST_URL_POSTFIX"/>
@chanakaudaya
chanakaudaya / ap_ip_choreo.csv
Last active April 1, 2022 13:16
apaas, ipaas and choreo comparison
Feature aPaaS iPaaS Choreo
Time to market Fast. Provides the required runtimes libraries to develop applications fast. Faster. Provides high level templates and DSL to build application faster. Faster. Provides templates and DSL and code development to deliver applications faster.
Developer productivity Requires skilled developers who can use programming languages to build appications Provides low-code and no-code interfaces to build applications. Not require skilled developers always. Domain experts with technical background can build applications Provides both low-code and code experience to the developers with AI-assisted development experience.
Infrastructure management Users should have the knowledge about technologies used (e.g. Git/Jenkins/CICD). Platform provides a managed environment to configure these tools. Users does not need a knowledge on the underlying tools. Provides simple interfaces such as a button click to initiate complete build and deployment processes. Fully managed infrastructure. Si
@chanakaudaya
chanakaudaya / Dockerfile
Created December 19, 2020 03:26
Dockerfile with multi-stage builds for reactJS
FROM node:12 AS build
WORKDIR /app
COPY package* yarn.lock ./
RUN yarn install
COPY public ./public
COPY src ./src
RUN yarn run build
FROM nginx:alpine
COPY --from=build /app/build /usr/share/nginx/html
@chanakaudaya
chanakaudaya / Dockerfile
Created December 19, 2020 03:25
Dockerfile with multi-stage builds for tomcat/maven
FROM maven AS build
WORKDIR /app
COPY . .
RUN mvn package
FROM tomcat
COPY --from=build /app/target/file.war /usr/local/tomcat/webapps
@chanakaudaya
chanakaudaya / Dockerfile
Created December 19, 2020 03:23
Updated docker file for better image building
FROM node:12-alpine
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --production
COPY . .
CMD ["node", "src/index.js"]
@chanakaudaya
chanakaudaya / docker-compose.yml
Created December 19, 2020 03:22
Docker compose file for todo app with mysql
version: "3.7"
services:
app:
image: node:12-alpine
command: sh -c "yarn install && yarn run dev"
ports:
- 3000:3000
working_dir: /app
volumes:
@chanakaudaya
chanakaudaya / Dockerfile
Created December 19, 2020 03:19
Basic Dockerfile with todo JS application
FROM node:12-alpine
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --production
COPY . .
CMD ["node", "src/index.js"]
@App:name('CDCListenForInserts')
@App:description('Capture MySQL Inserts using CDC listening mode.')
@source(type = 'cdc', url = 'jdbc:mysql://localhost:3306/UserDataDB?useSSL=false', username = 'root', password = 'root123', table.name = 'UserTable', operation = 'insert',
@map(type = 'keyvalue'))
define stream InsertSweetProductionStream (userId string, firstname string, lastname string);
@sink(type = 'log')
define stream LogStream (userId string, firstname string, lastname string);
@App:name('TailFileRegex')
@App:description('Tails a file using a regex and does a simple transformation.')
@source(type='file', mode='REGEX',
file.uri='file:/Users/chanaka/my-experiments/wso2-si-samples/noisy_data.txt',
begin.regex='\<', end.regex='\>',
tailing='true',
@map(type='text', fail.on.missing.attribute = 'false', regex.A='(\w+)\s([-0-9]+)',regex.B='volume\s([-0-9]+)', @attributes(symbol = 'A[1]',price = 'A[2]',volume = 'B')))
@App:name('TailLine')
@App:description('Tails a file line by line and does a simple transformation.')
@source(type='file', mode='LINE',
file.uri='file:/Users/chanaka/my-experiments/wso2-si-samples/productions.csv',
tailing='true',
@map(type='csv'))
define stream SweetProductionStream (name string, amount double);