Wednesday 30 August 2017

Tinkering with IBM Containers on IBM Bluemix - Like Docker really ...

As per previous posts, I have been tinkering with IBM Containers (IC) on IBM Bluemix, and am starting to bring things together in my mind, in terms of positioning IC vs. Kubernetes vs. Docker.

One of the many things that I like is the amount of help and choices that one has.

Having initialised the Bluemix ( bc ) Cloud Foundry ( cf ) IBM Containers ( ic ) environment: -

bx cf ic init

Invoking 'cf ic init'...

Deleting old configuration file...
OK
Generating client certificates for IBM Containers...
Client certificates are being stored in /Users/foobar/.ice/certs/...

Client certificates are being stored in /Users/foobar/.ice/certs/containers-api.eu-gb.bluemix.net/21377cbf-6e5f-4a9a-175a-4fdfeb3c3e12...

OK
Client certificates were retrieved.

Checking local Docker configuration...
OK

Authenticating with registry at host name registry.eu-gb.bluemix.net
OK
You are authenticated with IBM Bluemix Container Registry.
Your private Bluemix repository is URL: registry.eu-gb.bluemix.net/foobar
No ic-cfg.ini found on the system. Creating...

You can choose from two ways to use the Docker CLI with IBM Containers:


Option 1: This option allows you to use 'cf ic' for managing containers on IBM Containers while still using the Docker CLI directly to manage your local Docker host.
Use this Cloud Foundry IBM Containers plug-in without affecting the local Docker environment:


Example Usage:
cf ic ps
cf ic images

Option 2: Use the Docker CLI directly. In this shell, override the local Docker environment to connect to IBM Containers by setting these variables. Copy and paste the following commands:
Note: Only Docker commands followed by (Docker) are supported with this option. 
  export DOCKER_HOST=tcp://containers-api.eu-gb.bluemix.net:8443
  export DOCKER_CERT_PATH=/Users/foobar/.ice/certs/containers-api.eu-gb.bluemix.net/21377cbf-6e5f-4a9a-175a-4fdfeb3c3e12
  export DOCKER_TLS_VERIFY=1

Example Usage:
docker ps
docker images



it's great to see that I can use either cf ic commands: -

cf ic ps

CONTAINER ID        IMAGE                                                       COMMAND             CREATED             STATUS              PORTS                            NAMES
3cf533af-c95        registry.eu-gb.bluemix.net/foobar/db2expressc:pamfixed   "db2start "         8 days ago          Running             134.168.59.83:50000->50000/tcp   db2


cf ic images

REPOSITORY                                               TAG                 IMAGE ID            CREATED             SIZE
registry.eu-gb.bluemix.net/ibmnode                       v1.2                b1667ce7e5af        2 weeks ago         183MB
registry.eu-gb.bluemix.net/ibmnode                       v1.1                18f8f073b62b        2 weeks ago         176MB
registry.eu-gb.bluemix.net/ibm-websphere-extreme-scale   latest              8fccb460321a        7 weeks ago         466MB
registry.eu-gb.bluemix.net/ibm-integration-bus           latest              4b5f5fb39008        4 weeks ago         698MB
registry.eu-gb.bluemix.net/ibm_wa_agent                  latest              db7dc2abff64        4 months ago        435MB
registry.eu-gb.bluemix.net/ibm-mq                        latest              b42d55b53b18        8 days ago          455MB
registry.eu-gb.bluemix.net/ibmliberty                    webProfile7         cd826253309d        7 weeks ago         268MB
registry.eu-gb.bluemix.net/ibmnode                       v4                  20020df7341b        2 weeks ago         188MB
registry.eu-gb.bluemix.net/ibmnode                       latest              20020df7341b        2 weeks ago         188MB
registry.eu-gb.bluemix.net/ibm-backup-restore            latest              ea90ec45b636        4 weeks ago         205MB
registry.eu-gb.bluemix.net/ibm-node-strong-pm            latest              9499f23eb689        4 months ago        281MB
registry.eu-gb.bluemix.net/ibmliberty                    webProfile6         b350d9fd08fd        7 weeks ago         260MB
registry.eu-gb.bluemix.net/ibmliberty                    latest              edea51e84600        7 weeks ago         307MB
registry.eu-gb.bluemix.net/ibmliberty                    javaee7             edea51e84600        7 weeks ago         307MB
registry.eu-gb.bluemix.net/ibmliberty                    microProfile        4a50d0f49c6e        7 weeks ago         230MB
registry.eu-gb.bluemix.net/foobar/db2expressc         pamfixed            968890871f71        8 days ago          640MB

 -OR- docker commands: -

docker ps

CONTAINER ID        IMAGE                                                       COMMAND             CREATED             STATUS              PORTS                            NAMES
3cf533af-c95        registry.eu-gb.bluemix.net/foobar/db2expressc:pamfixed   "db2start "         8 days ago          Running             134.168.59.83:50000->50000/tcp   db2


docker images

