<commit_before>= Docker for Java Developers - Attendee Setup
:toc:
:toc-placement!:

This folder contains instructions to setup an attendee environment. Please note, that it is only intended to setup the environment for this lab. The lab itself is in the link:https://github.com/arun-gupta/docker-java/blob/master/readme.adoc[main readme]. Continue with it after you finished this setup.
You'll learn about all the software you installed here during the lab. For now just go through this document and let'#'s get ready as fast as possible for the lab.

Your instructor will have a a machine setup with all the relevant downloads and needed infrastructures. The IP will change depending on the network used. In this guide, it's refered to as <INSTRUCTOR_IP> make sure to replace this with the actuall IP address you get from your instructor.

toc::[]

## Prerequisites
This lab can be executed on a netbook with x86 architecture. For it to
be fun, you should have a decent hardware available. Beside the operating system of choice, there's only a couple of other thing you should have installed already:

### Hardware

. CPU
.. Mac: X64 (i5 or superior)
.. Linux / Windows: x86 (Intel Pentium) or x64 (i5 and comparable)

. Memory
.. At least 4 to 8 GB

### Software

. Operating System
.. Mac OS X (10.8 or later), Windows 7 (SP1), Fedora (21 or later)
. Java
.. http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html[Oracle JDK 8u45]
. Webbrowser
.. https://www.google.com/chrome/browser/desktop/[Chrome]
.. link:http://www.getfirefox.com[Firefox]


## A Word About Licenses
This tutorial only uses software which is open source or at least free to use in development and/or education. Please refer to the individual products/tools used in this tutorial.

. Docker is Apache License Version 2.0, see it here: https://github.com/docker/docker/blob/master/LICENSE
. VirtualBox base packages (everything but the extension pack) is released under the GNU General Public License V2, see it here: https://www.virtualbox.org/wiki/GPL
. Msysgit is a fork of Git under the GNU General Public License version 2.0, see it here: http://opensource.org/licenses/GPL-2.0

## Install VirtualBox

Docker currently runs natively on Linux, but you can use VirtualBox to run Docker in a virtual machine on your box, and get the best of both worlds. This is why Virtualbox is a requirement to have on your machine. Get the latest downloads from the instructur machine:

Downloads are available at http://<INSTRUCTOR_IP:8082>/downloads/

or directly from the https://www.virtualbox.org/[Oracle Virtualbox] website.

Installation should complete without any error.

[WARNING]
====
Linux Users

. Have your kernel updated
. Users should have the GNU compiler, build and header files for your current Linux kernel
. Create a `/usr/src/linux` link to the current kernel source
====

## Install Git Client

Install Git Client as explained at: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

## Install Docker Machine

Download your binary from http://<INSTRUCTOR_IP:8082>/downloads/

[source, text]
----
# MacOS
curl -L  http://<INSTRUCTOR_IP>:8082/downloads/docker-machine_darwin-amd64 > /usr/local/bin/docker-machine
chmod +x /usr/local/bin/docker-machine

# Linux
curl -L  http://<INSTRUCTOR_IP>:8082/downloads/docker-machine_linux-amd64 > /usr/local/bin/docker-machine
chmod +x /usr/local/bin/docker-machine

#Windows
curl http://<INSTRUCTOR_IP>:8082/downloads/docker-machine_windows-amd64.exe
----

On Windows copy the script into `C:\docker` directory and rename to: `docker-machine.exe`. Add `C:\docker` to your `PATH` variable.

[source, text]
----
# Windows Only
set PATH=%PATH%;c:\docker
----

## Install Docker Client

Download your binary from http://<INSTRUCTOR_IP>:8082/downloads/

[source, text]
----
# MacOS / Linux (other distros)
curl -L  http://<INSTRUCTOR_IP>:8082/`uname -s`/x86_64/docker-latest > /usr/local/bin/docker
chmod +x /usr/local/bin/docker

#Windows
curl http://<INSTRUCTOR_IP>:8082/docker-1.6.0.exe
----

On Windows put into and rename to `C:\docker\docker.exe`.

## Create Lab Docker Host

