mardi 31 juillet 2018

Continuous integration for JAVA/Angular 5,6 project on Jenkins with maven and npm

To build a project Angular on Jenkins, you need to mix two technologies: NPM and maven.

To do so you need first to prepare you image that will host jenkins.

1 - install maven

Download maven and copy it into your /opt folder.

2 - install npm

yum install npm

3 - install node js

     curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
     apt-get install -y nodejs
     npm config set strict-ssl false



4- build your project

      echo Building Client application
      cd myapp-client
      npm install  @angular/core
      npm install --save-dev @angular/cli@6.1.1
      ./node_modules/.bin/ng update @angular/cli --migrate-only --from=1.7.4
      ./node_modules/.bin/ng build
      cd ..
      echo Successful completion of npm build
      echo Building Webapp
      cd myapp-webapp
      echo Build started on `date`
      mvn install
      echo Successful completion of webapp build

jeudi 8 mars 2018

Filtering on IP and FQDN on HTTPD Virtual Host

Here is a sample file to filter on IP

NameVirtualHost *:80
ProxyPreserveHost On







#Redirection for www Host on another Website

ServerName www.mycompany-france.com
Redirect / http://www.mycompany.com/


#Redirection for error host to display the specific message "You are not authorized to access from this ip
 
ServerName error.
mycompany-france.com


# Document to display in case of authorization refused# you may indicate in that document the procedure to follow to add an ip
ErrorDocument 403 http://error.mycompany-france.com/error/authreq.html


# The place where the IP are added.

Order deny,allow
Deny from all
Allow from 80.231.232.69 193.56.36.2 193.202.91.11 90.89.210.95

# The application server for My company work council
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
ServerName workcouncil.mycompany-france.com


mercredi 28 février 2018

R rough guide



Working directory
getwd()

setwd("D:\\data\\Core kpi\\workspace\\tekpi-service\\src\\test\\resources\\data\\performance")

Loading data from external files

testplan.1_users.20171228 <- data="" ore="" read.csv="" u="">kpi
/workspace/tekpi-service/src/test/resources/data/performance/testplan-per-query-aggregate-1_users-20171228.csv")

Converting from Posix Date

In jmeter, the date are stored in POSIX format (number of millis since 1970), in order to generate propely the date. Use the following commande.

.1_users.20171228$timeStamp/1000,origin ="1970-01-01", tz = "GMT"))

View a table
View(testplan.1_users.20171228)

Install a package
install.packages("ggplot2")

load a library
library("ggplot2")

dataTestFiles<- u="">dir
(pattern = "testplan-per-query-aggregate-.*-20180125.*")

Process a batch of file
testplan<-null span="">
for (filename in dataTestFiles) {
  print(filename);
  nbUserStr<-sub u="">testplan
-per-query-aggregate-","",filename)
  nbUserStr<-sub nbuserstr="" span="" users="">
  nbUserStr<- u="">strsplit
(nbUserStr,"-")[[1]][1]
  nbUser<-as .numeric="" nbuserstr="" span="">
  print(substr(filename,30,30));
  temptestplan <- filename="" read.csv="" span="">
  temptestplan$nbuser=nbUser;
  splittedData <- data.frame="" do.call="" u="">rbind
', strsplit(as.character(temptestplan$label),'-',fixed=TRUE)))
  temptestplan<- u="">cbind
(temptestplan,splittedData)
  temptestplan$session=filename;
  testplan<- u="">rbind
(testplan,temptestplan)
}

Agregate on function
aggregate(x=testplanclean$elapsed,by=list(testplanclean$session),FUN='mean')
aggregate(x=testplanclean$elapsed,by=list(testplanclean$session),FUN='var')
aggregate(x=testplanclean$elapsed,by=list(testplanclean$session),FUN='max')
nbReqSession<-aggregate x="<u">testplanclean
$elapsed,by=list(testplanclean$session),FUN='length')
startSession<-aggregate x="<u">testplanclean
$timeStamp,by=list(testplanclean$session),FUN='min')
endSession<-aggregate x="<u">testplanclean
$timeStamp,by=list(testplanclean$session),FUN='max')
intensite<- u="">cbind
(nbReqSession[1],nbReqSession[2]/(endSession[2]-startSession[2])*60000)
testplanclean$nbuserlabel<-paste u="">testplanclean
$nbuser, " user: ",testplanclean$X1)

