Tuesday, 21 November 2017

IBM Java and Health Centrer - There's More

Following an earlier post: -


I've been guiding a colleague in the use of HC, outside of WebSphere Application Server (WAS).

This time I wanted to show how HC could be used to monitor a Plain Ole Java Object (POJO), specifically a Java class.

Here's one I prepared earlier: -

HelloWorld.java

public class HelloWorld
{
public static void main(String[] args)
{
while (true)
{
System.out.println("Hello, World");
}
}
}

WARNING - this will run forever, in an infinite loop, but it's good for my testing purposes.

Having setup my shell to reflect the IBM Java 8 JRE, thanks to the WAS setupCmdLine.sh script: -

source /opt/ibm/WebSphereProfiles/Dmgr01/bin/setupCmdLine.sh 

I compiled the class: -

javac HelloWorld.java 

and executed it: -

java HelloWorld

to prove that it works.

I then added HC into the mix: -

java -Xhealthcenter:transport=jrmp HelloWorld

Note that, as before, I've added :transport=jrmp into the mix, as I'm using Eclipse on macOS with Oracle's Java 8 JRE on the client-side, even though the server-side is using the IBM Java8 JRE.

I was then able to hook up Eclipse, as per the previous blog post.

One other useful tip; if I start the Java class thus: -

java -Xhealthcenter:transport=jrmp HelloWorld >> /tmp/foobar

the actual "Hello World!" message gets appended to /tmp/foobar but I see: -


in the console, allowing me to validate that HC is running and listening on port 1972.

I also validated this from another terminal: -


where 49134 is the Process ID of the running JRE: -


and then probed it: -


and: -


Job done !

Thursday, 16 November 2017

IBM DB2, Red Hat Enterprise Linux and the IBM Mainframe

I'm running through the process to deploy IBM Business Process Manager (BPM) 8.6 onto an IBM mainframe ….

This is something that I've done a number of times before, since I first joined the (then) IBM Software Services for WebSphere team in late 2012.

In essence, although the underlying hardware is the IBM z platform ( also known as LinuxOne in this guise ), I'm installing BPM etc. onto Red Hat Enterprise Linux (RHEL) and Linux is …. Linux.

So the approach to install BPM, and it's dependencies, is similar to any other Linux - in the main, I work with X86-64, so I used my notes for that platform as a Starter for 10.

I did, however, hit one glitch, namely in the context of installing IBM DB2 11.1.

Whilst I was attempting to install DB2: -

/tmp/Repo/DB2/Product/server_awse_o/db2setup -r /tmp/Repo/db2server111.rsp

I saw this: -

Requirement not matched for DB2 database "Server" . Version: "11.1.0.0". 

Summary of prerequisites that are not met on the current system: 

   DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*". 


/tmp/Repo/DB2/Product/server_awse_o/db2/linux390/install/../bin/db2usrinf: error while loading shared libraries: libibmc++.so.1: cannot open shared object file: No such file or directory
/tmp/Repo/DB2/Product/server_awse_o/db2/linux390/install/../bin/db2usrinf: error while loading shared libraries: libibmc++.so.1: cannot open shared object file: No such file or directory
/tmp/Repo/DB2/Product/server_awse_o/db2/linux390/install/../bin/db2usrinf: error while loading shared libraries: libibmc++.so.1: cannot open shared object file: No such file or directory


Now the libyan.so message is common, and I've mostly ignored that - PAM == Pluggable Authentication Module and, as far as I can recollect, we'd only leverage PAM if we wanted to have DB2 users ( instance owner etc. ) authenticate against LDAP, which isn't a requirement for ME.

However, the exception re libibmc++.so.1 was more of a pain.

Thankfully, as ever, the Internet came to my rescue, with this: -




Following the advice therein, I went here: -


and downloaded the runtime from IBM Fix Central.

Having done so, I extracted the archive: -

tar xvzf IBM_XL_C_CPP_V1.2.0.0_LINUX_390_RUNTIME.tar.gz -C /tmp/Repo/CPP/

installed it: -

/tmp/Repo/CPP/install

/usr/bin/sudo rpm -Uvh /tmp/Repo/CPP/images/rhel/rpms/libxlc-1.2.0.0-151119a.s390x.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:libxlc-1.2.0.0-151119a           ################################# [100%]

and set the LD_LIBRARY_PATH variable: -

export LD_LIBRARY_PATH=/opt/ibm/lib64

This allowed me to install DB2: -

/tmp/Repo/DB2/Product/server_awse_o/db2setup -r /tmp/Repo/db2server111.rsp

Requirement not matched for DB2 database "Server" . Version: "11.1.0.0". 

Summary of prerequisites that are not met on the current system: 

   DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*". 


DBI1191I  db2setup is installing and configuring DB2 according to the
      response file provided. Please wait.


The execution completed with warnings.

