ZFS is a combined file system and logical volume manager designed by Sun Microsystems. ZFS is scalable, and includes extensive protection against data corruption, support for high storage capacities, efficient data compression, integration of the concepts of filesystem and volume management, snapshots and copy-on-write clones, continuous integrity checking and automatic repair, RAID-Z, native NFSv4 ACLs, and can be very precisely configured. (From Wikipedia)
Tiny Core Linux does not offer an official ZFS tcz. You can use the script in https://github.com/hpmtissera/zfs-tinycore to build a ZFS TCZ file for Tiny Core. By default it will build Tiny Core:10.0-x86_64 (Kernel: 4.19.10-tinycore64). But you can change the base image version (https://github.com/hpmtissera/zfs-tinycore/blob/master/Dockerfile#L1) and kernel version (https://github.com/hpmtissera/zfs-tinycore/blob/master/Dockerfile#L29) in the Dockerfile to build ZFS for the required version.
Sunday, August 25, 2019
Thursday, July 19, 2018
Install Java in Tiny Core Linux 7
Tiny Core Linux does not come with a default java installation. To install java we need to create a .tcz file first. To do this I am using Tiny Core docker, but you can also use the same steps in a normal installation too.
Download the required JDK version from Oracle. You need to download the Linux tar.gz file. (ex. jdk-8u181-linux-x64.tar.gz)
To avoid this after startup run. (You will need to automate this appropriately)
Download the required JDK version from Oracle. You need to download the Linux tar.gz file. (ex. jdk-8u181-linux-x64.tar.gz)
Pull the required docker image from https://github.com/tatsushid/docker-tinycore
docker pull tatsushid/tinycore:7.2-x86_64
Now run Tiny Core docker in privileged mode.
docker run -it --privileged tatsushid/tinycore:7.2-x86_64
To use scp to copy the downloaded file to Tiny Core Linux inside docker you need to install open ssh.
tce-load -wi openssh.tcz
Copy downloaded JDK tar.gz file to Tiny Core Linux. (Following command copy to the current folder. In my case it was /home/tc)
scp prasad@192.168.0.1:/Users/prasad/Downloads/jdk-8u181-linux-x64.tar.gz .
Install java-installer
tce-load -wi java-installer.tcz
Run java-installer in the same folder where JDK is copied.
sudo java-installer
Above message will be displayed. Since we already have jdk download in place, press enter to continue. (The message is bit misleading, even we already have the JDK file in place it ask to download).
Now java tcz files will be created in /usr/local/src/java
As shown in the message, now you can add jdk8.tcz to /etc/sysconfig/tcedir/onboot.lst and reboot to start using java.
IMPORTANT
It is possible you get the following error when running java:
tc@box:~$ /usr/local/java/bin/java -version
-sh: /usr/local/java/bin/java: not found
To avoid this after startup run. (You will need to automate this appropriately)
ln -s /lib /lib64
Tuesday, June 26, 2018
Jenkins Pipeline
In this blog, I am trying to explain how to write a Jenkins pipeline. Mostly I have used declarative pipeline syntax. If you are new to Pipeline please have a look at Jenkins Pipeline documentation will be useful.
Here I am referring to the sample project available at GitHub. In this sample, I have used a simple Hello World java program with a Maven build and a simple Junit test.
The Pipeline script is written to execute following steps in Jenkins.
- Checkout the project to a custom workspace.
- Build the project with Maven, run tests.
- Checkout pipeline-sub into a new folder inside the workspace.
- Export some variables using a block shell script.
- Run another shell script that uses the values of exported variables.
- Publish JUnit test results.
- Publish project artifacts.
- Send email notification if the build is a Failure, Unstable or Back to Normal. (No emails for back to back successful builds.)
- Send Mattermost notification with build time, build URL and test results summary.
Jenkins configuration
- Add a new Multibranch Pipeline project in Jenkins as explained in Jenkins docs.
- For the branch source select Github instead of Git. If GitHub is not displayed as an option, please install Jenkins GitHub plugin.
- Add credentials for the repository and put your GitHub username as the Owner. Then select the repository.
- Choose the discover branches and discover pull requests strategy. If you need to build pull requests automatically please choose from here.