# Time elapsed per User and type of graph
timeElapsedGraph <- u="">ggplot
(testplanclean, aes(nbuserlabel,elapsed/1000,color=X1))
timeElapsedGraph + geom_boxplot() + labs(y="Temps de rponse (s)",x="Utilisateurs simultans")+ scale_x_discrete(labels=c(timeElapsedGraph$nbuser))

# Time elapsed per Filter
timeElapsedPerFilterGraph <- u="">ggplot
(testplanclean, aes(X3,elapsed/1000))
timeElapsedPerFilterGraph + stat_boxplot() + labs(y="Temps de rponse (s)",x="Type de filtre")

# Time elapsed per aircraft
timeElapsedPerAircraftGraph <- u="">ggplot
(testplanclean, aes(X2,elapsed/1000))
timeElapsedPerAircraftGraph + stat_boxplot() + labs(y="Temps de rponse (s)",x="Aircraft")

# Time elapsed  type of graph
timeElapsedGraph <- u="">ggplot
(testplanclean, aes(X1,elapsed/1000))
timeElapsedGraph + geom_boxplot() + labs(y="Temps de rponse (s)",x="Type of Graph")


hist(testplanclean$timeStamp/60000)

aggregate(x=testplan$responseCode,by=list(testplan$label,testplan$responseCode),FUN='length')


intensiteChart<- u="">ggplot
(intensite,aes(Group.1,x))+theme(axis.text.x=element_blank(),  axis.ticks.x=element_blank())
intensiteChart+geom_point()+geom_smooth(method="lm",color="Red")+labs(y="Request per minutes",x="Stress of the scenario")
intensite

Package pour traiter les dates
install.packages('lubridate')
library(lubridate)
access_log$Date<-dmy_hms access_log="" span="">


vendredi 23 février 2018

Migrate Liferay 6 to Liferay 7 on MySQL


1- Do a copy of the backup

Modify the portal-ext.properties


redirect.url.security.mode=ip
redirect.url.domains.allowed=localhost,workcouncil.infosys.com
redirect.url.ips.allowed=127.0.0.1,privateIp,PublicIp,SERVER_IP

Resolve to your virtual host in etc/host


Modify the config of osgi
 vi osgi/configs/com.liferay.portal.workflow.kaleo.runtime.internal.notification.EmailNotificationSender.cfg

fromAddress=someone@yahoo.fr

2 - Change collation on columns
ALTER TABLE AssetCategory             CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE AssetEntry                CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE AssetVocabulary           CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE BlogsEntry                CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE BookmarksEntry            CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE BookmarksFolder           CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE CalEvent                  CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE Calendar                  CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE CalendarBooking           CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE CalendarResource          CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE DDLRecordSet              CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE DDMContent                CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE DDMDataProviderInstance   CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE DDMStructure              CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE DDMStructureVersion       CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE DDMTemplate               CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE DDMTemplateVersion        CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE DLFileEntry               CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE DLFileEntryType           CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE DLFileVersion             CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE DLFolder                  CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE ExportImportConfiguration CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE Group_                    CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE JournalArticle            CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE JournalFeed               CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE JournalFolder             CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE KaleoAction               CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE KaleoDefinition           CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE KaleoNode                 CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE KaleoNotification         CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE KaleoTask                 CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE KaleoTimer                CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE KaleoTransition           CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE Layout                    CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE LayoutBranch              CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE LayoutPrototype           CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE LayoutRevision            CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE LayoutSetBranch           CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE LayoutSetPrototype        CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE MBCategory                CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE MDRAction                 CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE MDRRule                   CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE MDRRuleGroup              CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE Marketplace_App           CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE PasswordPolicy            CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE PollsChoice               CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE PollsQuestion             CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE QUARTZ_JOB_DETAILS        CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE QUARTZ_TRIGGERS           CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE Repository                CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE Role_                     CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE ShoppingCategory          CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE ShoppingCoupon            CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE ShoppingItem              CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE ShoppingItemField         CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE ShoppingOrderItem         CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE SyncDLObject              CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE Team                      CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE UserGroup                 CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE UserIdMapper              CONVERT TO CHARACTER SET utf8 ;
ALTER TABLE WikiNode                  CONVERT TO CHARACTER SET utf8 ;