Thursday, September 07, 2017

Serverless Local build in Docker - Part 1

I wanted to set up a serverless-local build for using on a friends project. This will allow a certain amount of localised testing before pushing changes to the AWS Lambda service.
I decided to build a Centos VM and then added docker this allowed for a lot of portability.
Here are the steps I took

First, build the centos VM that is pretty straightforward for most and there are lots of good guides around. I use Virtual Box from Oracle as my VM service of choice.

Next installed Docker, just follow along here and you shouldn't have much trouble installing docker and getting a centos container running
Install Docker
yum install docker
Don't forget to test it with
docker run hello-world

I then used this container config to install a centos container with node already installed
https://github.com/lloydbenson/docker-centos-7-node This is a lot easier than building the entire node and npm install within a bare container. That can be another post when I get that one up

Once this is up then you can use the page here  to install serverless-local into your project and allow you to do a lot of local testing https://blog.gorillastack.com/serverless-framework-local-development-environments/

Saturday, July 01, 2017

SQL Server Linux - a quick look

After a few changes, I now have a SQL Server Linux installation running in a totally Linux environment.

Whilst there is still a dearth of tools for Linux-based SQL server it is very doable and manageable.
I have two choices of tools which I found to mostly be useful for managing SQL Server with no Windows present. It is going to be some time before we see if ever Management Studio on Linux so you are going to have to keep reviewing alternative tools with which to manage Linux with

The first is Microsoft official
sqlcmd

There are good instructions for all main distros to help you install sqlcmd and add the directory of the command files to your path.

Firstly install .Net Core to your Linux installation https://www.microsoft.com/net/core#linuxubuntu for the Ubuntu installation.

Next, install Microsoft Tools mssql-tools https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools#ubuntu.

once this is installed and right now if you are running 17.04 Ubuntu you will need to review the bug page for tools and install Preview versions as there are compatibility bugs which appear ironed out in those releases.


To access the data from some sort of GUI you might like Visual Studio Code as an editor which can interact with the SQL Server Database. You need to install the mssql extension.


The alternative I am using is DBDeaver http://dbeaver.jkiss.org/
It is based on Eclipse and seems rock solid as a database management tool. Now of course without all the proprietary bits of Management Studio your database T-SQL skills are going to have to raise a notch. You will need to grab the latest JDBC drivers from Microsoft https://docs.microsoft.com/en-us/sql/connect/jdbc/microsoft-jdbc-driver-for-sql-server


Now one final thing with VS Code is that it hasn't quite worked out Linux. Microsoft there is no C: lettering in file paths and the slashes in the path names need correcting, but I guess we can live with that for now.

DBBeaver file paths
VS Code file paths
 Overall it is great to see SQL Server advancing on Linux and I can see a lot of places using SQL Server Development Edition on Linux to eliminate a bundle of cost from their no production environments. It is a great step forward and look to the future when it goes full GA


See ya round

Peter

Thursday, June 22, 2017

Virtual box and Dell XPS 15


Just acquired a Dell XPS 15 through a new job. I have been setting up a few Windows and Linux Servers as VM's using Virtualbox.

There is a real problem with resolution when initially installing just about any guest OS. It makes it firstly hard to install and secondly difficult to work with.
Enter the world of Scaling VM displays. This is a fantastic help however it comes with its own problems.

A problem with scaling is the menu for the running  VM you have focused on goes missing by default, therefore, you can't do things like installing guest additions whilst in that mode.

Friday, January 20, 2017

VirtualBox on Ubuntu 16.04 DNS Failure From Guest OS

I have a couple of VM's on my system running a variety of operating systems for testing and learning. Recently U upgraded the host system to Ubuntu 16.0.4 when I installed a new SSD. I moved the VMs from the old spinny disk and VM's start fine.
Yay! I can log into the VMs but realise there is a problem with DNS. I can ping outside hosts and all seems fine with the network. Started changing network settings in one of the guest OS and no, nothing is happening

After some investigation, this appears to be due to a change in how Ubuntu is doing DNS and that the Guest OS are unable to handle that natively.

The cure
Enable two parameters as the user you run your VM's under

VBoxManage modifyvm "Centos 7" --natdnsproxy1 on
VBoxManage modifyvm "Centos 7" --natdnshostresolver1 on
VBoxManage -natnetwork list
NAT Networks:

Name:        NatNetwork
Network:     10.0.2.0/24
Gateway:     10.0.2.1
IPv6:        No
Enabled:     Yes

Make sure all VM are stopped and then  run this, it willl crash VirtualBox but makes sure next time you start VirtualBox the new network settings will apply

VBoxManage natnetwork stop --netname "NatNetwork"


Sunday, January 08, 2017

Python 2.7 Installation and SSL errors

Working to get some python code finished and ran into an issue with seems to have plagued python for somne time.

When building python as you would often do to be able to use later versions in Redhat, as you cannot update the original Python as it breaks yum and many other Redhat tools you need to look at doing local installs. For the little bit of space and then using virtualenv, this is probably for many things a better option.

When installing Python 2.7.13 from source on Redhat it doesn't install the SSL modules. Ha, I don't need SSL, I am not connecting to any SSL. Sorry to tell you the bad new but pip now connects to https to access the repository, really it has for some time.

What does one do to resolve this?
What needs to be done is make sure the SSL development libraries are there as their absence leaves you without SSL which you need for pip. Of course, that means you cannot install packages directly fro the python repository. Agggghhh

Firstly you download and prepare to install python as local install, lots of good instructions out there.

Next, you make sure the zlib1g is installed as well as openssl-develop packages. Unless it's a very minimal installation, it should have the OpenSSL  runtime stuff there already.

Untar the python and cd into the unpacked source code
Go to Module and open the Setup file and if it's not there run configure and make and it is generated.
Now as per this StackOverflow question. You need to uncomment some SSL text

SSL=/usr/local/ssl
_ssl _ssl.c \
    -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
    -L$(SSL)/lib -lssl -lcrypto



Now make and make altinstall to where your local installation is

The path to verify SSL has changed in 2.7.13, possibly earlier editions as well

python /usr/local/lib/python2./test/test_ssl.py

This might become helpful to someone down the track as it seems a ridiculous issue to still be a problem for this long.

See ya round

Peter

Thursday, January 05, 2017

Some thoughts on the MongoDB Ransom Attack

As reported on a number of news sites there are a lot of unsecured Mongo DB servers out on the Web. This has created a new business opportunity whereby an ingenious hacker has found a business model. Backup your MongoDB, trash its contents and then leave a note for Ransomware to get the data back. I expect this is going to make a handsome earning.

Why you might ask? The databases have almost certainly in many cases been set up but unskilled people, I will take a stab at it and say probably not the most competent DBA or not even a DBA. My reasoning is that there are two things that stick out any decent DBA will have looked at two key tasks of the DBA, backups and security. Any DBA worth his daily pay would have both of these high in mind. He would have questioned how the data is accessed, the connections from any website and understood the architecture of the applications connecting to the databases being managed. The DBA would have constantly looked at how to lower the attack surface and had reliably tested backups reducing the concerns of any attempt to ransomware.

So if you don't have a DBA and you are running databases, I would suggest this is a warning to you to get either a service or hire one to make sure you don't have the opportunity to explain to your board to shareholders



See ya round

Peter

Saturday, December 31, 2016

2017 is rolling in

Its New Years Eve and I would like to thank those of you who have been part of my 2016 audience and will be bringing more in 2017.

Enjoy your New Years Eve, have a great celebration wherever you are in the world
Look forward to a great 2017 and that is prosperous and happy





See ya round

Peter