REPOSITORY                                               TAG                 IMAGE ID            CREATED             SIZE
registry.eu-gb.bluemix.net/ibm-integration-bus           latest              4b5f5fb39008        4 weeks ago         698MB
registry.eu-gb.bluemix.net/ibm_wa_agent                  latest              db7dc2abff64        4 months ago        435MB
registry.eu-gb.bluemix.net/ibm-websphere-extreme-scale   latest              8fccb460321a        7 weeks ago         466MB
registry.eu-gb.bluemix.net/ibm-mq                        latest              b42d55b53b18        8 days ago          455MB
registry.eu-gb.bluemix.net/ibm-node-strong-pm            latest              9499f23eb689        4 months ago        281MB
registry.eu-gb.bluemix.net/ibmnode                       latest              20020df7341b        2 weeks ago         188MB
registry.eu-gb.bluemix.net/ibmnode                       v4                  20020df7341b        2 weeks ago         188MB
registry.eu-gb.bluemix.net/ibmnode                       v1.1                18f8f073b62b        2 weeks ago         176MB
registry.eu-gb.bluemix.net/ibmliberty                    webProfile7         cd826253309d        7 weeks ago         268MB
registry.eu-gb.bluemix.net/ibmliberty                    microProfile        4a50d0f49c6e        7 weeks ago         230MB
registry.eu-gb.bluemix.net/ibmliberty                    latest              edea51e84600        7 weeks ago         307MB
registry.eu-gb.bluemix.net/ibmliberty                    javaee7             edea51e84600        7 weeks ago         307MB
registry.eu-gb.bluemix.net/ibmliberty                    webProfile6         b350d9fd08fd        7 weeks ago         260MB
registry.eu-gb.bluemix.net/ibm-backup-restore            latest              ea90ec45b636        4 weeks ago         205MB
registry.eu-gb.bluemix.net/ibmnode                       v1.2                b1667ce7e5af        2 weeks ago         183MB
registry.eu-gb.bluemix.net/foobar/db2expressc         pamfixed            968890871f71        8 days ago          640MB

You have a choice - and choices are good :-)

Friday 25 August 2017

IBM BPM and Oracle - another interesting problem

Earlier this week, I was working with a client to grow their BPM development environment from two to four nodes, meaning that the Deployment Environment effectively doubled in size.

We achieved this by editing the template ( Advanced-PS-ThreeClusters-Oracle.properties ) and adding the additional two nodes, each hosting three new cluster members, and then using the BPMConfig.sh script to update the Deployment Environment as follows: -

./BPMConfig.sh -create -de Advanced-PS-ThreeClusters-Oracle.properties

Having done this, we started up the DE, and validated the changes by hitting the Process Portal, Process Admin and BPC UIs, and also stopping the old nodes ( 1 and 2 ) and ensuring that the service carried on running on nodes 3 and 4.

Apart from briefly forgetting to regenerate/propagate the WebSphere Plugin configuration and then restart IBM HTTP Server, all was well.

However, when we started the core business application ( which is an Enterprise Archive comprising SCA modules with mediations and BPEL flows ), we saw this in the SystemOut.log for all of the AppCluster members, both the original AND the new ones: -

java.lang.NoClassDefFoundError: oracle.xdb.XMLType
Caused by: java.lang.ClassNotFoundException: oracle.xdb.XMLType
       at java.net.URLClassLoader.findClass(URLClassLoader.java:602)
       at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:243)
       at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:777)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:754)
       at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:134)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:731)

Given that this had worked before the change and given that we know what the change was, this was somewhat weird.

This is covered here: -


*BUT* nothing has changed … apart from what has changed.

We dug further through the logs, but to no avail.

We then started to dig into the WebSphere Classloader, using this as source: -


and this: -


specifically by tracing the class loader : -

Enable Java™ Virtual Machine (JVM) classloader traces through the Admin console:

• Select Servers, choose Application servers and select the server you want to configure.

• In the Server Infrastructure section, open Java and Process Management and select Process Definition.

• Under Additional Properties, select Java Virtual Machine.

• Check the Verbose class loading checkbox.

• Add the following string to the Generic JVM arguments field:

-Dws.ext.debug=true  -Dws.osgi.debug

• Click OK.

Once we did this, and looked at the trace, we could see that, whilst the Oracle JDBC driver ( ojdbc7.jar ) *WAS* being loaded ( and we could see that, partly because BPM was coming up and working, and partly because the JDBC Test Connection function worked for all of the databases, both BPM and application ), the requisite Oracle XML tool ( xdb6.jar ) was NOT being loaded.

However, when we looked at the configuration of the JDBC driver that was being used by the application-specific data source, it looked to be in order, similar to this: -


( although we're using the ojdbc7.jar rather than ojdbc6.jar as per the screenshot above ).

When we checked the underlying Linux file-system, we could see that ojdbc7.jar was present : -

ls -al /opt/ibm/WebSphere/AppServer/jdbcdrivers/Oracle/

total 6632
drwxr-xr-x 2 wasadmin wasadmins      40 Jul 10 19:59 .
drwxr-xr-x 5 wasadmin wasadmins      45 Jul 10 19:59 ..
-rw-r--r-- 1 wasadmin wasadmins 3389454 Jul 10 19:59 ojdbc6.jar
-rw-r--r-- 1 wasadmin wasadmins 3397734 Jul 10 19:59 ojdbc7.jar

*BUT* that the xdb6.jar was NOT in the same location.

When we dug further, we could see that xdb6.jar was here: -

/opt/ibm/WebSphere/AppServer/lib/ext

along with ojdbc7.jar and xmlparserv2.jar.

which is interesting.

This then led the client to drill into the WebSphere Variable ORACLE_JDBC_DRIVER_PATH which is referenced at the JDBC driver level.

This was set to: -

${WAS_INSTALL_ROOT}/jdbcdrivers/Oracle

which is, in effect, this path: -

/opt/ibm/WebSphere/AppServer/jdbcdrivers/Oracle/

Looking at another environment, it was clear that, at some point in the past, this variable had been altered to point here: -

/opt/ibm/WebSphere/AppServer/lib/ext

rather than here; -

/opt/ibm/WebSphere/AppServer/jdbcdrivers/Oracle/

But, and here's the interesting part, the BPMConfig.sh script must've reset the variable back to the IBM-supplied default.

So, the moral of the story is two-fold; try and avoid altering IBM-provided variables AND learn how to debug the class loader in WAS :-)