- If your GitHub repository is very large and take few minutes to clone and you need to reduce that time you can add advanced clone behaviors. Click Add button and choose Advanced clone behaviours.
- Shallow clone and Shallow clone depth When this option is selected Jenkins only checkout the repository with the history up to the specified depth. This option can speed up the cloning by limiting the size of fetch.
- Path of the reference repo to use during clone You can checkout a Git bare repository to the Jenkins server beforehand and set path to that repository here. Jenkins will use that repository as a reference when checkingout the project. This helps to reduce the checkout time and the disk space in the Jenkins server. More details are here.
- Under Build Configuration set Mode to by Jenkinsfiles and set path to Jenkinsfile (In the example it has been set to Jenkinsfile because Jenkinsfile is located in the project root.

These are the basic configurations we need to have to get build running with Jenkins.
I think most of the code in Jenkinsfile is self explanatory. So I will only explain things which I think non-trivial.
- How to read project name and branch name inside Jenkinsfile?
Job name has the following format : /<branch_name>
def jobnameparts = JOB_NAME.tokenize('/') as String[]
def jobconsolename = jobnameparts[0]
def branchname = jobnameparts[1]
- How to configure Jenkins Pipeline to use a custom workspace?
agent {
node {
label 'master'
customWorkspace "${jobconsolename}"
}
}
For the customWorkspace property you need to specify the relative path from the Jenkins working directory.
- How to build another repository as a part of Pipeline build?
dir('pipeline-sub') {
git branch: 'mybranch',
url: 'https://github.com/prasadlvi/pipeline-sub.git'
sh '''
cat README.md
'''
}
- How to run a shell script inside Jenkins Pipeline build?
sh '''
export prev_version='My previous version'
cd ..
export branch_name=${PWD##*/}
cd -
./Build/test-script.sh
'''
- How to read current build result inside Jenkins file?
if (currentBuild.result == null) {
currentBuild.result = 'SUCCESS'
// Do something
} else if(currentBuild.result == 'FAILURE' || currentBuild.result == 'UNSTABLE') {
// Do something
}
- How to send email notification in Jenkins pipeline.
emailext to: 'test@test.com test1@test.com', subject: '$DEFAULT_SUBJECT', body: '$DEFAULT_CONTENT'
DEFAULT_SUBJECT and DEFAULT_CONTENT can be configured in Jenkins > Manage Jenkins (Jenkins main configuration page) as shown in the screenshot 

- How to send Slack / Mattermost notifications using Jenkins pipeline?
mattermostSend message: "${env.JOB_NAME} - #${env.BUILD_NUMBER} after ${currentBuild.durationString.replace(' and counting', '')} <${env.BUILD_URL}|Open>${summary}"
- How to get test results summary inside Jenkins file?
def testResultAction = currentBuild.rawBuild.getAction(AbstractTestResultAction.class)
if (testResultAction != null) {
def total = testResultAction.getTotalCount()
def failed = testResultAction.getFailCount()
def skipped = testResultAction.getSkipCount()
summary = "\nTest results:\n\t"
summary = summary + ("Passed: " + (total - failed - skipped))
summary = summary + (", Failed: " + failed)
summary = summary + (", Skipped: " + skipped)
} else {
summary = "No tests found"
}
- How to read a variable defined in the Jenkinsfile from inside a shell script?
As I understand this has to be done in 3 steps. Please refer the source code to understand more clearly.
Define the variable
def jobconsolename = jobnameparts[0]
Export the variable
environment {
jobconsolenameshell = "${jobconsolename}"
}
Use the variable inside a shell script.
sh "echo \$jobconsolenameshell"
sh '''
echo 'inside shell script'
echo \$jobconsolenameshell
'''
Finally this is how to get current build duration. Please note that the variable output has "and counting" part because we are reading the value inside the Pipeline file and that mean build is not end yet.
echo "Duration : ${currentBuild.durationString.replace(' and counting', '')}"
Sunday, May 25, 2014
Login into a Passive STS Relying Party application with Facebook credentials using WSO2 Identity Server
With WSO2 5.0 now you can login into a Passive STS supported application using your Facebook Credentials. I am going to explain how to do that using a sample Relying Party (RP) application written in Java.
Step 2 : Configuring the Facebook App
Step 1 : Configuring Passive STS sample application
- Download the sample application .war file fom https://svn.wso2.org/repos/wso2/people/dulanja/samples/passive-sts/bin/PassiveSTSSampleApp.war
- You can use a application server such as Apache Tomcat to deploy the application. Apache Tomcat can be download form http://mirrors.gigenet.com/apache/tomcat/tomcat-7/v7.0.54/bin/apache-tomcat-7.0.54.zip
- Extract the zip file and copy the .war file into the webapps folder inside the extracted apache-tomcat folder.
- Run Tomcat by running the catalina.sh file inside the bin folder using : sh catalina.sh run
- Extract the zip file and copy the .war file into the webapps folder inside the extracted apache-tomcat folder.
- Run Tomcat by running the catalina.sh file inside the bin folder using : sh catalina.sh run
Step 2 : Configuring the Facebook App
- Go to https://developers.facebook.com/ and login with your Facebook credentials.
- Go to Apps > Create a New App
- Enter an App Name and select an appropriate category and click on Create App. This will take you to the App Dashboard where you can find the AppID and AppSecret.
- Go to Settings and click on Add platform
Click on website and configure as shown in the screenshot.
- Go to Settings > Advanced
Here you need to configure security settings as shown in the screenshot
- Client OAuth Login should be set to Yes and OAuth redirect URL should be set to https://localhost:9443/commonauth . Click on Save Changes button to save the changes.
The app is not available to general public yet. To make to app available to every Facebook user, you have to submit the app for review. After a review Facebook make the app available to every Facebook user. More information on review process can be find by clicking on Status and Review.
Because the review process is taking some time, you can specify some Facebook users as Developers or Testers. Only the specified here can use this app to Login with Facebook until the App go public.
- Click on Roles to go the below page and specify the required Facebook users as Developers or Testers.
Click on website and configure as shown in the screenshot.
Because the review process is taking some time, you can specify some Facebook users as Developers or Testers. Only the specified here can use this app to Login with Facebook until the App go public.
Step 3 : Configuring Identity Provider
Now you have to configure WSO2 Identity Server. First you need to download the latest version from
http://wso2.com/products/identity-server/ (If you are new to WSO2 Identity Server please refer https://docs.wso2.org/display/IS460/Getting+Started )
- Extract the zip file and run wso2server.sh file inside the bin directory. (If you are using windows run wso2server.bat instead).
- Login to the management console using
User Name : Admin Password : Admin
- In the Identity Section in the Main tab, click on Add button under Identity Providers.
- Give a suitable name as the Identity Provider Name.
- Go to Federated Authenticators > Facebook Configuration and enter the App ID and App Secret values form Facebook app into Client ID and Client Secret fields respectively.
- Tick both check boxes to enable Facebook Authenticator and Make it the default.
Step 4 : Configuring Service Provider
- Now go back to the WSO2 IS Management console. In the Manage Section in the Main tab, click on Add button under Service Providers.
- Enter PassiveSTSSampleApp in the Service Provider Name text box and click Register.
- Go to Inbound Authentication Configuration > WS-Federation (Passive) Configuration.
- Now set the configuration as follows:
- Now set the configuration as follows:
- Go to Local and Outbound Authentication Configuration.
- Select the Identity Provider you created form the drop down under Federated Authentication.
- Select the Federated Authenticator option button and select facebook. Click on Update button to save the changes.
Step 5 : Configuring claim mappings for Facebook.
- In the Identity Section in the Main tab, click on List button under Identity Providers.
- Click on the Edit button to edit the facebook identity provider.
- Go to Claim Configuration > Basic Claim Configuration
- Select Define Custom Claim Dialect option under Select Claim mapping Dialect
- Click on Add Claim Mapping to add custom claim mappings as follows.
- You can retrieve all the public information of the user and the email address. Here are some common attribute names.
- id
- email
- name
- first_name
- last_name
- link
- gender
- locale
- age_range
- More information is available from the following link.
https://developers.facebook.com/docs/facebook-login/permissions/v2.0
- id
- name
- first_name
- last_name
- link
- gender
- locale
- age_range
- You can map these attributes to any Local Claim URI which you feels suitable.
Step 6 : Configuring requested claims for PassiveSTSSampleApp
- In the Identity Section in the Main tab, click on List button undeNOwr Service Providers.
- Click on the Edit button to edit the PassiveSTSSampleApp service provider.
- Go to Claim Configuration
- Click on Add Claim URI under Requested Claims to add the requested claims as follows. Here you should add the claims you mapped in the Identity Provider claim configuration.
- Select a suitable claim for the Subject Claim URI. (Please not that email address cannot use without allowing using email addresses as user names in carbon.xml. To allow using email address as usernames uncomment <!--EnableEmailUserName>true</EnableEmailUserName--> in carbon.xml file inside wso2is-5.0.0/repository/conf)
Step 7 : Login to PassiveSTSSampleApp using Facebook credentials.
- Go to the following URL.
http://localhost:8080/PassiveSTSSampleApp
- Now you will be redirected to Facebook Login page. Enter your Facebook credentials and you will be taken to the following page.
REFERENCES
Wednesday, April 9, 2014
Login with Facebook for WSO2 Identity Server
Nowadays we are using services form hundreds of websites. Most of these websites need the user to create an account providing a valid email address and password. For most people it is a nightmare to remember all the different user ids and passwords. To make the life easier most websites provide a user a option to login with Facebook Account, Twitter Account or Google Account. Since most of the internet users have one of these accounts it makes creating a new account instant.
With WSO2 Identity Server 5.0 now users can login to Identity Server with their Facebook account. To do that first you have to create a Facebook app after registering as a Facebook developer.
Because the review process is taking some time, you can specify some Facebook users as Developers or Testers. Only the specified here can use this app to Login with Facebook until the App go public.
Assertion Consumer URL : http://localhost:8080/travelocity.com/home.jsp
Enable Assertion Signing
Enable Single Logout
Enable Attribute Profile
Include Attributes in the Response Always
Now you have finished the configurations. To see the thing at work go to the following URL.
With WSO2 Identity Server 5.0 now users can login to Identity Server with their Facebook account. To do that first you have to create a Facebook app after registering as a Facebook developer.
Step 1 : Configuring the Facebook App
- Go to https://developers.facebook.com/ and login with your Facebook credentials.
- Go to Apps > Create a New App
- Enter an App Name and select an appropriate category and click on Create App. This will take you to the App Dashboard where you can find the AppID and AppSecret.
- Go to Settings and click on Add platform
Click on website and configure as shown in the screenshot.
- Go to Settings > Advanced
- Client OAuth Login should be set to Yes and OAuth redirect URL should be set to https://localhost:9443/commonauth . Click on Save Changes button to save the changes.
Because the review process is taking some time, you can specify some Facebook users as Developers or Testers. Only the specified here can use this app to Login with Facebook until the App go public.
- Click on Roles to go the below page and specify the required Facebook users as Developers or Testers.
Step 2 : Deploying travelocity.com sample app
Now you have finished configuring Facebook as an Identity Provider. Now you can configure IS to login to IS sample travelocity.com app using your Facebook credentials.
You can download travelocity.com.war file using the following link.
Deploy this sample web app on a web container. To do this, use the Apache Tomcat server. Since this sample is written based on Servlet 3.0 it needs to be deployed on Tomcat 7.x. Use the following steps to deploy the web app in the web container:
Step 3 : Configuring Identity Provider
Now you have to configure WSO2 Identity Server. First you need to download the latest version from
http://wso2.com/products/identity-server/ (If you are new to WSO2 Identity Server please refer https://docs.wso2.org/display/IS460/Getting+Started )
- Extract the zip file and run wso2server.sh file inside the bin directory. (If you are using windows run wso2server.bat instead).
- Login to the management console using
User Name : Admin Password : Admin
- In the Identity Section in the Main tab, click on Add button under Identity Providers.
- Give a suitable name as the Identity Provider Name.
- Go to Federated Authenticators > Facebook Configuration and enter the App ID and App Secret values form Facebook app into Client ID and Client Secret fields respectively.
- Tick both check boxes to enable Facebook Authenticator and Make it the default.
Step 4 : Configuring Service Provider
- Now go back to the WSO2 IS Management console. In the Manage Section in the Main tab, click on Add button under Service Providers.
- Enter travelocity.com in the Service Provider Name text box and click Register.
- Click on Configure link under Inbound Authentication Configuration > SAML2 Web SSO Configuration.
- Now set the configuration as follows:
Issuer : travelocity.com
Assertion Consumer URL : http://localhost:8080/travelocity.com/home.jsp
- Check the following check-boxes :
Enable Assertion Signing
Enable Single Logout
Enable Attribute Profile
Include Attributes in the Response Always
- Click on Update button to save the changes. Now you will be send back to the Service Providers page.
- Go to Local and Outbound Authentication Configuration.
- Select the Identity Provider you created form the drop down under Federated Authentication.
- Select the Federated Authenticator option button and click Update button to save the changes.
Step 5 : Configuring claim mappings for Facebook.
- In the Identity Section in the Main tab, click on List button under Identity Providers.
- Click on the Edit button to edit the facebook identity provider.
- Go to Claim Configuration > Basic Claim Configuration
- Select Define Custom Claim Dialect option under Select Claim mapping Dialect
- Click on Add Claim Mapping to add custom claim mappings as follows.
- You can retrieve all the public information of the user and the email address. Here are some common attribute names.
- id
- email
- name
- first_name
- last_name
- link
- gender
- locale
- age_range
- More information is available from the following link.
https://developers.facebook.com/docs/facebook-login/permissions/v2.0
- id
- name
- first_name
- last_name
- link
- gender
- locale
- age_range
- You can map these attributes to any Local Claim URI which you feels suitable.
Step 6 : Configuring requested claims for travelocity.com
- In the Identity Section in the Main tab, click on List button under Service Providers.
- Click on the Edit button to edit the travelocity.com service provider.
- Go to Claim Configuration
- Click on Add Claim URI under Requested Claims to add the requested claims as follows. Here you should add the claims you mapped in the Identity Provider claim configuration.
- Select a suitable claim for the Subject Claim URI. (Please not that email address cannot use without allowing using email addresses as user names in carbon.xml. To allow using email address as usernames uncomment <!--EnableEmailUserName>true</EnableEmailUserName--> in carbon.xml file inside wso2is-5.0.0/repository/conf)
- Click on : Click here to login with SAML from WSO2 Identity Server.
Subscribe to:
Posts (Atom)


















