ReactGo – Steps to add a new data set to the store.

I’m documenting this because I want to make sure I catch everything for the eventual yeoman generator I intend to build….

Using my Material-UI modded version of ReactGo boilerplate (commit d5f71395f8eca8a0d9a1be162bbd20674d7cdcdd, Feb 16, 2017)

In order to support multiple datasets being loaded into one page from the router I’ve modded the current base to suit my needs summary of changes are on my version of the repo.  These changes were based on the work of @k1tzu & @StefanWerW

Right now I’ve got it down to a 12 step process… (whew!) lets get into it…

Continue reading…

motoChecker v3

Well, v3 is done and tested added support for stored validations.

This version has more Dewbacks so you know it’s better!

Git Hub repo is the same as before

Matt suggested I change the name to motoChecker. Since my last name is Motacek. I like it. DONE!

I’ve spent all day on documentation for it and I’m bored with writing now. I’ve learned a few things, though…

Content revised… my hate for SharePoint faded after I asked someone smarter than me to teach me how to use the damn thing.

It’s ok now.

Setting up Secure SSH, X11 Forwarding and VNC on CentOS

I’m more of an Ubuntu fan personally but one of the people I work with wants to use the Red Hat.  So instead of asking our boss for $800 I decided to opt for CentOS, same binaries so I’m hoping it will work.  These instructions will get you started with remote control for your CentOS server.

We’ll configure three type of “remote access” for various use cases.

  1. SSH
  2. X11 Forwarding
  3. VNC

I am not a sysadmin purist so I don’t care about sysadmins who say that servers don’t need GUIs.  This server is for a wide range of users and needs to support varying comfort levels with Linux based systems.

Step 1 – Configuring SSH

After I got CentOS 7 installed I opened up the ssh config. Security is a big concern for this system as the previous Windows installation on the server had been hacked and used maliciously. Since our company doesn’t have any full time sys admins I want to make sure that it’s as secure as possible.

sudo nano /etc/ssh/ssh_config

I first wanted to check to ensure that it didn’t allow ssh with a password. It was enabled by default so I turned it off for security reasons. I also wanted to setup X11 for remote access since I’d be administrating this thing from Wisconsin when the server will be in St. Louis. Doing things like limiting users, changing the standard ssh port and using Public/Private Key Authentication all harden the system.

PasswordAuthentication no
X11Forwarding yes
X11DisplayOffset 10
AllowUsers myself myCoworker
Port 22XXXX

Since we’ve changed the port make sure ot make an entry in the Firewall rules in the permanent section. for the port you’ve specified.

GNOME has a Firewall Configuration in Applications > Sundry > Firewall

We’ll need to restart the sshd service as well as update SELinux (not sure why yet…)

sudo service sshd restart
sudo semanage port -a -t ssh_port_t -p tcp 22XXXX

Now that my ssh_config is ready I’ll need to generate some security keys so that we can ssh to it.

For X11 and SSH on Windows I prefer to use MobaXterm.  On the client you wish to connect form we need to generate some RSA keys.

Open up MobaXterm go to Tools > SSH Key Generator

Generate a new key pair for yourself and save the keys.  I always recommend copying the raw public key into a text file so you can paste the contents if necessary.  OpenSSH will complain if the format of the key isn’t what it likes.

Put the key on a jump drive and pop it in the server.  Then do some concatenation to the key file.

cd /the_location/of_the/jump_drive/
mkdir ~/.ssh
chmod 700 ~/.ssh
cat public_key.txt >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
restorecon -Rv ~/.ssh

Make sure you delete the key file after you’ve concatenated it.

Now we test our SSH connection form the client.  Open up MobaXterm and create a new SSH connection.  Specify the IP of the server, the user name you’ve allowed in the SSH config, the port you specified in the SSH config and use the private key you generated in the Advanced SSH setting tab.  Leave the X11 forwarding and compression enabled.  If you’re having trouble connecting try checking if your router is blocking the port you specified or and additional firewall.

Step 2 – X11 Forwarding – Running Applications Remotely

For those more familiar with Windows X11 Forwarding is similar to the concept of Remote Desktop but a little different.  With X11 you can not only run the desktop application “GNOME” but applications individually if you choose.  So if you have an installer you want to run you can simple execute the installer application with out the burden of running a “Desktop” over the connection.

Once you’ve successfully connected via SSH it time to configure X11

First make sure your OS is up to date… this could take a while… If your OS isn’t updated you might have some conflict trying to install “X Windows System”

su root
yum update
yum groupinstall "X Window System" "Desktop" "Fonts"

Once your OS is up to date and you have X Windows System installed you should be able to run things like “gedit” from ModaXterm and use the application remotely by simply typing in the name of the application.

X11 can be a bit slow if you plan to use the desktop a lot like a windows admin would so nex tup we’ll setup VNC

Step 3. VNC

X below represents your desired port number it will be an offset from 5900 which will result in 590X.

su root
yum install tigervnc-server xorg-x11-fonts-Type1
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:XXXX.service
nano /etc/systemd/system/vncserver@:X.service

Replace all instances of <USER> with the user name for the connection, there will be two.