Introducing IBM Business Process Manager 8.6 and there's more

IBM Business Process Manager V8.6 delivers product simplifications to utilize its full power more easily and provide greater flexibility and new capabilities


Wednesday 23 August 2017

IBM HTTP Server and HTTP Strict Transport Security (HSTS)

I was asked about this earlier today.

IBM HTTP Server (IHS), being based upon Apache, can do most whatever Apache itself can do.

This means that HTTP Strict Transport Security (HSTS) *can* be enabled in IHS.

I followed this blog post: -


and I can see the header being set: -

 


This is what I did in httpd.conf : -

Disabled HTTP

#Listen 8080

Enabled SSL and enforced TLS 1.2

LoadModule ibm_ssl_module modules/mod_ibm_ssl.so
Listen 8443
<VirtualHost *:8443>
        SSLProtocolEnable TLSv12
        SSLProtocolDisable SSLv2 SSLv3 TLSv10 TLSv11
        SSLEnable
</VirtualHost>
KeyFile /opt/ibm/HTTPServer/ODM/ssl/keystore.kdb
SSLDisable

Added in mod_headers

LoadModule headers_module modules/mod_headers.so

Added in the appropriate HSTS header - using two years as an example expiration period ( 2 * 365 days * 24 hours * 60 minutes * 60 seconds )

        Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;"

giving me this: -

LoadModule headers_module modules/mod_headers.so
LoadModule ibm_ssl_module modules/mod_ibm_ssl.so
Listen 8443
<VirtualHost *:8443>
        Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;"
        SSLProtocolEnable TLSv12
        SSLProtocolDisable SSLv2 SSLv3 TLSv10 TLSv11
        SSLEnable
</VirtualHost>
KeyFile /opt/ibm/HTTPServer/ODM/ssl/keystore.kdb
SSLDisable

with the configuration being validated using wget : -

wget --no-check-certificate https://odm.uk.ibm.com:8443/index.html --server-response

--2017-08-23 10:48:31--  https://odm.uk.ibm.com:8443/index.html
Resolving odm.uk.ibm.com (odm.uk.ibm.com)... fe80::20c:29ff:fe9a:9e56, 192.168.153.133
Connecting to odm.uk.ibm.com (odm.uk.ibm.com)|fe80::20c:29ff:fe9a:9e56|:8443... connected.
WARNING: cannot verify odm.uk.ibm.com's certificate, issued by '/CN=odm.uk.ibm.com':
  Self-signed certificate encountered.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Date: Wed, 23 Aug 2017 09:48:31 GMT
  Strict-Transport-Security: max-age=63072000; includeSubdomains;
  Last-Modified: Mon, 31 Oct 2016 10:10:36 GMT
  ETag: "da5-540266b425f00"
  Accept-Ranges: bytes
  Content-Length: 3493
  Keep-Alive: timeout=10, max=100
  Connection: Keep-Alive
  Content-Type: text/html
Length: 3493 (3.4K) [text/html]
Saving to: 'index.html'

100%[================================================================================================================================================================>] 3,493       --.-K/s   in 0s      

2017-08-23 10:48:31 (357 MB/s) - 'index.html'saved [3493/3493]

and apachectl : -

/opt/ibm/HTTPServer/bin/apachectl -DDUMP_SSL_CONFIG -f /opt/ibm/HTTPServer/ODM/conf/httpd.conf

 

SSL configuration:
Default server
Server name: odm.uk.ibm.com:8080
SSL enabled: NO

SSL server defined at: /opt/ibm/HTTPServer/ODM/conf/httpd.conf:852
Server name: odm.uk.ibm.com:8443
SSL enabled: YES
FIPS enabled: 0
Keyfile: /opt/ibm/HTTPServer/ODM/ssl/keystore.kdb
Protocols enabled: TLSv12
Ciphers for SSLV2: (protocol disabled)
Ciphers for SSLV3: (protocol disabled)
Ciphers for TLSv10: (protocol disabled)
Ciphers for TLSv11: (protocol disabled)
Ciphers for TLSv12: (defaults) TLS_RSA_WITH_AES_128_GCM_SHA256(9C),TLS_RSA_WITH_AES_256_GCM_SHA384(9D),TLS_RSA_WITH_AES_128_CBC_SHA256(3C),TLS_RSA_WITH_AES_256_CBC_SHA256(3D),TLS_RSA_WITH_AES_128_CBC_SHA(2F),TLS_RSA_WITH_AES_256_CBC_SHA(35b),SSL_RSA_WITH_3DES_EDE_CBC_SHA(3A)

Syntax OK

Hope this helps.

Kubernetes and IBM Bluemix: How to deploy, manage, and secure your container-based workloads

A rather useful series of blog posts: -


which dovetails with my personal interests right now, given that I've just successfully brought up: -

(a) a containerised instance of IBM DB2 Express using Docker on my Mac
(b) the same on IBM Containers on IBM Bluemix
(c) the same but on Kubernetes on IBM Bluemix ( leveraging Clusters, Deployments, Pods and Nodes ).

My next challenge is to add WebSphere Liberty Profile into my Kubernetes cluster and see whether I can get a Java servlet talking via JDBC to DB2, which shouldn't be too hard #FamousLastWords

Meantime, enjoy the articles ...

Tuesday 22 August 2017

Doh, IBM DB2 on the IBM Container Service on IBM Bluemix, remember persistence :-)

