Deleting a bad changelog in Liquibase

1 – Identify the change set you need to remove (to run again)

<changeSet author=“me” id=“2.1.0-x-table”>
<sqlFile path=“/mycustomsql.sql”
relativeToChangelogFile=false” stripComments=“true” />
</changeSet>

2 – As your db instance owner, remove the change log entry
[db2inst1@db myfolder]$ db2 “DELETE from myschema.DATABASECHANGELOG WHERE ID = ‘2.1.0-x-table'”
DB20000I The SQL command completed successfully.

3 – Confirm the change log is removed
[db2inst1@db myfolder]$ db2 “select * from myschema.DATABASECHANGELOG WHERE ID = ‘2.1.0-x-table’”

Quick Method to see Kafka-Broker uptime

Quick Method to see Kafka-Broker uptime

lstart and etime are the actual start time and the actual elapsed time since start

[userid@kafka-server ~]$ ps -eo pid,comm,lstart,etime,time,args | grep -i kafka | grep -v grep
9863 java Thu Nov 3 16:19:38 2017 05:25:55 00:09:55 /usr/jdk64/java-1.8.0-openjdk-1.8.0.77-0.b03.el7_2.x86_64/bin/java -Xmx1G -Xms1G -server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+DisableExplicitGC -Djava.awt.headless=true -Xloggc:/var/log/kafka/kafkaServer-gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -Dkafka.logs.dir=/var/log/kafka -Dlog4j.configuration=file:/usr/iop/current/kafka-broker/bin/../config/log4j.properties -cp :/kafka-broker/bin/../libs/* -Xmx8g -Xms8g -Djava.security.auth.login.config=/kafka-broker/config/kafka_jaas.conf kafka Kafka /kafka-broker/config/server.properties

Automating Integration Tests with WebSphere Liberty and Maven

I spent some hours to figure out how to deploy my webapp to the Liberty from my Maven project.

I looked into the feature restConnector-1.0 . restConnector provides a REST based JMX MBeans interface to WebSphere Liberty.  You add  <feature>restConnector-1.0</feature> to your server, and make sure you have a user set in the admin role.

<administrator-role>
 <user>admin</user>
</administrator-role>

You need to add write access for the administrator-role user.  You’ll need to specify a relative path (use the Liberty Directory Locations) or use the absolute path (it’s a bit more complicated).

 <remoteFileAccess>
   <writeDir>${server.output.dir}/dropins</writeDir>
 </remoteFileAccess>

You can login and see the various APIs [ https://localhost:9443/IBMJMXConnectorREST/api ] or check the documentation [API1][API2][MBean]  .  You’ll want to check any upload with https://localhost:9443/IBMJMXConnectorREST/file/status

I used it with maven-antrun-plugin to execute against curl.

<plugin>
 <artifactId>maven-antrun-plugin</artifactId>
 <version>1.8</version>
 <executions>
 <execution>
 <id>upload-pre-integration</id>
 <phase>pre-integration-test</phase>
 <goals>
 <goal>run</goal>
 </goals>
 <configuration>
 <target name="post-war-to-server" unless="maven.test.skip">
 <!-- Remove War File from the Server -->
 <exec executable="curl">
 <arg
 line="-u 'admin:dmin' -H 'Content-Type: application/war' -X DELETE 'https://localhost:9443/IBMJMXConnectorREST/file/%24%7Bserver.output.dir%7D%2Fdropins%2Ftransformation.war?recursiveDelete=true' 
 --insecure -v" />
 </exec>
 <!-- Should check that this is a 204 -->
 
 <!-- Post the War file to the Server -->
 <!-- Expand the War file on the Server -->
 <exec executable="curl">
 <arg
 line="-u 'admin:admin' -H 'Content-Type: application/war' -X POST 'https://localhost:9443/IBMJMXConnectorREST/file/%24%7Bserver.output.dir%7D%2Fdropins%2Ftransformation.war?expandOnCompletion=true' 
 --data-binary '@target/example.war' --insecure -v" />
 </exec>
 
 </target>

 </configuration>
 </execution>
 </executions>
 </plugin>

Execute maven with mvn clean integration-test package in order to trigger the deployment during the integration-test.