For more information see the DB2 installation log at "/tmp/db2setup.log".

However…..

When I came to patch DB2, it happened again: -

/tmp/Repo/DB2/Fixpack/universal/installFixPack -n -b /opt/ibm/db2/V11.1/

Requirement not matched for DB2 database "Server" . Version: "11.1.2.2". 

Summary of prerequisites that are not met on the current system: 

   DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*". 


/opt/ibm/db2/V11.1/bin/db2langdir: error while loading shared libraries: libibmc++.so.1: cannot open shared object file: No such file or directory
/opt/ibm/db2/V11.1/bin/db2langdir: error while loading shared libraries: libibmc++.so.1: cannot open shared object file: No such file or directory
DBI1131E  The user ID DBI1055E is invalid.

Explanation: 

An attempt to access the given user ID failed. One of the following
situations has occurred:

*  This user ID does not exist on the system.

*  The home directory of this user does not exist or is not set up
   properly.

*  One of the user attributes needed by the database manager is unset.

*  The UID of this user is 0

User response: 

Make sure a valid user ID with valid home directory, shell, primary
group and secondary group has been used. Create a new user if necessary.


   Related information:
   Creating group and user IDs for a DB2 database installation (Linux
   and UNIX)
   DB2 users and groups (Linux and UNIX)

I dug around internally (!), and found another gem; to create symbolic links to the newly installed IBM C/C++ runtime into /usr/lib.

Working on the "Hope for the best, but plan for the worst" scenario, I did this: -

ln -s /opt/ibm/lib/libibmc++.so.1 /usr/lib
ln -s /opt/ibm/lib64/libibmc++.so.1 /usr/lib64/

and was then able to install the fix pack: -

/tmp/Repo/DB2/Fixpack/universal/installFixPack -n -b /opt/ibm/db2/V11.1/

Requirement not matched for DB2 database "Server" . Version: "11.1.2.2". 

Summary of prerequisites that are not met on the current system: 

   DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*". 


DBI1017I  installFixPack is updating the database products installed in
      location /opt/ibm/db2/V11.1/.


The execution completed successfully.

For more information see the DB2 installation log at
"/tmp/installFixPack.log.62145".

So that's another fine mess, got out of :-)


Tuesday, 14 November 2017

Telnet, my Telnet - Or macOS High Sierra, what have you done ?

This harks back to a VERY old post: -

which was penned back in 2010.

Since I've upgraded to macOS High Sierra, I've lost the FTP and Telnet clients.

Ordinarily that wouldn't be a problem but ….

Telnet is often useful for testing ports e.g. telnet localhost 9443.

Thankfully, we have a solution …. Netcat.


nc -vnzu 127.0.0.1 9080
found 0 associations
found 1 connections:
     1: flags=82<CONNECTED,PREFERRED>
outif (null)
src 127.0.0.1 port 59595
dst 127.0.0.1 port 9080
rank info not available