Having got DB2 running on the IBM Container Service on IBM Bluemix: -


I was a little perturbed when my Java code failed to work, when connecting from my Mac to the DB2 container: -

java -cp db2jcc4.jar:. JdbcTestDB2 54.23.128.93 50000 SAMPLE db2inst1 Qp455w0rd!

com.ibm.db2.jcc.am.SqlException: DB2 SQL Error: SQLCODE=-1031, SQLSTATE=58031, SQLERRMC=null, DRIVER=4.23.42

I checked the SQL code: -

db2 ? sql1031

SQL1031N  The database directory cannot be found on the indicated file
      system.


Explanation: 

The system database directory or local database directory could not be
found. A database has not been created or it was not cataloged
correctly.

The command cannot be processed.

User response: 

Verify that the database is created with the correct path specification.
The Catalog Database command has a path parameter which specifies the
directory where the database resides.

sqlcode: -1031

sqlstate: 58031


which made me think: -

db2 list db directory

SQL1031N  The database directory cannot be found on the indicated file system. 
SQLSTATE=58031


and then it hit me ….

I'd previously dropped the running container: -

cf ic stop db2

removed it: -

cf ic rm db2

and started a new one: -

cf ic run --name db2 -p 50000:50000 -e DB2INST1_PASSWORD=Qp455w0rd! -e LICENSE=accept -d registry.eu-gb.bluemix.net/david_hay/db2expressc:pamfixed db2start

and validated it: -

cf ic ps -a

CONTAINER ID        IMAGE                                                       COMMAND             CREATED             STATUS              PORTS               NAMES
3cf533af-c95        registry.eu-gb.bluemix.net/david_hay/db2expressc:pamfixed   "db2start "         50 seconds ago      Running             50000/tcp           db2


and requested an IP address: -

cf ic ip request

OK
IP address "54.23.128.93" was obtained.


and bound the IP address to the container: -

cf ic ip bind 54.23.128.93 db2

OK
The IP address was bound successfully.


So, of course, I no longer had any databases :-)

To mitigate this, I started a shell to the running container: -

cf ic exec -i -t db2 /bin/bash

switched to the db2inst1 user: -

su - db2inst1

and created the SAMPLE database: -

db2sampl

  Creating database "SAMPLE"...
  Connecting to database "SAMPLE"...
  Creating tables and data in schema "DB2INST1"...
  Creating tables with XML columns and XML data in schema "DB2INST1"...

  'db2sampl' processing complete.


and validated that all was well: -

db2 connect to SAMPLE

   Database Connection Information

 Database server        = DB2/LINUXX8664 10.5.5
 SQL authorization ID   = DB2INST1
 Local database alias   = SAMPLE


db2 select "EMPNO,FIRSTNME,LASTNAME from DB2INST1.EMPLOYEE"

EMPNO  FIRSTNME     LASTNAME       
------ ------------ ---------------
000010 CHRISTINE    HAAS           
000020 MICHAEL      THOMPSON       
000030 SALLY        KWAN           
000050 JOHN         GEYER          
000060 IRVING       STERN          
000070 EVA          PULASKI        
000090 EILEEN       HENDERSON      
000100 THEODORE     SPENSER        
000110 VINCENZO     LUCCHESSI      
000120 SEAN         O'CONNELL      
000130 DELORES      QUINTANA       
000140 HEATHER      NICHOLLS       
000150 BRUCE        ADAMSON        
000160 ELIZABETH    PIANKA         
000170 MASATOSHI    YOSHIMURA      
000180 MARILYN      SCOUTTEN       
000190 JAMES        WALKER         
000200 DAVID        BROWN          
000210 WILLIAM      JONES          
000220 JENNIFER     LUTZ           
000230 JAMES        JEFFERSON      
000240 SALVATORE    MARINO         
000250 DANIEL       SMITH          
000260 SYBIL        JOHNSON        
000270 MARIA        PEREZ          
000280 ETHEL        SCHNEIDER      
000290 JOHN         PARKER         
000300 PHILIP       SMITH          
000310 MAUDE        SETRIGHT       
000320 RAMLAL       MEHTA          
000330 WING         LEE            
000340 JASON        GOUNOT         
200010 DIAN         HEMMINGER      
200120 GREG         ORLANDO        
200140 KIM          NATZ           
200170 KIYOSHI      YAMAMOTO       
200220 REBA         JOHN           
200240 ROBERT       MONTEVERDE     
200280 EILEEN       SCHWARTZ       
200310 MICHELLE     SPRINGER       
200330 HELENA       WONG           
200340 ROY          ALONZO         

  42 record(s) selected.

I then re-ran my Java code: -

java -cp db2jcc4.jar:. JdbcTestDB2 54.23.128.93 50000 SAMPLE db2inst1 Qp455w0rd!

000010 CHRISTINE HAAS
000020 MICHAEL THOMPSON
000030 SALLY KWAN
000050 JOHN GEYER
000060 IRVING STERN
000070 EVA PULASKI
000090 EILEEN HENDERSON
000100 THEODORE SPENSER
000110 VINCENZO LUCCHESSI
000120 SEAN O'CONNELL
000130 DELORES QUINTANA
000140 HEATHER NICHOLLS
000150 BRUCE ADAMSON
000160 ELIZABETH PIANKA
000170 MASATOSHI YOSHIMURA
000180 MARILYN SCOUTTEN
000190 JAMES WALKER
000200 DAVID BROWN
000210 WILLIAM JONES
000220 JENNIFER LUTZ
000230 JAMES JEFFERSON
000240 SALVATORE MARINO
000250 DANIEL SMITH
000260 SYBIL JOHNSON
000270 MARIA PEREZ
000280 ETHEL SCHNEIDER
000290 JOHN PARKER
000300 PHILIP SMITH
000310 MAUDE SETRIGHT
000320 RAMLAL MEHTA
000330 WING LEE
000340 JASON GOUNOT
200010 DIAN HEMMINGER
200120 GREG ORLANDO
200140 KIM NATZ
200170 KIYOSHI YAMAMOTO
200220 REBA JOHN
200240 ROBERT MONTEVERDE
200280 EILEEN SCHWARTZ
200310 MICHELLE SPRINGER
200330 HELENA WONG
200340 ROY ALONZO