Update the firewall to allow the connection in a similar way as earlier.

Start the server as the user…

vncserver

Set a password.

Now Reload the deamon as root, start the service and set it to run on startup.

su root
systemctl daemon-reload
systemctl start vncserver@:X.service
systemctl enable vncserver@:X.service

Go to your client and download a VNC client if you don’t already have one.

Now before you go connecting to your server note:
THIS VNC CONNECTION IS NOT ENCRYPTED

So let’s set that up 😉

Open up MobaXterm and click “Tunneling”

  • Create a new tunnel.
  • Local port forwarding
  • Local Port  = 5900
  • SSH Server = Server IP, username, and SSH port set above
  • Remote Server = Server IP and Port assigned to VNC user. (the 590X one…)

Now start your tunnel.  Then open up VNC Viewer and use localhost:5900 as your destination.

VNC will complain that this is an “unencrypted” connection but its not 😉

You are now ready to rock an roll!

MotoValidation 2.0

V2.1 is out!

It’s been a while since I’ve posted something on my blog but it’s also been a while since I was working on something that I felt worth sharing.

I’m proud to present motoValidation v2 a big improvement to my original creation.  The goal of this script is to limit the amount of code that a developer must write in order to accomplish common validation use cases in IBM BPM platform.  This script is currently targeted for Heritage coaches only… I’m not sure if I like client side coaches yet… I’m sure they’ll grow on me but they need some serious stuff before I’ll consider them usable.

With motoValidation we make some assumptions:

  • The most common type of validation is a required field
  • The target for your validation is the same as the binding
  • We should not make developers provide redundant information over and over (if I have to type tw.whatever.thing.thing.thing one more time I’m gonna snap…)
  • Validation should require as little code as possible

Get it from Git

Continue reading…

Discoverable JSON based RESTful Services (DJRS)

For any developer who has ever worked with SOAP you know about WSDLs. These standardized files could provide information to an application or and IDE which the developer could then use to easily select an action to do. In the era of declining SOAP usage and the rise of the RESTful APIs it’s time to start thinking about how to make REST even easier to consume than it already is. Easier than easy… yes, easy peasie lemon squeezy.

I won’t lie my first experience with SOAP was a nightmare and even worse I was doing it with PHP and a toolkit that was clearly developed by someone who didn’t want anyone to use php to use their service. So my first experiences were bitter to say the least. But as I worked on other project I foudn other developers using other platforms/frameworks (like .NET) who spoke highly of their experience with SOAP. So that made me ask the question, “What was I missing out on?” The truth was a lot actually. When I saw how easy it was to consume a SOAP service in .NET it seemed to good to be true. But with SOAPs decline in favor of RESTful services the shift went back to something I was ultimately more comfortable with given my experience with SOAP.

So now to the meat and potatoes. What we needs is a good tool that make creating an API easy. BUT WAIT JOE MY COMPANY ALREADY PURCHASED AN ESB AND I HAVE TO USE IT. Well that sucks for you because the big thing that most ESBs I’ve used fail on is providing clear documentation on how to use the service and if it’s JSON based there’s no file generated for a developer IDE to consume. And that’s what we need, an application that allows developers to connect to any data store, provides an easy and intuitive method on configure what should be exposed, what should be auto set, what needs to be validated as well as set up authentication for you and auto-generate documentation and a consumable description of the service that an IDE can use to make connecting to the API easy. We need Deejers (DJRS).

Swagger has already done most of the hard work for this and I think we just need to take it to the next level.

So that’s the goal and I’m starting to build it now and since I’m currently obsessed with Meteor I’m going to use it to build it. Check if anyone has done that yet… NOPE.

Goals:

  • Self Documenting (Swagger)
  • Built in analytics tools
  • User Access Management
  • Easy to Understand UI (For API management)
  • Auto Generated SDKs for languages (Swagger format has consumable client libraries for most languages)
  • Back-end should connect directly to Data-store
    • Should support major data store formats
  • Deployment on on Cloud Foundry will be easy
  • Caching – with query time cache conditions and customization cache times for each end point
  • Support major security formats (Basic, OAuth, JWT ect…)
  • Availability to increase number of running nodes to scale up in high demand situations
  • User can configure the application for any table available:
    • Auto Generate field on condition
    • Designate Required Fields
    • Data Type
    • Schema (Global and per table)

Steps:

  1. Build app that connects and has CRUD access to most common DB formats
  2. Auto-generate basic yaml based on connected datastores
  3. Provide swagger-like endpoint manager to define options
  4. Generate YAML or standard Swagger Config file for Service
  5. … more… but let’s start with that.

JSON Object for 196 Countries with 2 Character Country Code in Name Value Format

I just got done with this… IT TOOK FOREVER! Save your self the pain and copy if you need it.

196 Countries in Country Name and ISO “-2 Code Country Code format. The JSON object is in name value pair format for easy consumption.

Please leave a comment is I misspelled something or if I need to add another country!

Did all the counties from here: http://www.nationsonline.org/oneworld/country_code_list.htm that weren’t in italics.

Continue reading…

MSNR Step 2 – Getting Ready for Development

