Thursday, 2 November 2017

Mule ESB content routing example running on Mule Runtime in no time

Mule ESB content routing example running on Mule Runtime in no time


This is a quick overview on running a Mule app - the content routing example -  on the MuleSoft Mule ESB Runtime locally on an Ubuntu Linux machine.

I really wanted to see how difficult it was to get the runtime going and had little in the way of challenges. I would need to do some more tutorials on the backend flows and other more advanced examples before I put up another demo but wanted to see how much effort it took to get going.

Running Anypoint Studio and the Mule Runtime

On Ubuntu, the studio runs pretty good, Eclipse appears to be the base and the UI is as rich as expected.

I quickly crafted together the content routing, and getting it to run is also easy.



Downloading Mule Runtime 3.8 was easy, and I extracted and ran it locally without any additional configuration:
./mule

I couldn't find the built archive initially, but tracked it down from the logs. Once Mule started up, I went and copied the content routing archive to the /apps folder, and it exploded successfully:

[Mule.app.deployer.monitor.1.thread.1] org.mule.module.launcher.application.DefaultMuleApplication:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ New app 'mule-contentrouting'                            +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

In my browser I browsed  to http://127.0.1.1/?language=French and got the demo response.

I'll run through some more tuts and post awesome bits here, as I am keen to see how tough integration challenges I've seen can be simplified with this tooling

Cheers
Quintes



Connect with me on LinkedIn or Twitter

Monday, 15 May 2017

Azure IoT Hub connect error from node cannot read property 'write' of null

Azure IoT Hub connect error from node app - cannot read property 'write' of null in amqp libs


Quickly setting up an Azure IoT hub this evening and wiring up some node services to play with, and read the device-to-cloud messages had me stumped as I would get this error intermittently

  stream.write(buffer, callback);
        ^
TypeError: Cannot read property 'write' of null

Turns out it may be the connection string I was using

Connection String causing timeouts  


So I was defaulting to this format

HostName=somewhere.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=<yours>

This would cause the error above intermittently, and I wanted to resolve it.

Turns out you can use another connection string format:

Endpoint=sb://yourshere.servicebus.windows.net/;SharedAccessKeyName=iothubowner;SharedAccessKey=;yours;EntityPath=yourEntityPath;

To find these values, go into Azure, go to your IoT hub, Messaging, Endpoints and click on the Events endpoint below:


A properties window will appear.

The Event Hub-compatible name goes in the yourEntityPath value.

The Event Hub-compatible endpoint is where you would enter the Endpoint.

I found the problem and resolution here. I haven't encountered the error "Cannot read property 'write' of null" again.

IoT is way more fun than the old days when I used to send frames down the serial port, using c++, or getting values from a PLC or a weigh bridge. Probably even more fun than the Win SC API. But working with those devices is always good fun.

Cheers
Quintes

Connect with me on LinkedIn or Twitter

Thursday, 27 April 2017

Xubuntu 14.04 Samba setup for access by ubuntu and windows clients

Xubuntu 14.04 Samba setup for access by ubuntu and windows clients


Setting up a samba server locally was done as follows on ubuntu 14.04. On the server I had some errors with missing dependencies and had to perform some purges on samba packages to resolve them.

Reading this, this and this  helped.

Samba Server setup  


On the samba server, run the following:
sudo apt-get install samba samba-common system-config-samba gksu
I received errors that certain samba package dependencies could not be met, and searching for a fix led me to do this:

sudo apt-get clean
sudo apt-get autoremove
sudo apt-get update
sudo apt-get upgrade
sudo apt-get purge samba-common
sudo apt-get purge samba-libs
On xubuntu, could not find the samba config GUI from the menu, turns out I had to run it like this:

gksu system-config-samba

At this point in time I configured the share and user. 

Samba Client (linux)


On the first client, an ubuntu machine, I ran the following to get configured

sudo apt-get install samba cifs-utils

Create a credentials file so that the user and password is not littered everywhere

sudo nano /etc/samba/user
Add these:
username=samba_user
password=samba_user_password 