So that's all good then :-)

The moral of the story - when you drop and recreate a container, don't assume that the "local" storage is still there; next time around, I'll mount some external storage to my container ….

IBM DB2 Express on IBM Containers - PAM says "No"

I'm still journeying the river of discovery with IBM Containers on IBM Bluemix, and was attempting to start / use a DB2 Express image: -

docker run --name db2 -p 50000:50000 -e DB2INST1_PASSWORD=passw0rd -e LICENSE=accept -d registry.eu-gb.bluemix.net/david_hay/db2expressc db2start

fb99173b-c082-4206-8f4f-ada478153bd3

docker logs db2 -f

gNew password: BAD PASSWORD: The password fails the dictionary check - it is based on a dictionary word
%Changing password for user db2inst1.
8passwd: all authentication tokens updated successfully.
WRetype new password: su: cannot create child process: Resource temporarily unavailable
Thinking that the password may be the problem, I tried something a little more "complex" : -

docker run --name db2 -p 50000:50000 -e DB2INST1_PASSWORD=Qp455w0rd! -e LICENSE=accept -d registry.eu-gb.bluemix.net/david_hay/db2expressc db2start

d0c05c2e-5ca1-45b6-9525-c765eb4ff9df

docker logs db2 -f

%Changing password for user db2inst1.
8passwd: all authentication tokens updated successfully.
eNew password: Retype new password: su: cannot create child process: Resource temporarily unavailable


This led me here: -




all of which indicate issues with the Pluggable Authentication Module (PAM).

so I've created a Docker file: -

vi Dockerfile

FROM registry.eu-gb.bluemix.net/david_hay/db2expressc:latest
RUN sed -i 's/session.*include/session        optional/' /etc/pam.d/su


and then re-created the image: -

Sending build context to Docker daemon  2.048kB
Step 1 : FROM registry.eu-gb.bluemix.net/david_hay/db2expressc:latest
 ---> 7aa154d9b73c
Step 2 : RUN sed -i 's/session.*include/session        optional/' /etc/pam.d/su
 ---> Using cache
 ---> 968890871f71
Successfully built 968890871f71
The push refers to a repository [registry.eu-gb.bluemix.net/david_hay/db2expressc]
285bba8edd34: Pushed 
5f70bf18a086: Pushed 
764bfaf5a76d: Pushed 
536fa091951a: Pushed 
9ee524f5fa90: Layer already exists 
642cadc5a8a2: Pushed 
bd119f2c7d01: Pushed 
d9aa87fe4cc8: Pushed 
ddb56e247f70: Pushed 
64e1da5c6f34: Pushed 
42a77d05e556: Pushed 
331a33188287: Pushed 
c8891592084f: Pushed 
51fe5429de3f: Pushed 
pamfixed: digest: sha256:7016e068cb2d8f3eeeb0c88e4850e82dbe9d39409ff23c7e80fb15bf7c268e44 size: 4479


I then start my container: -

docker run --name db2 -p 50000:50000 -e DB2INST1_PASSWORD=Qp455w0rd! -e LICENSE=accept -d registry.eu-gb.bluemix.net/david_hay/db2expressc:pamfixed db2start

ca37ea7b-0664-4568-8ad8-180bce0bcf04

check the logs: -

docker logs db2 -f

%Changing password for user db2inst1.
8passwd: all authentication tokens updated successfully.
.SQL1063N  DB2START processing was successful.
4Could not load host key: /etc/ssh/ssh_host_rsa_key
6Could not load host key: /etc/ssh/ssh_host_ecdsa_key
8Could not load host key: /etc/ssh/ssh_host_ed25519_key

open a shell to it: -

docker exec -i -t db2 /bin/bash

check DB2 version: -

db2level

DB21085I  This instance or install (instance name, where applicable: 
"db2inst1") uses "64" bits and DB2 code release "SQL10055" with level 
identifier "0606010E".
Informational tokens are "DB2 v10.5.0.5", "s141128", "IP23633", and Fix Pack 
"5".
Product is installed at "/home/db2inst1/sqllib".


and create the SAMPLE database: -

db2sampl

  Creating database "SAMPLE"...
  Connecting to database "SAMPLE"...
  Creating tables and data in schema "DB2INST1"...
  Creating tables with XML columns and XML data in schema "DB2INST1"...

  'db2sampl' processing complete.


and connect to the SAMPLE database

db2 connect to sample

   Database Connection Information

 Database server        = DB2/LINUXX8664 10.5.5
 SQL authorization ID   = DB2INST1
 Local database alias   = SAMPLE

and retrieve some data: -

db2 "select * from employee"