This isn’t really a step in the MSNR process but more notes for myself in the future so when I build another server I know what to do and not have to do everything over again from scratch.

Well your not gonna stand in front of your server all day while you code are you?  Well I’m not (not that dedicated).  Today I want to cover the basics of getting openSSH installed, configured and connecting to your files over SFTP.

I’m on windows so it was actually a bit of an ordeal the first time.

  1. If you don’t have it go download Putty.
  2. Next, generate an SSH Key:
    • Open the PuTTYgen program.
    • For Type of key to generate, select SSH-2 RSA.
    • Click the Generate button.
    • Move your mouse in the area below the progress bar. When the progress bar is full, PuTTYgen generates your key pair.
    • Type a passphrase in the Key passphrase field.
    • Type the same passphrase in the Confirm passphrase field. You can use a key without a passphrase, but this is not recommended.
    • Save your private key.
    • Select your public key and paste it into a new text file
      • You can use the saved one on openSSH Putty will format it wrong
  3. Now that you got your keys comes the fun part get the public key on your server.
    • Copy your text file with the pasted key on to a jump drive.
    • Plug that into your server
    • Once you plug it in you’ll notice that Ubuntu recognized it and probably set it to something like [sda]
    • Now for the commands
//Mount your USB drive
sudo mkdir /media/usb
sudo mount /dev/sda1 /media/usb
//Yours might just be /dev/sda

//Create your authorized keys file
cd ~
//If your not already there
sudo mkdir .ssh
sudo chmod 700 .ssh
cd .ssh
sudo touch authorized_keys
sudo chmod 600 authorized_keys

//Now we'll add your key (from the file on your jump drive) to our authorized_keys file
sudo cat /media/usb/mypublickey.txt >> authorized_keys

//Now unmount your jump drive
sudo umount /meida/usb

//Remvoe your jump drive & restart SSH
sudo restart ssh

Now you should be able to create your connection to your server.  Open up Putty type in the IP of your server then go to the Connection >> SSH >> Auth and put the location of your Private key that you saved earlier in the “Private key file for authentication:” field.

There you are SSH done.  Finally to connect to your folder via SFTP (I use Filezilla).  First load your private key file into Filezilla and open up Edit >> Settings.  Now go to the SFTP section and add your private key file again.  If you used a passphrase you’ll have to enter it in and save another version of your keyfile with out a passphrase.  Add the keyfile and create your new connection.  Use your username and the IP and you should be good to go.

Happy coding.

The MSNR Stack Step 1

I’ve been letting the idea for the MSNR stack ruminate in my mind for a while now and it was finally time to pull the trigger.  There are an endless array of node frameworks sprouting up but at the end of the day I think its important to do what your comfortable with and for me that’s MVC and SPAs that don’t step it your MVC aka the MSNR stack.

Today I took a very important step toward that goal by setting up my first very own server!  Well it’s not the first time I’ve set up a server or anything but it’s the first time I’ve done it outside of a VM!  I purchased an old HP G5 DL380 recently and decided it was high time to get it up and running.

The first thing I did was mount the sucker:

Then I wired it up, got it some juice (power) and some food (internet) switched it on and it was like the jet of my dreams taking off in my basement.  (The fans are really loud on start up…)

After that I installed Ubuntu 12 LTS since it was certified for my hardware.  Once the install was done it was time to get node installed.  I used a package available here from joyent with great success.

Then I had to make sure it would actually show something if I navigated to it.  By default node does not serve anything like nginx or lamp.  You need to create an application in order for something to display enter the Hello World app:

I’m a fan of nano so I did :

nano ~/hello_world.js

Then I got to work writing my first app (which I stole from the node site).

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(80);

Once it was all ready I did my CTRL+X  Y and Enter to save my file.  Then finally it was time to test!

sudo node ~/hello_world.js

At this point if you did everything right all you should see is a flashing underscore.  You’ll need to use sudo if you are using port 80 like I am.

Finally I wanted to see my master piece in action so I logged on to my domain registrar, created a new subdomain, went to the Advanced DNS editor and redirected the sub-domain to my IP address.  Once that was setteled I went into my At&T 2WIRE router and went into my firewall, selected my server and set it to accept traffic on port 80 (by clicking the Server link and the Web Server selection).

TLDR for all those who skip to the bottom (like myself).

  1. Get a server
  2. Install Ubuntu
  3. Install Node
  4. Create a Node App
  5. Point a Domain to your IP Address
  6. Ensure your Router/Firewall are ready for the traffic.

DONE

http://dev.motoandmustache.com/

Not too bad for an evenings work.

Visibility in Lists with a Simple Script

For those occasions where you find yourself creating complex objects that are lists where you need control visibility here is a simple script that will save you a lot of headache.

I came across this needing while working with a list of locations on a project.  The objects were to complex for a table and needed to be dynamic enough to allow end users to easily add additional locations.  What I did was create a Section and bind it to my location list.  Then I proceed to put my various sub fields and sub-objects into that section.  Then at the bottom I put a couple of buttons that fired boundary events to add and delete items to my list.  Simple right?

repeater

Continue reading…