Connection to 127.0.0.1 port 9080 [udp/*] succeeded!

nc -vnzu 127.0.0.1 9443
found 0 associations
found 1 connections:
     1: flags=82<CONNECTED,PREFERRED>
outif (null)
src 127.0.0.1 port 54459
dst 127.0.0.1 port 9443
rank info not available

Connection to 127.0.0.1 port 9443 [udp/*] succeeded!

etc.

So it's a bit more fiddly !

So I hacked a solution !

alias 

alias hist='history | cut -c 8-'
alias telnet='nc -vnzu'


So now I can run: -

telnet 127.0.0.1 8443
found 0 associations
found 1 connections:
     1: flags=82<CONNECTED,PREFERRED>
outif (null)
src 127.0.0.1 port 52157
dst 127.0.0.1 port 8443
rank info not available

Connection to 127.0.0.1 port 8443 [udp/*] succeeded!

Bazinga!

Vagrant and VMware - all the Vs together - or not

Further to my last: -


I'm now looking at the options to use VMware Workstation ( this is on Linux, rather than my default home of macOS ) instead of VirtualBox.

Following this: -


I've installed the appropriate plugin: -

vagrant plugin install vagrant-vmware-workstation

Installing the 'vagrant-vmware-workstation' plugin. This can take a few minutes...
Fetching: vagrant-share-1.1.9.gem (100%)
Fetching: vagrant-vmware-workstation-5.0.3.gem (100%)
Building native extensions.  This could take a while...

Vagrant is installing the VMware plugin which requires
root access. You may be prompted for your password to
complete setup.

[sudo] password for hayd: 
Installed the plugin 'vagrant-vmware-workstation (5.0.3)'!


and validated the plugin: -

vagrant plugin list

vagrant-share (1.1.9, system)
vagrant-vmware-workstation (5.0.3)


I then updated my Vagrantfile to reflect the new choice of provider : -

vi Vagrantfile

inserting: -

...
config.vm.provider "vmware-workstation"

Finally, I tried (!) to bring my VM up: -

vagrant up

A valid license is required to run the Vagrant VMware
provider. Please visit http://www.vagrantup.com to purchase
a license. Once you purchase a license, you can install it
using `vagrant plugin license`.
Vagrant failed to initialize at a very early stage:

The plugins failed to load properly. The error message given is
shown below.

exit


Foiled again!

Then I read the Vagrant website more thoroughly



So I need to buy a license for the VMware Plugin from Vagrant ( aka Hashicorp ) at $80


Ah, well, back to VirtualBox for now …..

Monday, 13 November 2017

IBM Cloud Private - Tinkering with Vagrant

So I've been on a slow boat to IBM Cloud Private, over the past few weeks, and am continuing to self-enable in my "spare" time ( my formal enablement starts next week ).

Looking at this: -

IBM® Cloud Private architecture


it was clear that I really needed a few boxes onto which to actually install ICP.

Whilst it is possible to run everything on one box ( as per this IBM Cloud Private - My first foray ), I thought that I really should do things properly.

So, starting with Beast, which has 8 CPU cores, 32 GB RAM and a shed-load of disk, I decided to use Vagrant and Virtual Box to build out a few VMs, onto which I can then install/provision ICP.

PS As per the previous post, I'd already installed the right versions of Vagrant and Virtual Box

This is how I started: -

Create a directory into which I'm going to put my Vagrant configuration etc.

mkdir ~/foobar
cd ~/foobar

Create a default Vagrant configuration file - Vagrantfile

vagrant init

Amended the Vagrantfile to reflect my chosen Ubuntu image

Note - rather than the default of base - which isn't ever going to work :-)

sed -i'' 's/base/ubuntu\/trusty64/g' Vagrantfile

Instantiate the VM

vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/trusty64'
    default: URL: https://vagrantcloud.com/ubuntu/trusty64
==> default: Adding box 'ubuntu/trusty64' (v20171106.0.0) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/20171106.0.0/providers/virtualbox.box
==> default: Successfully added box 'ubuntu/trusty64' (v20171106.0.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Setting the name of the VM: foobar_default_1510584547514_91304
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key    default: Warning: Connection reset. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: 
    default: Guest Additions Version: 4.3.36
    default: VirtualBox Version: 5.1
==> default: Mounting shared folders...
    default: /vagrant => /home/hayd/foobar

And off we go, ready to play

I did a brief test: -

ssh vagrant@127.0.0.1 -p 2222

to ensure that the VM was OK, but that's as far as I've got yet.

I need to assign some real IP addresses next time around, and then go for multiple VMs, perhaps bringing some automation to bear.

We shall see …..

One thing to note - as per the above, Vagrant kindly generated a public/private key pair for me, with the private key being located here: -

-rw------- 1 hayd hayd 1675 Nov 13 14:49 /home/hayd/foobar/.vagrant/machines/default/virtualbox/private_key

Therefore, I can access my new VM without a password: -


ssh -i /home/hayd/foobar/.vagrant/machines/default/virtualbox/private_key vagrant@127.0.0.1 -p 2222
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-135-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Tue Nov 14 09:52:05 UTC 2017

  System load:  0.13              Processes:           76
  Usage of /:   3.6% of 39.34GB   Users logged in:     0
  Memory usage: 24%               IP address for eth0: 10.0.2.15
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.

New release '16.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


Last login: Tue Nov 14 09:52:05 2017 from 10.0.2.2

which is nice.

Also, for the record, I can see the VM using VirtualBox's own tools e.g.

vboxmanage list vms
"foobar_default_1510584547514_91304" {92e7e750-6c83-4b64-b8d2-2cf66df2f2c7}

vboxmanage list vms --long
Name:            foobar_default_1510584547514_91304
Groups:          /
Guest OS:        Ubuntu (64-bit)
UUID:            92e7e750-6c83-4b64-b8d2-2cf66df2f2c7
Config file:     /home/hayd/VirtualBox VMs/foobar_default_1510584547514_91304/foobar_default_1510584547514_91304.vbox
Snapshot folder: /home/hayd/VirtualBox VMs/foobar_default_1510584547514_91304/Snapshots
Log folder:      /home/hayd/VirtualBox VMs/foobar_default_1510584547514_91304/Logs
Hardware UUID:   92e7e750-6c83-4b64-b8d2-2cf66df2f2c7
Memory size:     512MB
Page Fusion:     off
VRAM size:       12MB

etc.

Thursday, 9 November 2017

Cloud Foundry and Ruby on IBM Bluemix - Learning, learning, learning - keep those lessons learning

Following a previous post: -


I'm running through this: -


and was hitting an issue with the version of Ruby specified within some of the lesson material.

This is what I saw: -

cf push

Using manifest file /Users/davidhay/Downloads/LFS132x/Scaling/web_app/manifest.yml

Creating app web-app in org david_hay@uk.ibm.com / space david_hay as david_hay@uk.ibm.com...
OK

Creating route web-app-pseudopoetic-para.eu-gb.mybluemix.net...
OK

Binding web-app-pseudopoetic-para.eu-gb.mybluemix.net to web-app...
OK

Uploading web-app...
Uploading app files from: /Users/davidhay/Downloads/LFS132x/Scaling/web_app
Uploading 1.4K, 5 files
Done uploading               
OK

Starting app web-app in org david_hay@uk.ibm.com / space david_hay as david_hay@uk.ibm.com...
Creating container
Successfully created container
Downloading app package...
Downloaded app package (1.4K)
Staging...
-----> Download go 1.9.1
-----> Running go build supply
-----> Ruby Buildpack version 1.7.6
-----> Supplying Ruby
-----> Installing bundler 1.15.4
       Download [https://buildpacks.cloudfoundry.org/dependencies/bundler/bundler-1.15.4-e083af6d.tgz]
       **ERROR** Unable to determine ruby: Unable to determine ruby version: Running ruby: No Matching versions, ruby = 2.4.0 not found in this buildpack
Failed to compile droplet: Failed to run all supply scripts: exit status 15
Exit status 223
Staging failed: STG: Exited with status 223
Stopping instance 2c697834-9c31-40d3-8bfc-49211038f0ab
Destroying container
Successfully destroyed container

FAILED
Error restarting application: BuildpackCompileFailed

TIP: use 'cf logs web-app --recent' for more information

Looking at the Gemfile we have this: -

source "https://rubygems.org"
ruby "2.4.0"

gem "sinatra"
gem "thin"
gem "puma"


Supposedly IBM Bluemix ( now IBM Cloud ) supports Ruby 2.4.0, as per this: -



and this: -



Thankfully this brought light to my darkness: -


I altered my Gemfile: -

source "https://rubygems.org"
ruby "~> 2.4.0"

gem "sinatra"
gem "thin"
gem "puma"


and then tried again: -

cf push

Using manifest file /Users/davidhay/Downloads/LFS132x/Scaling/web_app/manifest.yml

Updating app web-app in org david_hay@uk.ibm.com / space david_hay as david_hay@uk.ibm.com...
OK

Uploading web-app...
Uploading app files from: /Users/davidhay/Downloads/LFS132x/Scaling/web_app
Uploading 1.4K, 5 files
Done uploading               
OK

Starting app web-app in org david_hay@uk.ibm.com / space david_hay as david_hay@uk.ibm.com...
Creating container
Successfully created container
Downloading app package...
Downloaded app package (1.4K)
Staging...
-----> Download go 1.9.1
-----> Running go build supply
-----> Ruby Buildpack version 1.7.6
-----> Supplying Ruby
-----> Installing bundler 1.15.4
       Download [https://buildpacks.cloudfoundry.org/dependencies/bundler/bundler-1.15.4-e083af6d.tgz]
-----> Installing ruby 2.4.2
       Download [https://buildpacks.cloudfoundry.org/dependencies/ruby/ruby-2.4.2-linux-x64-3810a760.tgz]
-----> Installing dependencies using bundler 1.15.4
       Running: bundle install --without development:test --jobs=4 --retry=4 --path /tmp/contents845865966/deps/0/vendor_bundle --binstubs /tmp/contents845865966/deps/0/binstubs --deployment
       Fetching gem metadata from https://rubygems.org/.........
       Fetching version metadata from https://rubygems.org/.
       Using bundler 1.15.4
       Fetching daemons 1.2.4
       Fetching eventmachine 1.2.3
       Fetching puma 3.8.2
       Installing daemons 1.2.4
       Installing eventmachine 1.2.3 with native extensions
       Installing puma 3.8.2 with native extensions
       Fetching rack 1.6.5
       Fetching tilt 2.0.7
       Installing tilt 2.0.7
       Installing rack 1.6.5
       Fetching rack-protection 1.5.3
       Fetching thin 1.7.0
       Installing thin 1.7.0 with native extensions
       Installing rack-protection 1.5.3
       Fetching sinatra 1.4.8
       Installing sinatra 1.4.8
       Bundle complete! 3 Gemfile dependencies, 9 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into /tmp/contents845865966/deps/0/vendor_bundle.
       Cleaning up the bundler cache.
-----> Creating runtime environment
-----> Saving vendor_bundle to cache
-----> Running go build finalize
-----> Finalizing Ruby
-----> Copy binaries to app/bin directory
Uploading droplet, build artifacts cache...
Exit status 0
Staging complete
Uploading build artifacts cache...
Uploading droplet...
Uploaded build artifacts cache (4.2M)
Uploaded droplet (22.4M)
Uploading complete
Stopping instance 214ab50c-5785-4260-9f19-a9c99323a7f5
Destroying container
Successfully destroyed container

1 of 1 instances running

App started


OK

App web-app was started using this command `rackup -p $PORT`

Showing health and status for app web-app in org david_hay@uk.ibm.com / space david_hay as david_hay@uk.ibm.com...
OK

requested state: started
instances: 1/1
usage: 32M x 1 instances
urls: web-app-pseudopoetic-para.eu-gb.mybluemix.net
last uploaded: Thu Nov 9 18:54:33 UTC 2017
stack: cflinuxfs2
buildpack: https://github.com/cloudfoundry/ruby-buildpack.git

     state     since                    cpu    memory     disk        details
#0   running   2017-11-09 06:56:11 PM   0.0%   0 of 32M   0 of 256M


cf apps

Getting apps in org david_hay@uk.ibm.com / space david_hay as david_hay@uk.ibm.com...
OK

name      requested state   instances   memory   disk   urls
web-app   started           1/1         32M      256M   web-app-pseudopoetic-para.eu-gb.mybluemix.net

YAY!

Hmmm, Segmentation Fault 11 with Cloud Foundry

Whilst following this online course: -


I was tinkering ( man, I love that word ) with Cloud Foundry ( CF ).

Now it's been a while and I've been through a macOS upgrade from Sierra to High Sierra ( wonder if there's a clue there ? ).

So this time around, I'm seeing "Segmentation Fault: 11" : -

cf version

Segmentation fault: 11

cf login

Segmentation fault: 11

which cf

/usr/local/bin/cf

ls -al `which cf`

-rwxr-xr-x  1 root  wheel  23559164 11 Aug  2016 /usr/local/bin/cf

I tried downloading a new copy of the Bluemix CLI code from here: -


and, having installed the same, tried again, but alas with the same results.

Using this as inspiration: -


I tried this: -

Current platform is macOS. Downloading corresponding Bluemix CLI...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   100    0   100    0     0    127      0 --:--:-- --:--:-- --:--:--   126
100 13.2M  100 13.2M    0     0   372k      0  0:00:36  0:00:36 --:--:--  429k
Download complete. Executing installer...
Password:
installer: Package name is Bluemix Command Line Interface
installer: Upgrading at base path /
installer: The upgrade was successful.
Install complete.

but again to no avail.

So I dug further, and realised that, whilst I was upgrading the Bluemix code, the CF code was staying as-is, as evidenced: -

ls -al `which cf`

-rwxr-xr-x  1 root  wheel  23559164 11 Aug  2016 /usr/local/bin/cf

So, from here: -

The official command line client for Cloud Foundry http://docs.cloudfoundry.org/cf-cli


specifically this: -

which gave me this: -

-rwxr-xr-x     1 davidhay  staff  18472468  9 Nov 17:08 cf

which JUST WORKS !!

~/cf version

cf version 6.32.0+0191c33d9.2017-09-26

~/cf help

cf version 6.32.0+0191c33d9.2017-09-26, Cloud Foundry command line tool
Usage: cf [global options] command [arguments...] [command options]

Before getting started:
  config    login,l      target,t
  help,h    logout,lo    

Application lifecycle:
  apps,a        run-task,rt    events
  push,p        logs           set-env,se
  start,st      ssh            create-app-manifest
  stop,sp       app            
  restart,rs    env,e          
  restage,rg    scale          


~/cf login -sso

API endpoint: https://api.eu-gb.bluemix.net

One Time Code (Get one at https://login.eu-gb.bluemix.net/UAALoginServerWAR/passcode)> 

etc.

So, to finish off, all I needed to do was this: -

sudo mv ~/cf /usr/local/bin

and then validate: -

ls -al `which cf`

-rwxr-xr-x  1 davidhay  staff  18472468 26 Sep 22:44 /usr/local/bin/cf

cf version

cf version 6.32.0+0191c33d9.2017-09-26

and we're golden.

Wednesday, 8 November 2017

Installing IBM DB2 on Linux using IBM Installation Manager - Fun and Games

I've installed DB2 a million (!) times over the past 17 years, since I joined what was then IBM Software Group.

However, I've almost always installed it using the DB2 installation binaries and response files.

For a long time now, it's been packaged with IBM BPM, and other products, and thus suitable to be installed using IBM Installation Manager (IIM).

So now I'm trying that ….

One thing of which to be aware; DB2 is typically only ever installed as root, which means ( to me, at least ) that BPM etc. is also installed as root - which feels wrong.

But that's a challenge for another day.

I've got a response file to install WAS, BPM, DB2 etc., and am driving IIM as root (!): -

/opt/ibm/InstallationManager/eclipse/tools/imcl -input installBPM86_DB2_root.rsp -acceptLicense

Alas this failed with: -

ERROR: Error during "install" phase:
  ERROR: Installation of DB2 Advanced Workgroup Server has failed. 
  Installation failure reason: A fatal error occurred during the installation.


Thankfully, IIM keeps logs, lots of logs.

In my (root) case, these are here: -

/var/ibm/InstallationManager/logs

e.g. 

ls -altrc /var/ibm/InstallationManager/logs

total 136
-rw-r--r--  1 root root 10400 Nov  8 15:11 log.xsl
-rw-r--r--  1 root root  2912 Nov  8 15:11 index.xsl
drwxr-xr-x  2 root root  4096 Nov  8 15:11 inputs
drwxr-xr-x  2 root root  4096 Nov  8 15:14 native
drwxr-xr-x 13 root root  4096 Nov  8 15:14 ..
-rw-r--r--  1 root root 82682 Nov  8 15:14 20171108_1511.xml
-rw-r--r--  1 root root   224 Nov  8 15:14 index.xml
drwxr-xr-x  4 root root  4096 Nov  8 15:14 .
-rw-r--r--  1 root root 13686 Nov  8 15:14 sample.properties

view /var/ibm/InstallationManager/logs/20171108_1511.xml 

<entry num='234' time='1510154080965' elapsed='03:28.24' level='ERROR' thread='Thread-425'>
 <logger>global</logger>
 <class>com.ibm.db2exp.exec.Install</class>
 <method>exec</method>
 <message>com.ibm.db2exp.exec.Install
Command: [Ljava.lang.String;@174464c6
Return code : 67
StdOut :   Aborting the current installation ...
  Run installation with the option "-f sysreq" parameter to force the installation.

StdErr : Requirement not matched for DB2 database "Server" . Version: "11.1.0.0".

Summary of prerequisites that are not met on the current system:

   DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".


   Required minimum operating system distribution: "RHEL"; Version: "6"; Service pack: "7".
   Actual operating system distribution Version: "6"; Service pack: "6".


</message>
</entry>


which makes sense …

cat /etc/redhat-release 

Red Hat Enterprise Linux Server release 6.6 (Santiago)

To check my hypothesis, I "cheated" by editing the above: -

Red Hat Enterprise Linux Server release 6.7 (Santiago)

and now things install happily :-)

/opt/ibm/InstallationManager/eclipse/tools/imcl -input installBPM86_DB2_root.rsp -acceptLicense

Installed 8.5.5.12-WS-WASND-IFPI82630_8.5.5012.20170718_1447 to the /opt/ibm/WebSphere/AppServer directory.
Installed com.ibm.websphere.ND.v85_8.5.5012.20170627_1018 to the /opt/ibm/WebSphere/AppServer directory.
Installed com.ibm.bpm.ADV.v85_8.6.0.20170918_1207 to the /opt/ibm/WebSphere/AppServer directory.
Installed com.ibm.ws.DB2EXP.linuxia64_11.1.0.20170918_0944 to the /opt/ibm/WebSphere/AppServer directory.


/opt/ibm/WebSphere/AppServer/db2/bin/db2level

DB21085I  This instance or install (instance name, where applicable: 
"db2inst1") uses "64" bits and DB2 code release "SQL11010" with level 
identifier "0201010F".
Informational tokens are "DB2 v11.1.0.0", "s1606081100", "DYN1606081100AMD64", 
and Fix Pack "0".
Product is installed at "/opt/ibm/WebSphere/AppServer/db2".


Of course, when I do this properly, I will use a supported version of RHEL, rather than "hacking" the redhat-release file …..

Hmmm, why can't root uninstall IBM DB2 ?

I'm cleaning up a VM, and looking to remove DB2 11.1: -

/opt/ibm/db2/V10.5/install/db2_deinstall -a

DBI1149E  To execute this program, you must be the owner of the
      installation copy.

Explanation: 

The current DB2 copy was not installed by the user who is running the
program.

User response: 

Log in as the user who installed the current copy of DB2 and rerun the
command.


Given that I'm doing this as root, I'm wondering "Whaaaaat?"

So I dug further …

/opt/ibm/db2/V10.5/install/db2ls

Install Path                       Level   Fix Pack   Special Install Number   Install Date                  Installer UID 
---------------------------------------------------------------------------------------------------------------------
/opt/ibm/db2/V10.5               10.5.0.5        5                            Sun Apr  5 21:33:46 2015 BST             0 


which shows me that the installing user is UID 0 aka root, as evidenced below: -

id

uid=0(root) gid=0(root) groups=0(root)

Following this IBM document: -


I checked further: -

/opt/ibm/db2/V10.5/bin/db2val -o

DBI1379I  The db2val command is running. This can take several minutes.

DBI1335I  Installation file validation for the DB2 copy installed at
      /opt/ibm/db2/V10.5 was successful.

DBI1343I  The db2val command completed successfully. For details, see
      the log file /tmp/db2val-171108_124437.log.


cat /tmp/db2val-171108_124437.log

Installation file validation for the DB2 copy installed at "/opt/ibm/db2/V10.5" starts.

Task 1: Validating Installation file sets.
Status 1 : Success 

Task 2: Validating embedded runtime path for DB2 executables and libraries.
Status 2 : Success 

Task 3: Validating the accessibility to the installation path.
Status 3 : Success 

Task 4: Validating the accessibility to the /etc/services file.
Status 4 : Success 

DBI1335I  Installation file validation for the DB2 copy installed at
      /opt/ibm/db2/V10.5 was successful.

Installation file validation for the DB2 copy installed at "/opt/ibm/db2/V10.5" ends.

DBI1343I  The db2val command completed successfully. For details, see
      the log file /tmp/db2val-171108_124437.log.


which left me none the wiser.

I checked the permissions: -

ls -al /opt/ibm/db2/

total 12
drwxr-xr-x.  3 wasadmin wasadmins 4096 Apr  5  2015 .
drwxr-xr-x.  5 wasadmin wasadmins 4096 Nov  8 12:34 ..
drwxr-xr-x. 41 wasadmin wasadmins 4096 Apr  5  2015 V10.5


which pointed out where I was going wrong.

At some point, I'd gone back and done a chown on the /opt/ibm file-system :-)

DOOFUS!!

I fixed this: -

chown -R root:root /opt/ibm/db2/

ls -al /opt/ibm/db2

total 12
drwxr-xr-x.  3 root     root      4096 Apr  5  2015 .
drwxr-xr-x.  5 wasadmin wasadmins 4096 Nov  8 12:34 ..
drwxr-xr-x. 41 root     root      4096 Apr  5  2015 V10.5

and then retried the uninstallation: -

/opt/ibm/db2/V10.5/install/db2_deinstall -a

DBI1016I  Program db2_deinstall is performing uninstallation. Please
      wait.


The execution completed successfully.

For more information see the DB2 uninstallation log at
"/tmp/db2_deinstall.log.112308".

:-)

For the record, I'd already dropped the databases, and removed the instance: -

/opt/ibm/db2/V10.5/instance/db2idrop db2inst1

and the DB2 Administration Service (DAS): -

/opt/ibm/db2/V10.5/instance/dasdrop

Monday, 6 November 2017

Using curl to drive a SOAP-based web service

As part of some tinkering (!) with IBM BPM 8.6, specifically to test a SOAP-based Web Service, as exposed ( exported ) by a SCA module, I wanted to quickly test the service without needing to start/use SoapUI each and every time.

Thankfully, there's a curl for that …

I'd checked the SCA Module to check the Endpoint Address of the SCA module: -


and then hit the ?wsdl action to pull back the WSDL itself: -


This auto-expands to this URL: -


I then used SoapUI one time only to hit this expanded URL, to get a view on the input XML: -


I then created an XML file that represented the input to the Web Service: -

canarySoap.xml

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cal="http://Canary/callTheCanary">
   <soapenv:Header/>
   <soapenv:Body>
      <cal:callTheCanary>
         <yourName>Dave Hay</yourName>
      </cal:callTheCanary>
   </soapenv:Body>
</soapenv:Envelope>

and then worked out ( thanks to Google ) how to invoke it using curl: -

curl --insecure --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:urn:callTheCanary" --data @canarySoap.xml https://bpmdb.uk.ibm.com:9443/CanaryWeb/sca/callTheCanary

Now I can hit the service as often as I like, and see the response in the BPM box's SystemOut.log: -

tail -f /opt/ibm/WebSphereProfiles/AppSrv01/logs/AppClusterMember1/SystemOut.log

...
[06/11/17 17:35:09:791 GMT] 0000002e XSThreadPool  W   CWOBJ7852W: Thread starvation detected.  Thread scheduling delay is 126842 ms.
[06/11/17 17:35:29:577 GMT] 0000004f CoordinatorCo W   HMGR0152W: CPU Starvation detected. Current thread scheduling delay is 126 seconds.
[06/11/17 17:35:29:626 GMT] 00000051 ApplicationMo W   DCSV0004W: DCS Stack DefaultCoreGroup at Member PSCell1\Node1\AppClusterMember1: Did not receive adequate CPU time slice. Last known CPU usage time at 17:32:53:015 GMT. Inactivity duration was 126 seconds. 
[06/11/17 19:29:21:443 GMT] 0000002e XSThreadPool  W   CWOBJ7852W: Thread starvation detected.  Thread scheduling delay is 6789141 ms.
[06/11/17 19:29:24:506 GMT] 00000104 TaskLoader    I   CWLLG0597I: Trying to acquire synchronous queue SYNC_QUEUE_1.
[06/11/17 19:29:24:514 GMT] 00000104 TaskLoader    I   CWLLG0581I: Acquired synchronous queue SYNC_QUEUE_1.
[06/11/17 19:29:38:720 GMT] 0000004f CoordinatorCo W   HMGR0152W: CPU Starvation detected. Current thread scheduling delay is 6789 seconds.
[06/11/17 19:29:38:767 GMT] 00000053 ApplicationMo W   DCSV0004W: DCS Stack DefaultCoreGroup at Member PSCell1\Node1\AppClusterMember1: Did not receive adequate CPU time slice. Last known CPU usage time at 17:35:59:627 GMT. Inactivity duration was 6789 seconds. 
[06/11/17 20:35:36:122 GMT] 000004b3 ServerCache   I   DYNA1001I: WebSphere Dynamic Cache instance named ws/WSSecureMapNotShared initialized successfully.
[06/11/17 20:35:36:122 GMT] 000004b3 ServerCache   I   DYNA1071I: The cache provider "default" is being used.
[06/11/17 20:39:46:344 GMT] 000004b3 SystemOut     O Your name is Dave Hay
[06/11/17 20:40:03:095 GMT] 000004b3 SystemOut     O Your name is Dave Hay
[06/11/17 20:40:03:984 GMT] 000004b3 SystemOut     O Your name is Dave Hay
...

Yay !

Friday, 3 November 2017

Amazon Web Services and a Salutary Learning Experience

I received a small but costly reminder that little in life is free this AM.

Whilst indulging in my usual bout of cross-trainer ( #GymOClock ), I checked my emails and saw one purportedly from Amazon Web Services (AWS), suggesting that I owed them $56.31.

Being a cautious type, I did NOT click on the links in the email, but instead logged into my AWS dashboard: -


and navigated across to the Billing Dashboard: -


Lo and behold, there was a pukka invoice for October 2017, detailing the costs: -


I'd spun up a pair of RHEL VMs in early October, along with a HTTPS load balancer, in order to replicate a client's environment.

And then semi-forgotten about them ….

To be fair, I did have problems logging back into AWS, due to verification emails not getting through someone's spam filters, but …..

I forgot.

I've since shut down the VMs, so November's bill shouldn't be quite so high :-)

The moral of the story, nothing is free in life - apart from air :-)

Thursday, 2 November 2017

IBM Cloud Private - What I'm reading now

I'm going through a period of self-enablement on IBM's recently launched IBM Cloud Private (ICP) solution, and found this: -


to be amazingly useful.

I've not yet followed the tutorial, but I will be going through it in the next few weeks ….


A pre-packaged enterprise-class solution, IBM Cloud Private delivers a single platform located behind your firewall. You can leverage your on-premises software portfolio or easily integrate next-generation data and software optimized for cloud. Built on open source frameworks, like containers, Kubernetes and Cloud Foundry, IBM Cloud Private offers flexibility, control, security and easy integration with public cloud. Plus cloud management solutions are included so you can govern multi-cloud infrastructures and applications.

Rails, Angular, Postgres, and Bootstrap - A Book Review

As I've mentioned previously, I periodically review books for the British Computer Society (BCS), including: -


For me, this was a voyage of discovery, in part because I have little or no background in full-stack web development.

Therefore, I read this as an introduction to the core technologies, especially Bootstrap and AngularJS.

One thing that was immediately apparent was the vast number of dependencies, plugins and tools that one needs to download and install, including Yarn, Webpack, Foreman etc.

The book assumes, and expects, that the developer will have the access, ability and experience to install a whole slew of software and, perhaps, helps argue the case for containerisation ( given that a number of the core components are available via Docker etc. ).

To be honest, this isn't completely alien to me, given that I've used IBM tools such as Rational Application Developer and IBM Integration Designer, which have their own dependencies - Java, Eclipse, WebSphere Application Server, DB2 etc.

The book immediately dives into the specific detail of these dependencies and tools, and then uses a worked example, known as Shine, throughout the successive chapters to illustrate how Bootstrap and Postgres work, before diving into responsive UI development using AngularJS.

Throughout the book, the author does focus upon important non-functional requirements such as security and performance, and also focuses upon testing, caching and interaction styles ( especially asynchronous ).

For me, I found this book to be amazingly detailed guide, that would provide a good roadmap for a developer keen to to develop their skills and experience with Rails, Angular, Postgres and Bootstrap.

Whilst this isn't something that I specifically need in my job role, it's very useful context.

So, to summarise, this book is likely to be of use, and could provide a useful background to anyone beginning their career in full-stack web / UI database development.

In terms of rating, I'd give this book 10/10.

Doh, Apple Time Machine and Docker - Disk and Om Nom Nom - And there's more

Following this post: -


One of my friends pointed out the error of my ways …

Docker has this: -


which should definitely help :-)

Thanks Andy, you're a star :-)