EMPNO  FIRSTNME     MIDINIT LASTNAME        WORKDEPT PHONENO HIREDATE   JOB      EDLEVEL SEX BIRTHDATE  SALARY      BONUS       COMM       
------ ------------ ------- --------------- -------- ------- ---------- -------- ------- --- ---------- ----------- ----------- -----------
000010 CHRISTINE    I       HAAS            A00      3978    01/01/1995 PRES          18 F   08/24/1963   152750.00     1000.00     4220.00
000020 MICHAEL      L       THOMPSON        B01      3476    10/10/2003 MANAGER       18 M   02/02/1978    94250.00      800.00     3300.00
000030 SALLY        A       KWAN            C01      4738    04/05/2005 MANAGER       20 F   05/11/1971    98250.00      800.00     3060.00
000050 JOHN         B       GEYER           E01      6789    08/17/1979 MANAGER       16 M   09/15/1955    80175.00      800.00     3214.00
000060 IRVING       F       STERN           D11      6423    09/14/2003 MANAGER       16 M   07/07/1975    72250.00      500.00     2580.00
000070 EVA          D       PULASKI         D21      7831    09/30/2005 MANAGER       16 F   05/26/2003    96170.00      700.00     2893.00
000090 EILEEN       W       HENDERSON       E11      5498    08/15/2000 MANAGER       16 F   05/15/1971    89750.00      600.00     2380.00
000100 THEODORE     Q       SPENSER         E21      0972    06/19/2000 MANAGER       14 M   12/18/1980    86150.00      500.00     2092.00
000110 VINCENZO     G       LUCCHESSI       A00      3490    05/16/1988 SALESREP      19 M   11/05/1959    66500.00      900.00     3720.00
000120 SEAN                 O'CONNELL       A00      2167    12/05/1993 CLERK         14 M   10/18/1972    49250.00      600.00     2340.00
000130 DELORES      M       QUINTANA        C01      4578    07/28/2001 ANALYST       16 F   09/15/1955    73800.00      500.00     1904.00
000140 HEATHER      A       NICHOLLS        C01      1793    12/15/2006 ANALYST       18 F   01/19/1976    68420.00      600.00     2274.00
000150 BRUCE                ADAMSON         D11      4510    02/12/2002 DESIGNER      16 M   05/17/1977    55280.00      500.00     2022.00
000160 ELIZABETH    R       PIANKA          D11      3782    10/11/2006 DESIGNER      17 F   04/12/1980    62250.00      400.00     1780.00
000170 MASATOSHI    J       YOSHIMURA       D11      2890    09/15/1999 DESIGNER      16 M   01/05/1981    44680.00      500.00     1974.00
000180 MARILYN      S       SCOUTTEN        D11      1682    07/07/2003 DESIGNER      17 F   02/21/1979    51340.00      500.00     1707.00
000190 JAMES        H       WALKER          D11      2986    07/26/2004 DESIGNER      16 M   06/25/1982    50450.00      400.00     1636.00
000200 DAVID                BROWN           D11      4501    03/03/2002 DESIGNER      16 M   05/29/1971    57740.00      600.00     2217.00
000210 WILLIAM      T       JONES           D11      0942    04/11/1998 DESIGNER      17 M   02/23/2003    68270.00      400.00     1462.00
000220 JENNIFER     K       LUTZ            D11      0672    08/29/1998 DESIGNER      18 F   03/19/1978    49840.00      600.00     2387.00
000230 JAMES        J       JEFFERSON       D21      2094    11/21/1996 CLERK         14 M   05/30/1980    42180.00      400.00     1774.00
000240 SALVATORE    M       MARINO          D21      3780    12/05/2004 CLERK         17 M   03/31/2002    48760.00      600.00     2301.00
000250 DANIEL       S       SMITH           D21      0961    10/30/1999 CLERK         15 M   11/12/1969    49180.00      400.00     1534.00
000260 SYBIL        P       JOHNSON         D21      8953    09/11/2005 CLERK         16 F   10/05/1976    47250.00      300.00     1380.00
000270 MARIA        L       PEREZ           D21      9001    09/30/2006 CLERK         15 F   05/26/2003    37380.00      500.00     2190.00
000280 ETHEL        R       SCHNEIDER       E11      8997    03/24/1997 OPERATOR      17 F   03/28/1976    36250.00      500.00     2100.00
000290 JOHN         R       PARKER          E11      4502    05/30/2006 OPERATOR      12 M   07/09/1985    35340.00      300.00     1227.00
000300 PHILIP       X       SMITH           E11      2095    06/19/2002 OPERATOR      14 M   10/27/1976    37750.00      400.00     1420.00
000310 MAUDE        F       SETRIGHT        E11      3332    09/12/1994 OPERATOR      12 F   04/21/1961    35900.00      300.00     1272.00
000320 RAMLAL       V       MEHTA           E21      9990    07/07/1995 FIELDREP      16 M   08/11/1962    39950.00      400.00     1596.00
000330 WING                 LEE             E21      2103    02/23/2006 FIELDREP      14 M   07/18/1971    45370.00      500.00     2030.00
000340 JASON        R       GOUNOT          E21      5698    05/05/1977 FIELDREP      16 M   05/17/1956    43840.00      500.00     1907.00
200010 DIAN         J       HEMMINGER       A00      3978    01/01/1995 SALESREP      18 F   08/14/1973    46500.00     1000.00     4220.00
200120 GREG                 ORLANDO         A00      2167    05/05/2002 CLERK         14 M   10/18/1972    39250.00      600.00     2340.00
200140 KIM          N       NATZ            C01      1793    12/15/2006 ANALYST       18 F   01/19/1976    68420.00      600.00     2274.00
200170 KIYOSHI              YAMAMOTO        D11      2890    09/15/2005 DESIGNER      16 M   01/05/1981    64680.00      500.00     1974.00
200220 REBA         K       JOHN            D11      0672    08/29/2005 DESIGNER      18 F   03/19/1978    69840.00      600.00     2387.00
200240 ROBERT       M       MONTEVERDE      D21      3780    12/05/2004 CLERK         17 M   03/31/1984    37760.00      600.00     2301.00
200280 EILEEN       R       SCHWARTZ        E11      8997    03/24/1997 OPERATOR      17 F   03/28/1966    46250.00      500.00     2100.00
200310 MICHELLE     F       SPRINGER        E11      3332    09/12/1994 OPERATOR      12 F   04/21/1961    35900.00      300.00     1272.00
200330 HELENA               WONG            E21      2103    02/23/2006 FIELDREP      14 F   07/18/1971    35370.00      500.00     2030.00
200340 ROY          R       ALONZO          E21      5698    07/05/1997 FIELDREP      16 M   05/17/1956    31840.00      500.00     1907.00

  42 record(s) selected.