Set permissions to ro:

sudo chmod 0400 /etc/samba/user
Then edit /etc/fstab, add this entry as a new line to mount on boot:

sudo cp /etc/fstab /etc/fstab.bak1
sudo /etc/fstab

Add this line:

//samba-server/share  /media/share  cifs  credentials=/etc/samba/user,noexec  0 0
Either reboot or mount and you should be in:
sudo mount /media/share/

Samba Client (Windows)


Easy really, just open explorer and go to the network share \\samba-server\share\, enter the samba user and password and you're in.

@quintes

Sunday, 2 April 2017

finding the docker mount volume location - running jenkins in a container

Finding the Docker mount volume location, running Jenkins in a container


I love running jenkins in a container, no installation locally, and it really is awesome to just spin up a docker container image and run a build process.

I had setup a jenkins container around 5 months ago running on docker and forgot the password and the path to the mounted volume. Here's how you go about getting the volume so you can reset the password

Locate the volume  


I configured my jenkins to use a mounted volume, and had no idea where it was. This is a lazy manner of getting the path - it will be under the mount section:

docker inspect my-jenkins | grep "Source"
Update: this is the proper way to get the mount source:
docker inspect --format='{{range .Mounts}}{{ .Source}}{{end}}'

and locate the folder locally, mine was at
/var/lib/docker/volumes/e6bc1cd088645a4f5b7f69c0ba00951b159b0ccf552cf02bd31c85d64cb35626/_data

Now that I have the mount path I can change the security attribute to false, log in and configure the security again, but at least I am back in.



Docker makes playing with software in images simple; in this way even though I have java installed locally I don't need to spin up and keep jenkins running all the time, just when I want to spin it up.

Cheers
Quintes

Connect with me on LinkedIn or Twitter






Wednesday, 29 March 2017

Getting started with container technologies

Getting started with container technologies


Containers and the tooling around it is currently grabbing the attention of many people; developers can containerize a whole application and deliver it to run without needing to install anything on the host. Ops don't have to set anything up (on the hosting server that is, so no application installs) and management will love the promises of easier deployment, faster delivery and more agile release management techniques.

Tooling  


Everyone has heard of Docker, the most well known container runtime, but there are numerous methods of managing, running and orchestrating containers. I'll be looking at them in depth and providing notes as part of blog entries as part of my learning, and hopefully they provide some use to you.

The options for running containers are
1. Docker
2. Containerd,
3. runc, and
4. rkt

Docker was easy to pick up - I've been playing with it since the last quarter 2016 - though I am sure production implementations would need more time and administrative effort around availability and discovery.  I've been wanting to spend time around rkt and will write up any useful notes as I go.

Running containers, either in docker images or App Container Images can be run and orchestrated in clustered environments using a number of technologies better suited to operation and deployment. I will try to introduce those as part of this blog series as well.

Cheers
Quintes

Connect with me on LinkedIn or Twitter


Saturday, 14 January 2017

Xubuntu 14.04.x Hardware Enablement Stack (HWE) EOL and disappearing mouse cursor

Xubuntu 14.04.x Hardware Enablement Stack (HWE) EOL and disappearing mouse cursor


It may surprise many people but I run Linux at home. I actually ran CentOS for a number of years as a desktop / server and then moved to Xubuntu around 2009, and have 2 laptops running it in various versions and flavours since. Let me start this by saying I heart xubuntu.

Around a month and a half ago I received a popup in Xubuntu 14.04 stating that my HWE stack was going to stop receiving updates for the kernel and graphics stack. A wiki article stated it should be fine to update to the xenial stack. Sounds critical and I responded with enough due diligence to believe my primary home laptop would upgrade fine.. in the process my intel video drivers got groggy and would cause the mouse cursor to disappear whenever (every time) I returned from sleep / a locked screen.

Pre-HWE EOL  


I've been running Xubuntu 14.04 x64 as a my primary machine for a long while. Developer tools, docker, java, lamp, virtual boxes etc. Intel video. Nothing fancy.
  
