Docker - A New Way To Think Virtual But Not Be Virtual

At times you get the pleasure of working with some cutting edge technology that gives you the "wow that's pretty slick" feeling.  Other times it can be a rocky unstable mess.  Docker is one such technology that has not been the later.  The concept is simple, run this self contained little unit on bare metal as if it were a virtual machine.  The analogy many liken this too is a shipping yard with lots of containers.  The containers are the self contained packages and since all containers have the same shape the can be stacked and treated the same even though each container's internals can vary greatly.  Hence, one of the reasons Docker calls these units containers.

I've had success setting this up on Windows and a Mac, both of which use a tool called boot2docker.  Since Docker only runs on Linux systems, both Windows and Mac need to use Virtual Box to spin up a Linux machine that can host Docker.  For Windows check out https://docs.docker.com/installation/windows/ and for Mac see https://docs.docker.com/installation/mac/.  I had a little trouble at first on Windows, which required deleting the VM on disk then re-initializing docker.  After they are up and running, it's a breeze getting a container started, just type "docker run container name".  It's that simple.  Of course, if you want your container to expose ports and do other things there's a little more to it, but if you want to test out Linux based products, this is a very slick way to do it.  To see a list of docker supported containers go to https://registry.hub.docker.com/Pluralsight also has some good modules on how to use docker.

Atlasian SourceTree : A Great Git Visual Tool

Git is source control system that has risen to new heights.  Even Team Foundation Server no exposes Git.  Many use the Git command line operations but I always prefer the visual tools for day to day work.  Atlasian, produces of Jira, Confluence, Stash, Bamboo, have a tool call SourceTree which is a excellent tool for managing Git.  You can download it for Windows or Mac here http://www.sourcetreeapp.com/.

Install Mongo On Windows As a Service

Mongo is a common NoSql database that is flexible and easy to use.  It’s ability to scale and shard across many nodes makes it a great option for load balancing and scaling an application domain that fits a NoSql type schema.

1.  Download the latest version of Mongo that fits your platform (i.e. x86, x64).  Run the installer and place the application files in C:\Tools\MongoDB…  Follow my environment variable setup post for certain development folders.

2. Create an environment variable MONGO_HOME to point to the root of the mongo application directory.  If you followed my post on environment variable setup this would be %TOOLS_HOME%\MongoDB…  Add %MONGO_HOME%\bin to the Path environment variable.

3.  Create a directory to store the mongo data.  The simple approach is to create the directory C:\data\db.  This is Mongo’s default but can be changed using it’s configuration file.

4.  Create a log directory for the Mongo logs.  The simplest is to create “log” directory under the root Mongo directory C:\Tools\Mongo….

5.  Create a mongodb.conf file in C:\Tools\MongoDB… root directory.  This put the following minimum information in the file.

systemLog:
   destination: file
   path: "/Tools/MongoDB 2.6 Standard/log/mongodb.log"
net:
   bindIp: 127.0.0.1
   port: 27017
storage:
   journal:
      enabled: true
   dbPath: "/data/db"

 

6.  Open a command window (ensure it’s in Administrator mode) enter the following command.  This will work if your Path variable is set correctly.

mongodb.exe --config "C:\Tools\MongoDB 2.6 Standard\mongodb.conf" --install

Setup Java Development on Windows : Git, Tomcat, Maven, Java JDK

This is a Java development setup that is a continuation of a long ago post regarding Eclipse setup. In this post I exclude the IDE and include Git and Tomcat, two common elements in a Java developers toolbox now.

Create the following environment variables (similar to updating you .bashrc file).

  • HOME = {drive}:\Source
  • SDKS_HOME = {drive}:\SDKs
  • TOOLS_HOME = {drive}:\Tools
  • Download and extract or install msi/exe.

    1. Downloaded Java JDK, the latest or the version of you choice. Make sure you get the correct one for you architecture (i.e. x86, x64,..).  When running the installer, place the JDK in %TOOLS_HOME%.  You will end up with something like C:\Tools\jdk_…
    2. Download Maven latest maven version and extract to %TOOLS_HOME%.  You will end up with something like C:\Tools\maven-3.2.5…
    3. Download Ant latest ant version and extract to %TOOLS_HOME%.  You will end up with something like C:\Tools\ant…
    4. Download Git installer for windows. Install complete with git bash.
    5. Download Apache Tomcat version that you’d want and extract to %TOOLS_HOME%.  You will end up with something like C:\Tools\apache-tomcat-7.0.59-windows-x64…

    Create the following environments variables

    The root directory for these applications will be the directory where you will find the bin folder and other application specific folders.

  • JAVA_HOME = %SDKS_HOME%\jdk_… to the root folder.
  • MAVEN_HOME = %TOOLS_HOME%\maven-… to the root folder.
  • ANT_HOME = %TOOLS_HOME%\ant-… to the root folder.
  • %CATALINA_HOME% = %TOOLS_HOME%\apache-tomcat-… to the root folder.
  • Append the following line to the system Path environment variable

    Don’t forget a semicolon after each new entry.

    • %JAVA_HOME%\bin
    • %MAVEN_HOME%\bin
    • %ANT_HOME%\bin
    • %CATALINA_HOME%\bin

    At this point you will be able to open the git bash window and run the following.

    • java -version
    • git --version
    • mvn –version
    • ant -version
    • For tomcat you will have to manually path over to tomcat bin and run “sh version”.  bash shell doesn’t convert c:\Tools\… correctly for this one.