Now to get an IP address and test my Java code ….


Monday 21 August 2017

Gosh and Darn it - Kubernetes, kubectl, macOS and IBM Bluemix

So I'm continuing my Voyage O' Discovery with IBM Containers, Bluemix, Kubernetes etc. on my Mac, following tutorials such as this: -


and have got to the part where one sets up kubectl using an environment variable $KUBECONFIG.

Whilst I can "see" my Kubernetes cluster: -

bx cs clusters

OK
Name                ID                                 State    Created                    Workers   Datacenter   
DaveHayK8SCluster   fff102198c534d0096bacd575488c9dd   normal   2017-08-21T09:59:53+0000   1         par01   


the Kubernetes kubectl tool was barfing: -

kubectl version  —short

Client Version: v1.6.4
The connection to the server localhost:8080 was refused - did you specify the right host or port?


I checked the environment variable: -

echo $KUBECONFIG

/Users/davidhay/.bluemix/plugins/container-service/clusters/DaveHayK8SCluster/kube-config-prod-dal10-DaveHayK8SCluster.yml

and then checked the file-system to which it was relating: -

ls /Users/davidhay/.bluemix/plugins/container-service/clusters/

DaveHay

ls /Users/davidhay/.bluemix/plugins/container-service/clusters/DaveHay

ca-prod-dal10-DaveHay.pem kube-config-prod-dal10-DaveHay.yml

so that kinda explains why things weren't a-workin' 

Obviously I had mis-read the instructions which have you do this: -

bx cs cluster-config DaveHayK8SCluster

OK
The configuration for DaveHayK8SCluster was downloaded successfully. Export environment variables to start using Kubernetes.

export KUBECONFIG=/Users/davidhay/.bluemix/plugins/container-service/clusters/DaveHayK8SCluster/kube-config-par01-DaveHayK8SCluster.yml

Following that advice, I did this: -

export KUBECONFIG=/Users/davidhay/.bluemix/plugins/container-service/clusters/DaveHayK8SCluster/kube-config-par01-DaveHayK8SCluster.yml

and, quelle surprise, things started working: -

kubectl version  —short

Client Version: v1.6.4
Server Version: v1.5.6-4+abe34653415733

kubectl cluster-info

Kubernetes master is running at https://158.175.65.170:25305
Heapster is running at https://158.175.65.170:25305/api/v1/proxy/namespaces/kube-system/services/heapster
KubeDNS is running at https://158.175.65.170:25305/api/v1/proxy/namespaces/kube-system/services/kube-dns
kubernetes-dashboard is running at https://158.175.65.170:25305/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.


Can you say "Doofus" ? I betcha can !

IBM Bluemix, Cloud Foundry and IBM Containers - fatal error: unexpected signal during runtime execution

Whilst tinkering with IBM Bluemix, using the underlying Cloud Foundry (CF) and IBM Containers (IC) capabilities, I was looking to update the IC plugin: -

cf ic update

You are using version 0.8.934 of the IBM Containers plug-in.
Version 0.8.1028 of the plug-in is available for you to install.
Run the "cf ic update" command to update your plug-in to the current version.
You can review the documentation to see the changes that are included in the new version.
https://www.ng.bluemix.net/docs/containers/container_cli_reference_cfic_versions.html

To update the IBM Containers plug-in, run the following commands:

cf uninstall-plugin IBM-Containers
cf install-plugin https://static-ice.ng.bluemix.net/ibm-containers-mac


cf uninstall-plugin IBM-Containers

Uninstalling plugin IBM-Containers...
OK
Plugin IBM-Containers successfully uninstalled.



which sadly carped out with: -

fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0xb01dfacedebac1e pc=0xfb2b]

runtime stack:
runtime.throw(0xafe400, 0x2a)
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/panic.go:547 +0x90
runtime.sigpanic()
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/sigpanic_unix.go:12 +0x5a
runtime.unlock(0xf80220)
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/lock_sema.go:107 +0x14b
runtime.(*mheap).alloc_m(0xf80220, 0x40, 0xffffff0100000000, 0x3140c38)
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/mheap.go:492 +0x314
runtime.(*mheap).alloc.func1()
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/mheap.go:502 +0x41
runtime.systemstack(0x700006096dc8)
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/asm_amd64.s:307 +0xab
runtime.(*mheap).alloc(0xf80220, 0x40, 0x10100000000, 0x20)
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/mheap.go:503 +0x63
runtime.largeAlloc(0x7fe00, 0xc800000001, 0xc8204b9138)
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/malloc.go:766 +0xb3
runtime.mallocgc.func3()
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/malloc.go:664 +0x33
runtime.systemstack(0xc82001ea00)
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/asm_amd64.s:291 +0x79
runtime.mstart()
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/proc.go:1051