I upgraded after reading through the mentioned article and getting the warnings as expected

 sudo lsb_release -d
 hwe-support-status --show-replacements
 hwe-support-status --show-all-unsupported

I was running the relevant kernel, followed the steps to upgrade, not reinstall from scratch. My machine kept going but noticed that my cursor would disappear when unlocking from the light locker. I was kinda busy and didn't want to fix so found the common fix which is change from vt1 to vt7. 

I wish I'd taken more notes, but appears that I was bumped from a 3.13 to a 4.2 Kernel. I think I was somewhere refered to this and installed everything as per the 14.04 Desktop step. 

Now what's worse is that I had taken the other machine last week and performed a fresh install of Xubuntu 14.04.5 on it and this happens. New install or upgrade, same issue. In that instance I went and re-installed Xubuntu 14.04.1 and my cursor comes back as I'd expect so it's a new bug.

Getting my cursor back


Today I traced through a couple of articles and bug trackers and found that I was not alone. Note that this is still happening in xubuntu 16.04 which mentions the following under known issues on the release notes page, as at this date - "When returning from lock, the cursor disappears on the desktop, you can bring the cursor back with Ctrl+Alt+F1 followed by Ctrl+Alt+F7"

Now I want my wife to use my laptop for a specific purpose under a standard desktop users - can you image that discussion with someone who doesn't use linux or worse is not used to 30 keyboard shortcuts after a login. A poor, annoying workaround kept me going but not suitable.

Where else is this happening? 

Here. Every other workaround there is great, if you don't have to explain it.

Note I'd tried restarting lightdm, it kills your workspace and not suitable. Installing gdm? I gave that a spin earlier, do not do it. It killed my notifications bar, panel shortcuts etc. 
I quickly uninstalled gdm and purged/reinstalled light-locker. 

  sudo apt-get remove gdm
  sudo apt-get remove light-locker
  sudo apt-get purge light-locker
  sudo apt-get install light-locker

Man is it pretty in comparison. My Indicator plugins and panels loaded properly as I hoped too.

Ubuntu Bug Ticket - same workarounds mentioned and I noted that it was fixed in xserver-xorg-video-intel in Xenial. 

So I thought I'd just upgrade that since I'd installed the Xenial packages as per the HWE EOL wiki. 

sudo apt-get install xserver-xorg-video*

When I tried I saw that some dependencies would not be met. So I tried to reinstall all of it 

sudo apt-get install --install-recommends linux-generic-lts-xenial xserver-xorg-core-lts-xenial xserver-xorg-lts-xenial xserver-xorg-video-all-lts-xenial xserver-xorg-input-all-lts-xenial libwayland-egl1-mesa-lts-xenial 

I shouldn't have done this, because I got a new 4.4.0.59 kernel and then my /boot proceed to run out of space - fixed that and retried. All appeared OK and I tried to lock and unlock - cursor continued to disappear.

I then decided to reboot and try after that. Kernel panic ensued and thankfully my 3.13 kernel was still available. So I booted with the 3.13 kernel, and by then was pretty mad. I forced trusty back

sudo apt-get install --install-recommends linux-generic-lts-trusty xserver-xorg-core-lts-trusty xserver-xorg-lts-trusty xserver-xorg-video-all-lts-trusty xserver-xorg-input-all-lts-trusty libwayland-egl1-mesa-lts-trusty
sudo dpkg-reconfigure linux-generic-lts-trusty
 After that I changed my grub config to use the old 3.13 kernel as default and had to hack the defaults to not use the 4.4 Kernel

sudo nano /etc/default/grub
GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 3.13.0-107-generic"
sudo update-grub
Rebooted, logged in and out and surprise - my mouse cursor is back.

Of course checking the HWE I seem to be covered but I'm sure I've broken something, and an apt-get update later will probably bring some pain.

hwe-support-status --verbose
Your Hardware Enablement Stack (HWE) is supported until April 2019.

This issue actually shouldn't be happening, in my opinion those release notes and ticket should be resolved by now. The lesson here is always test upgrades somewhere else before you play on your primary machine.

@quintes