. Create the Docker Host to be used in the lab:
+
[source, text]
----
docker-machine create --driver virtualbox --virtualbox-boot2docker-url http://<INSTRUCTOR_IP>:8082/downloads/boot2docker.iso lab
----
+
. Setup the Docker Host to connect to insecure registries:
+
[source, text]
----
docker-machine ssh lab "echo $'EXTRA_ARGS=\"\$EXTRA_ARGS --insecure-registry <INSTRUCTOR_IP>:5000\"' | sudo tee -a /var/lib/boot2docker/profile && sudo /etc/init.d/docker restart"
eval "$(docker-machine env lab)"
----
+
This will allow to download all Docker images from instructor's machine.

## Install Maven

. Download `apache-maven-3.3.3-bin.zip` from the instructor PC.

  curl http://<INSTRUCTOR_IP>:8082/downloads/apache-maven-3.3.3-bin.zip

. Unzip to a folder of your choice and add the folder to your PATH environment variable. For example, do the following on Windows:

  set PATH=%PATH%;c:/apache-maven-3.3.3

## Prepare Maven Settings

Download `lab-settings.xml` file from http://<INSTRUCTOR_IP>:8082/downloads/lab-settings.xml

Edit the model file and replace the `<INSTRUCTOR_IP>` with the accurate value.


## Setup JBoss Developer Studio

To install JBoss Developer Studio stand-alone, complete the following steps:

. Download http://<INSTRUCTOR_IP:8082>/downloads/jboss-devstudio-8.1.0.GA-jar_universal.jar
. Start the installer (see below)
. Follow the on-screen instructions to complete the installation process.

[source, text]
----
# Linux / MacOS / windows
cd /download/path/
java -jar jboss-devstudio-8.1.0.GA-jar_universal.jar
----

## Configure Host

Add a host entry for your Docker Host. To make it easier to access the containers, we add an entry into the host mapping table of your host operating system.

First, find out the IP address of your machine:

[source, text]
----
docker-machine ip lab
----

And edit the `/etc/hosts` (Mac OS) or `C:\Windows\System32\drivers\etc\hosts` (Windows)
and add

[source, text]
----
<OUTPUT OF DOCKER MACHINE COMMAND>  dockerhost
----<commit_msg>cleaning up hardware requirements, adding Vagrant<commit_after>= Docker for Java Developers - Attendee Setup
:toc:
:toc-placement!:

This folder contains instructions to setup an attendee environment. Please note, that it is only intended to setup the environment for this lab. The lab itself is in the link:https://github.com/arun-gupta/docker-java/blob/master/readme.adoc[main readme]. Continue with it after you finished this setup.
You'll learn about all the software you installed here during the lab. For now just go through this document and let'#'s get ready as fast as possible for the lab.

Your instructor will have a a machine setup with all the relevant downloads and needed infrastructures. The IP will change depending on the network used. In this guide, it's refered to as <INSTRUCTOR_IP> make sure to replace this with the actuall IP address you get from your instructor.

toc::[]

## Prerequisites
This lab can be executed on a netbook with x86 architecture. For it to
be fun, you should have a decent hardware available. Beside the operating system of choice, there's only a couple of other thing you should have installed already:

### Hardware

. CPU
.. Mac: X64 (i5 or superior)
.. Linux / Windows: x64 (i5 and comparable)

. Memory
.. At least 4 to 8 GB

### Software

. Operating System
.. Mac OS X (10.8 or later), Windows 7 (SP1), Fedora (21 or later)
. Java
.. http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html[Oracle JDK 8u45]
. Webbrowser
.. https://www.google.com/chrome/browser/desktop/[Chrome]
.. link:http://www.getfirefox.com[Firefox]


## A Word About Licenses
This tutorial only uses software which is open source or at least free to use in development and/or education. Please refer to the individual products/tools used in this tutorial.

. Docker is Apache License Version 2.0, see it here: https://github.com/docker/docker/blob/master/LICENSE
. VirtualBox base packages (everything but the extension pack) is released under the GNU General Public License V2, see it here: https://www.virtualbox.org/wiki/GPL
. Msysgit is a fork of Git under the GNU General Public License version 2.0, see it here: http://opensource.org/licenses/GPL-2.0

## Install VirtualBox

Docker currently runs natively on Linux, but you can use VirtualBox to run Docker in a virtual machine on your box, and get the best of both worlds. This is why Virtualbox is a requirement to have on your machine. Get the latest downloads from the instructur machine:

Downloads are available at http://<INSTRUCTOR_IP:8082>/downloads/

or directly from the https://www.virtualbox.org/[Oracle Virtualbox] website.

Installation should complete without any error.