goroutine 1 [running]:
runtime.systemstack_switch()
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/asm_amd64.s:245 fp=0xc8204b8fd0 sp=0xc8204b8fc8
runtime.mallocgc(0x7fe00, 0x77b9c0, 0x1, 0xc82045e120)
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/malloc.go:665 +0x9eb fp=0xc8204b90a8 sp=0xc8204b8fd0
runtime.newarray(0x77b9c0, 0x7fe00, 0xc8204b9148)
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/malloc.go:798 +0xc9 fp=0xc8204b90e8 sp=0xc8204b90a8
runtime.makeslice(0x7635a0, 0x7fe00, 0x7fe00, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/slice.go:32 +0x165 fp=0xc8204b9138 sp=0xc8204b90e8
bytes.makeSlice(0x7fe00, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.6.3/libexec/src/bytes/buffer.go:198 +0x64 fp=0xc8204b9188 sp=0xc8204b9138
bytes.(*Buffer).ReadFrom(0xc820200770, 0x1168340, 0xc8204a62c0, 0x3fe00, 0x0, 0x0)
/usr/local/Cellar/go/1.6.3/libexec/src/bytes/buffer.go:170 +0xd3 fp=0xc8204b9238 sp=0xc8204b9188
io.copyBuffer(0x1168318, 0xc820200770, 0x1168340, 0xc8204a62c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.6.3/libexec/src/io/io.go:374 +0x180 fp=0xc8204b92f8 sp=0xc8204b9238
io.Copy(0x1168318, 0xc820200770, 0x1168340, 0xc8204a62c0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.6.3/libexec/src/io/io.go:350 +0x64 fp=0xc8204b9350 sp=0xc8204b92f8
github.com/cloudfoundry/cli/utils/words.bindataRead(0xf38860, 0x32927, 0x32927, 0xab0200, 0x1a, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/cffadmin/concourse-work-dir/containers/0000118epdt/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/utils/words/words.go:28 +0x3aa fp=0xc8204b9468 sp=0xc8204b9350
github.com/cloudfoundry/cli/utils/words.utilsWordsDictNounsTxtBytes(0x0, 0x0, 0x0, 0x0, 0x0)
/Users/cffadmin/concourse-work-dir/containers/0000118epdt/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/utils/words/words.go:98 +0x71 fp=0xc8204b94c0 sp=0xc8204b9468
github.com/cloudfoundry/cli/utils/words.utilsWordsDictNounsTxt(0x7793c0, 0x0, 0x0)
/Users/cffadmin/concourse-work-dir/containers/0000118epdt/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/utils/words/words.go:102 +0x39 fp=0xc8204b95e0 sp=0xc8204b94c0
github.com/cloudfoundry/cli/utils/words.Asset(0xab0200, 0x1a, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/cffadmin/concourse-work-dir/containers/0000118epdt/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/utils/words/words.go:118 +0x105 fp=0xc8204b96c8 sp=0xc8204b95e0
github.com/cloudfoundry/cli/utils/words/generator.NewWordGenerator(0x0, 0x0)
/Users/cffadmin/concourse-work-dir/containers/0000118epdt/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/utils/words/generator/generator.go:33 +0x8d fp=0xc8204b97e0 sp=0xc8204b96c8
github.com/cloudfoundry/cli/cf/commandregistry.NewDependency(0x1167258, 0xc82002c010, 0x11ade60, 0xc82047eba0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/Users/cffadmin/concourse-work-dir/containers/0000118epdt/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/cf/commandregistry/dependency.go:142 +0x1bed fp=0xc8204bd6c0 sp=0xc8204b97e0
github.com/cloudfoundry/cli/cf/cmd.Main(0x0, 0x0, 0xc8204a1ad0, 0x3, 0x3)
/Users/cffadmin/concourse-work-dir/containers/0000118epdt/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/cf/cmd/cmd.go:76 +0x6fc fp=0xc8204bfee0 sp=0xc8204bd6c0
main.main()
/Users/cffadmin/concourse-work-dir/containers/0000118epdt/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/main.go:11 +0x72 fp=0xc8204bff20 sp=0xc8204bfee0
runtime.main()
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/proc.go:188 +0x2b0 fp=0xc8204bff70 sp=0xc8204bff20
runtime.goexit()
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc8204bff78 sp=0xc8204bff70

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/asm_amd64.s:1998 +0x1

goroutine 5 [syscall]:
os/signal.signal_recv(0x0)
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/sigqueue.go:116 +0x132
os/signal.loop()
/usr/local/Cellar/go/1.6.3/libexec/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
/usr/local/Cellar/go/1.6.3/libexec/src/os/signal/signal_unix.go:28 +0x37

Thankfully common sense prevailed; I wondered if the problem was due to my being logged into Bluemix and IBM Containers, prior to trying the installation.

I'd previously logged into both services: -

cf login —sso
cf ic login

So I logged out: -

cf logout

Logging out…
OK


and redid from start: -

cf install-plugin https://static-ice.ng.bluemix.net/ibm-containers-mac

**Attention: Plugins are binaries written by potentially untrusted authors. Install and use plugins at your own risk.**

Do you want to install the plugin https://static-ice.ng.bluemix.net/ibm-containers-mac? (y or n)> y

Attempting to download binary file from internet address...
10186528 bytes downloaded...
Installing plugin ibm-containers-mac...
OK
Plugin IBM-Containers v0.8.1028 successfully installed.

which is nice :-)

#LoveItWhenAPlanComesTogether


Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...