[WARNING]
====
Linux Users

. Have your kernel updated
. Users should have the GNU compiler, build and header files for your current Linux kernel
. Create a `/usr/src/linux` link to the current kernel source
====

## Install Git Client

Install Git Client as explained at: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

## Install Docker Machine

Download your binary from http://<INSTRUCTOR_IP:8082>/downloads/

[source, text]
----
# MacOS
curl -L  http://<INSTRUCTOR_IP>:8082/downloads/docker-machine_darwin-amd64 > /usr/local/bin/docker-machine
chmod +x /usr/local/bin/docker-machine

# Linux
curl -L  http://<INSTRUCTOR_IP>:8082/downloads/docker-machine_linux-amd64 > /usr/local/bin/docker-machine
chmod +x /usr/local/bin/docker-machine

#Windows
curl http://<INSTRUCTOR_IP>:8082/downloads/docker-machine_windows-amd64.exe
----

On Windows copy the script into `C:\docker` directory and rename to: `docker-machine.exe`. Add `C:\docker` to your `PATH` variable.

[source, text]
----
# Windows Only
set PATH=%PATH%;c:\docker
----

## Install Docker Client

Download your binary from http://<INSTRUCTOR_IP>:8082/downloads/

[source, text]
----
# MacOS / Linux (other distros)
curl -L  http://<INSTRUCTOR_IP>:8082/`uname -s`/x86_64/docker-latest > /usr/local/bin/docker
chmod +x /usr/local/bin/docker

#Windows
curl http://<INSTRUCTOR_IP>:8082/docker-1.6.0.exe
----

On Windows put into and rename to `C:\docker\docker.exe`.

## Create Lab Docker Host

. Create the Docker Host to be used in the lab:
+
[source, text]
----
docker-machine create --driver virtualbox --virtualbox-boot2docker-url http://<INSTRUCTOR_IP>:8082/downloads/boot2docker.iso lab
----
+
. Setup the Docker Host to connect to insecure registries:
+
[source, text]
----
docker-machine ssh lab "echo $'EXTRA_ARGS=\"\$EXTRA_ARGS --insecure-registry <INSTRUCTOR_IP>:5000\"' | sudo tee -a /var/lib/boot2docker/profile && sudo /etc/init.d/docker restart"
eval "$(docker-machine env lab)"
----
+
This will allow to download all Docker images from instructor's machine.

## Install Maven

. Download Apache Maven as:

  curl http://<INSTRUCTOR_IP>:8082/downloads/apache-maven-3.3.3-bin.zip

. Unzip to a folder of your choice and add the folder to your PATH environment variable. For example, do the following on Windows:

  set PATH=%PATH%;c:/apache-maven-3.3.3

## Prepare Maven Settings

Download `lab-settings.xml` file from http://<INSTRUCTOR_IP>:8082/downloads/lab-settings.xml

Edit the model file and replace the `<INSTRUCTOR_IP>` with the accurate value.


## Setup JBoss Developer Studio

To install JBoss Developer Studio stand-alone, complete the following steps:

. Download http://<INSTRUCTOR_IP:8082>/downloads/jboss-devstudio-8.1.0.GA-jar_universal.jar
. Start the installer (see below)
. Follow the on-screen instructions to complete the installation process.

[source, text]
----
# Linux / MacOS / windows
cd /download/path/
java -jar jboss-devstudio-8.1.0.GA-jar_universal.jar
----

## Configure Host

Add a host entry for your Docker Host. To make it easier to access the containers, we add an entry into the host mapping table of your host operating system.

First, find out the IP address of your machine:

[source, text]
----
docker-machine ip lab
----

And edit the `/etc/hosts` (Mac OS) or `C:\Windows\System32\drivers\etc\hosts` (Windows)
and add

[source, text]
----
<OUTPUT OF DOCKER MACHINE COMMAND>  dockerhost
----

## Install Vagrant

. Download Vagrant from `http://<INSTRUCTOR_IP>:8082/downloads/` for your specific operating system.
. Install it by clicking on the archive.

{'fraction_non_alphanumeric': 0.10787547260880058, 'fraction_numerical': 0.019708792534792054, 'mean_word_length': 3.982765531062124, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 42, 'https://': 12, 'lorem ipsum': 0, 'www.': 10, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 52, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2602474', 'n_tokens_mistral': 4031, 'n_tokens_neox': 3714, 'n_words': 1449}