diff --git a/.gitignore b/.gitignore index 3ed4b64..79b5594 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ **/.DS_Store -*.xml diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29..0000000 diff --git a/attendees/cicd/docker-compose.yml b/attendees/cicd/docker-compose.yml deleted file mode 100644 index d843f4f..0000000 --- a/attendees/cicd/docker-compose.yml +++ /dev/null @@ -1,60 +0,0 @@ -# Jenkins -jenkins: - image: arungupta/jenkins-docker-workflow - ports: - - "8084:8080" - - "50000:50000" - environment: - DOCKER_HOST: unix:///var/run/docker.sock - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - /Users/arungupta/jenkins:/var/jenkins_home - - /usr/local/bin/docker:/usr/bin/docker - -# Gogs Image to manage git sources to build and release -git_server: - image: gogs/gogs - container_name: git - ports: - - "3000:3000" - - "10022:22" - volumes_from: - - git_serverdata - links: - - git_db:mysql - -git_serverdata: - image: busybox - container_name: git_serverdata - command: /bin/sh - volumes: - - /data - #Doesn't work for now version due to problem with filesystem - # - ./data/gogs/conf/app.ini:/data/gogs/conf/app.ini - -git_db: - image: mysql:5.6 - volumes_from: - - git_dbdata - ports: - - "3306:3306" - environment: - - MYSQL_ROOT_PASSWORD=supersecret - - MYSQL_DATABASE=gogs - - MYSQL_USER=mysql - - MYSQL_PASSWORD=mysql - -git_dbdata: - image: busybox - command: /bin/sh - volumes: - - /var/lib/mysql - - -# Docker Registry for pushing images -registry: - image: registry:2 - ports: - - "5000:5000" - volumes: - - /Users/arungupta/tmp/docker-registry:/var/lib/registry diff --git a/attendees/cicd/git-server/README.adoc b/attendees/cicd/git-server/README.adoc deleted file mode 100644 index 3ab79bd..0000000 --- a/attendees/cicd/git-server/README.adoc +++ /dev/null @@ -1,30 +0,0 @@ -= Install a Git Server - -== Start Services - -. All services can be started, in detached mode, by giving the command: - -+ - docker-compose up -d -+ -And this shows the output as: -+ - Creating git_serverdata... - Creating gitserver_git_dbdata_1... - Creating gitserver_git_db_1... - Creating git... -+ - -. Configure the installation -.. execute the following script -+ - ./install-gogs.sh -+ - -_example: ./install-gogs.sh 192.168.99.100 3000_ - -== Sign Up - -. Access to this URL: http://dockerhost:3000/user/sign_up -. Create an account and enjoy! -. Enjoy! :) diff --git a/attendees/cicd/git-server/docker-compose.yml b/attendees/cicd/git-server/docker-compose.yml deleted file mode 100644 index be9d250..0000000 --- a/attendees/cicd/git-server/docker-compose.yml +++ /dev/null @@ -1,38 +0,0 @@ -# Gogs Image to manage git sources to build and release -git_server: - image: gogs/gogs - container_name: git - ports: - - "3000:3000" - - "10022:22" - volumes_from: - - git_serverdata - links: - - git_db:mysql - -git_serverdata: - image: busybox - container_name: git_serverdata - command: /bin/sh - volumes: - - /data - #Doesn't work for now version due to problem with filesystem - # - ./data/gogs/conf/app.ini:/data/gogs/conf/app.ini - -git_db: - image: mysql:5.6 - volumes_from: - - git_dbdata - ports: - - "3306:3306" - environment: - - MYSQL_ROOT_PASSWORD=supersecret - - MYSQL_DATABASE=gogs - - MYSQL_USER=mysql - - MYSQL_PASSWORD=mysql - -git_dbdata: - image: busybox - command: /bin/sh - volumes: - - /var/lib/mysql diff --git a/attendees/cicd/git-server/install-gogs.sh b/attendees/cicd/git-server/install-gogs.sh deleted file mode 100755 index 66ae1be..0000000 --- a/attendees/cicd/git-server/install-gogs.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -eu - -function installGogs(){ - local DOCKER_HOST_IP=$1 - local GOGS_HTTP_PORT=$2 - printf "\e[1;33m########################################\e[m\n" - printf "\e[1;33m# Install Gogs Server on: %s\e[m\n" "${DOCKER_HOST_IP}" - printf "\e[1;33m########################################\e[m\n" - - curl 'http://'${DOCKER_HOST_IP}':'${GOGS_HTTP_PORT}'/install' \ - -H 'Origin: null' -H 'Accept-Encoding: gzip, deflate' \ - -H 'Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4' \ - -H 'Upgrade-Insecure-Requests: 1' \ - -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36' \ - -H 'Content-Type: application/x-www-form-urlencoded' \ - -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' \ - -H 'Cache-Control: max-age=0' \ - -H 'Connection: keep-alive' \ - --data 'db_type=MySQL&db_host=mysql%3A3306&db_user=mysql&db_passwd=mysql&db_name=gogs&ssl_mode=disable&db_path=data%2Fgogs.db&app_name=Gogs%3A+Go+Git+Service&repo_root_path=%2Fhome%2Fgit%2Fgogs-repositories&run_user=git&domain='${DOCKER_HOST_IP}'&ssh_port=22&http_port='${GOGS_HTTP_PORT}'&app_url=http%3A%2F%2F'${DOCKER_HOST_IP}'%3A3000%2F&smtp_host=&smtp_from=&smtp_email=&smtp_passwd=&admin_name=&admin_passwd=&admin_confirm_passwd=&admin_email=' --compressed - - printf "Configuration OK." - printf "\e[1;33m# Go to http://%s:%s/user/sign_up\e[m\n" "${DOCKER_HOST_IP}" "${GOGS_HTTP_PORT}" - -} - -installGogs $1 $2 -open http://$1:$2/user/sign_up diff --git a/attendees/cicd/jenkins/Dockerfile b/attendees/cicd/jenkins/Dockerfile deleted file mode 100644 index 538e6e0..0000000 --- a/attendees/cicd/jenkins/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM jenkinsci/jenkins - -USER root - -RUN curl -L https://get.docker.com/builds/Linux/x86_64/docker-latest > /usr/local/bin/docker -RUN chmod +x /usr/local/bin/docker - -RUN curl -L http://apache.uib.no/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.zip -o /tmp/apache-maven-3.3.3-bin.zip -RUN unzip /tmp/apache-maven-3.3.3-bin.zip -d /tmp -ENV PATH /tmp/apache-maven-3.3.3/bin:$PATH - -#USER jenkins - -COPY plugins.txt /usr/share/jenkins/plugins.txt -RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt - -#RUN docker --version diff --git a/attendees/cicd/jenkins/docker-compose.yml b/attendees/cicd/jenkins/docker-compose.yml deleted file mode 100644 index c666d54..0000000 --- a/attendees/cicd/jenkins/docker-compose.yml +++ /dev/null @@ -1,16 +0,0 @@ -jenkins: - image: arungupta/jenkins-docker-workflow - ports: - - "8084:8080" - - "50000:50000" - environment: - # DOCKER_HOST: tcp://192.168.99.100:2376 - DOCKER_HOST: unix:///var/run/docker.sock - # DOCKER_CERT_PATH: /var/docker/cert - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - /Users/arungupta/jenkins:/var/jenkins_home - # - /Users/arungupta/.docker/machine/machines/docker-java:/var/docker/cert - - /usr/local/bin/docker:/usr/bin/docker - # net: "host" - # privileged: true diff --git a/attendees/cicd/jenkins/plugins.txt b/attendees/cicd/jenkins/plugins.txt deleted file mode 100644 index 1b5bfc3..0000000 --- a/attendees/cicd/jenkins/plugins.txt +++ /dev/null @@ -1,22 +0,0 @@ -git 2.4.0 -git-client 1.18.0 -scm-api 0.2 -workflow-aggregator 1.10 -workflow-cps-global-lib 1.10 -workflow-durable-task-step 1.10 -workflow-step-api 1.10 -workflow-cps 1.10 -workflow-scm-step 1.10 -workflow-job 1.10 -workflow-basic-steps 1.10 -workflow-api 1.10 -workflow-support 1.10 -durable-task 1.5 -workflow-support 1.10 -workflow-cps 1.10 -git-server 1.5 -docker-workflow 1.2 -docker-commons 1.0 -script-security 1.15 -authentication-tokens 1.1 -docker-commons 1.0 diff --git a/attendees/cicd/readme.adoc b/attendees/cicd/readme.adoc deleted file mode 100644 index fe04ffb..0000000 --- a/attendees/cicd/readme.adoc +++ /dev/null @@ -1,67 +0,0 @@ -== Continuous Deployment using Jenkins and Docker Workflow - -All instructions and resources are in `attendees/cicd` directory. - -NOTE: Change IP address to the Docker host where Git server is running. - -=== Configure Docker Machine - -. Enable Docker commands in Jenkins `docker-machine ssh "sudo chmod 777 /var/run/docker.sock"` - -=== Start Services - -Start all services in detached mode by giving the command: - - docker-compose up -d - -This shows the output: - - Creating git_serverdata... - Creating cicd_registry_1... - Creating cicd_jenkins_1... - Creating cicd_git_dbdata_1... - Creating cicd_git_db_1... - Creating git... - -The exact output will differ as all the images may be downloaded. - -=== Setup Gogs server - -. Configure Gogs server by executing the script: -+ - ./install-gogs.sh -+ -For example: `./install-gogs.sh 192.168.99.100 3000` -+ -This brings up the page http://:3000/user/sign_up in your default browser. -+ -. Create an account and login using the credentials -. Create a new repository `javaee7-docker-workflow` (take all defaults) -. In a shell: -+ - git clone https://github.com/arun-gupta/javaee7-docker-workflow - cd javaee7-docker-workflow - git remote add gogs http://192.168.99.100:3000/arun/javaee7-docker-workflow.git - git push gogs master -+ -This workspace is a Java EE sample that has Arquillian tests and can be packaged as a Docker image. - -=== Jenkins - -. Access Jenkins at http://192.168.99.100:8084 -. Create a new workflow and use "`Workflow script from SCM`". -. Use the "`Repository URL`" as "`https://github.com/arun-gupta/javaee7-docker-workflow`" and "`Script Path`" as "`Jenkinsfile`". -. Start a build - -=== Current Status - -. Checks out the application workspace from Gogs server -. Builds the application -. Runs the test (using `mvn test -Pwildfly-managed`) -. Creates a Docker image for the application (`mvn package -Pdocker -DskipTests`) - -=== TODO - -. https://github.com/javaee-samples/docker-java/issues/96[Build CI/CD project from git hook/poll] -. https://github.com/javaee-samples/docker-java/issues/95[Push CI/CD Docker images to Docker registry] -. https://github.com/javaee-samples/docker-java/issues/94[Consolidate docker-compose.yml for CI/CD] diff --git a/attendees/docker-compose-pull-images.yml b/attendees/docker-compose-pull-images.yml deleted file mode 100644 index fbf8f83..0000000 --- a/attendees/docker-compose-pull-images.yml +++ /dev/null @@ -1,15 +0,0 @@ -ubuntu: - image: ubuntu -wildfly: - image: jboss/wildfly -mysql: - image: mysql -javaee7-hol: - image: arungupta/javaee7-hol -swarm: - image: swarm -wildfly-couchbase-javaee7: - image: arungupta/wildfly-couchbase-javaee7 -couchbase: - image: arungupta/couchbase - diff --git a/attendees/docker-compose.yml b/attendees/docker-compose.yml deleted file mode 100644 index deee128..0000000 --- a/attendees/docker-compose.yml +++ /dev/null @@ -1,15 +0,0 @@ -mycouchbase: - container_name: "db" - image: arungupta/couchbase - ports: - - 8091:8091 - - 8092:8092 - - 8093:8093 - - 11210:11210 -mywildfly: - image: arungupta/wildfly-couchbase-javaee7 - environment: - - COUCHBASE_URI=db - ports: - - 8080:8080 - diff --git a/attendees/kubernetes/app-mysql-pod.yaml b/attendees/kubernetes/app-mysql-pod.yaml deleted file mode 100644 index b8884f3..0000000 --- a/attendees/kubernetes/app-mysql-pod.yaml +++ /dev/null @@ -1,28 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: mysql-pod - labels: - name: mysql-pod - context: docker-k8s-lab -spec: - containers: - - - name: mysql - image: mysql:latest - env: - - - name: "MYSQL_USER" - value: "mysql" - - - name: "MYSQL_PASSWORD" - value: "mysql" - - - name: "MYSQL_DATABASE" - value: "sample" - - - name: "MYSQL_ROOT_PASSWORD" - value: "supersecret" - ports: - - - containerPort: 3306 diff --git a/attendees/kubernetes/app-mysql-service.yaml b/attendees/kubernetes/app-mysql-service.yaml deleted file mode 100644 index 0cbb329..0000000 --- a/attendees/kubernetes/app-mysql-service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: mysql-service - labels: - name: mysql-pod - context: docker-k8s-lab -spec: - ports: - # the port that this service should serve on - - port: 3306 - # label keys and values that must match in order to receive traffic for this service - selector: - name: mysql-pod - context: docker-k8s-lab diff --git a/attendees/kubernetes/app-wildfly-rc.yaml b/attendees/kubernetes/app-wildfly-rc.yaml deleted file mode 100644 index 303b63f..0000000 --- a/attendees/kubernetes/app-wildfly-rc.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: ReplicationController -metadata: - name: wildfly-rc - labels: - name: wildfly - context: docker-k8s-lab -spec: - replicas: 1 - template: - metadata: - labels: - name: wildfly - spec: - containers: - - name: wildfly-rc-pod - image: arungupta/wildfly-mysql-javaee7:k8s - ports: - - containerPort: 8080 \ No newline at end of file diff --git a/attendees/kubernetes/app.yaml b/attendees/kubernetes/app.yaml deleted file mode 100644 index 4ee8076..0000000 --- a/attendees/kubernetes/app.yaml +++ /dev/null @@ -1,64 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: mysql-pod - labels: - name: mysql-pod - context: docker-k8s-lab -spec: - containers: - - - name: mysql - image: mysql:latest - env: - - - name: "MYSQL_USER" - value: "mysql" - - - name: "MYSQL_PASSWORD" - value: "mysql" - - - name: "MYSQL_DATABASE" - value: "sample" - - - name: "MYSQL_ROOT_PASSWORD" - value: "supersecret" - ports: - - - containerPort: 3306 ----- -apiVersion: v1 -kind: Service -metadata: - name: mysql-service - labels: - name: mysql-pod - context: docker-k8s-lab -spec: - ports: - # the port that this service should serve on - - port: 3306 - # label keys and values that must match in order to receive traffic for this service - selector: - name: mysql-pod - context: docker-k8s-lab ----- -apiVersion: v1 -kind: ReplicationController -metadata: - name: wildfly-rc - labels: - name: wildfly - context: docker-k8s-lab -spec: - replicas: 1 - template: - metadata: - labels: - name: wildfly - spec: - containers: - - name: wildfly-rc-pod - image: arungupta/wildfly-mysql-javaee7:k8s - ports: - - containerPort: 8080 \ No newline at end of file diff --git a/attendees/kubernetes/couchbase-pv.yaml b/attendees/kubernetes/couchbase-pv.yaml deleted file mode 100644 index d3dad1e..0000000 --- a/attendees/kubernetes/couchbase-pv.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: PersistentVolume -metadata: - name: pv001 - labels: - type: local -spec: - capacity: - storage: 4Gi - accessModes: - - ReadWriteMany - hostPath: - path: "/tmp/data01" diff --git a/attendees/kubernetes/couchbase-pvc.yaml b/attendees/kubernetes/couchbase-pvc.yaml deleted file mode 100644 index a192442..0000000 --- a/attendees/kubernetes/couchbase-pvc.yaml +++ /dev/null @@ -1,10 +0,0 @@ -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: pvc001 -spec: - accessModes: - - ReadWriteMany - resources: - requests: - storage: 1Gi diff --git a/attendees/kubernetes/couchbase-rc.yaml b/attendees/kubernetes/couchbase-rc.yaml deleted file mode 100644 index 863a7a6..0000000 --- a/attendees/kubernetes/couchbase-rc.yaml +++ /dev/null @@ -1,32 +0,0 @@ -apiVersion: v1 -kind: ReplicationController -metadata: - name: couchbase-rc - labels: - name: couchbase-rc - context: docker-k8s-lab -spec: - replicas: 1 - template: - metadata: - name: couchbase-rc-pod - labels: - name: couchbase-rc-pod - context: docker-k8s-lab - spec: - containers: - - name: couchbase-rc-pod - image: couchbase/server - volumeMounts: - - mountPath: "/opt/couchbase/var" - name: mypd - ports: - - containerPort: 8091 - hostPort: 8091 - - containerPort: 8092 - - containerPort: 8093 - - containerPort: 11210 - volumes: - - name: mypd - persistentVolumeClaim: - claimName: pvc001 diff --git a/attendees/kubernetes/couchbase-service.yaml b/attendees/kubernetes/couchbase-service.yaml deleted file mode 100644 index 40bbef7..0000000 --- a/attendees/kubernetes/couchbase-service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: couchbase-service - labels: - name: couchbase-service-pod - context: docker-k8s-lab -spec: - ports: - - port: 8091 - port: 8092 - port: 8093 - port: 11210 - # label keys and values that must match in order to receive traffic for this service - selector: - name: couchbase-rc-pod - context: docker-k8s-lab diff --git a/attendees/kubernetes/create-script.sh b/attendees/kubernetes/create-script.sh deleted file mode 100644 index ef55fe3..0000000 --- a/attendees/kubernetes/create-script.sh +++ /dev/null @@ -1,3 +0,0 @@ -./cluster/kubectl.sh --v=5 create -f ../../attendees/kubernetes/app-mysql-pod.yaml -./cluster/kubectl.sh --v=5 create -f ../../attendees/kubernetes/app-mysql-service.yaml -./cluster/kubectl.sh --v=5 create -f ../../attendees/kubernetes/app-wildfly-rc.yaml diff --git a/attendees/kubernetes/delete-script.sh b/attendees/kubernetes/delete-script.sh deleted file mode 100644 index 992e9a9..0000000 --- a/attendees/kubernetes/delete-script.sh +++ /dev/null @@ -1,3 +0,0 @@ -./cluster/kubectl.sh --v=5 delete -f ../../attendees/kubernetes/app-wildfly-rc.yaml -./cluster/kubectl.sh --v=5 delete -f ../../attendees/kubernetes/app-mysql-service.yaml -./cluster/kubectl.sh --v=5 delete -f ../../attendees/kubernetes/app-mysql-pod.yaml diff --git a/chapters/docker-amazon.adoc b/chapters/docker-amazon.adoc deleted file mode 100644 index fc7ee16..0000000 --- a/chapters/docker-amazon.adoc +++ /dev/null @@ -1,5 +0,0 @@ -## Deploy Application on Amazon Container Service - -[quote, docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html] -Amazon EC2 Container Service (Amazon ECS) is a highly scalable, fast, container management service that makes it easy to run, stop, and manage Docker containers on a cluster of Amazon EC2 instances. - diff --git a/chapters/docker-basics.adoc b/chapters/docker-basics.adoc deleted file mode 100644 index 4de6654..0000000 --- a/chapters/docker-basics.adoc +++ /dev/null @@ -1,146 +0,0 @@ -:imagesdir: images - -[[Docker_Basics]] -## Docker Basics - -*PURPOSE*: This chapter introduces the basic terminology of Docker. - -[quote, docs.docker.com/] -Docker is a platform for developers and sysadmins to develop, ship, and run applications. Docker lets you quickly assemble applications from components and eliminates the friction that can come when shipping code. Docker lets you get your code tested and deployed into production as fast as possible. - -Docker simplifies software delivery by making it easy to build and share images that contain your application’s entire environment, or _application operating system_. - -**What does it mean by an application operating system ?** - -Your application typically require a specific version of operating system, application server, JDK, database server, may require to tune the configuration files, and similarly multiple other dependencies. The application may need binding to specific ports and certain amount of memory. The components and configuration together required to run your application is what is referred to as application operating system. - -You can certainly provide an installation script that will download and install these components. Docker simplifies this process by allowing to create an image that contains your application and infrastructure together, managed as one component. These images are then used to create Docker containers which run on the container virtualization platform, provided by Docker. - -**Main Components of Docker** - -Docker has three main components: - -. __Images__ are the *build component* of Docker and are the read-only templates defining an application operating system. -. __Containers__ are the *run component* of Docker and created from images. Containers can be run, started, stopped, moved, and deleted. -. Images are stored, shared, and managed in a __registry__ and are the *distribution component* of Docker. Docker Hub is a publicly available registry and is available at http://hub.docker.com. - -In order for these three components to work together, the *Docker Daemon* runs on a host machine and does the heavy lifting of building, running, and distributing Docker containers. In addition, the *Client* is a Docker binary which accepts commands from the user and communicates back and forth with the Daemon. - -.Docker architecture -image::docker-architecture.png[] - -The Client communicates with a Daemon that is either co-located on the same host or on a different host. Use the `pull` command on the Client to request the Daemon to pull an image from the registry. The Daemon then downloads the image from Docker Hub, or whichever registry is configured. Multiple images can be downloaded from the registry and installed on the Daemon host. To run an Image, use the `run` command on the Client to request the Daemon to create a container on-demand based on the image. - -**How does a Docker Image work?** - -We've already seen that Docker images are read-only templates from which Docker containers are launched. Each image consists of a series of layers. Docker makes use of union file systems to combine these layers into a single image. Union file systems allow files and directories of separate file systems, known as branches, to be transparently overlaid, forming a single coherent file system. - -One of the reasons Docker is so lightweight is because of these layers. When you change a Docker image—for example, update an application to a new version— a new layer gets built. Thus, rather than replacing the whole image or entirely rebuilding, as you may do with a virtual machine, only that layer is added or updated. Now you don't need to distribute a whole new image, just the update, making distributing Docker images faster and simpler. - -Every image starts from a base image, for example `ubuntu`, a base Ubuntu image, or `fedora`, a base Fedora image. You can also use images of your own as the basis for a new image, for example if you have a base Apache image you could use this as the base of all your web application images. - -NOTE: By default, Docker obtains these base images from Docker Hub. - -Docker images are then built from these base images using a simple, descriptive set of steps we call instructions. Each instruction creates a new layer in our image. Instructions include actions like: - -. Run a command -. Add a file or directory -. Create an environment variable -. Run a process when launching a container - -These instructions are stored in a file called a Dockerfile. Docker reads this Dockerfile when you request a build of an image, executes the instructions, and returns a final image. - -**How does a Container work?** - -A container consists of an operating system, user-added files, and meta-data. As we've seen, each container is built from an image. That image tells Docker what the container holds, what process to run when the container is launched, and a variety of other configuration data. The Docker image is read-only. When Docker runs a container from an image, it adds a read-write layer on top of the image (using a union file system as we saw earlier) in which your application can then run. - -### Docker Machine - -Machine makes it really easy to create Docker hosts on your computer, on cloud providers and inside your own data center. It creates servers, installs Docker on them, then configures the Docker client to talk to them. - -Once your Docker host has been created, it then has a number of commands for managing containers: - -. Start, stop, restart container -. Upgrade Docker -. Configure the Docker client to talk to a host - -Docker Machine was already installed as part of Docker Toolbox during the setup. - -Find out more details at link:https://docs.docker.com/machine/[Docker Machine Website]. - -Open Docker shell, check if docker machine is working: - - docker-machine -v - -It shows the output: - - docker-machine version 0.5.0 (04cfa58) - -NOTE: The exact version may differ based upon how recently the installation was performed. - -### Docker Client - -The client communicates with the demon process on your host and let's you work with images and containers. - -Check if your client is working using the following command: - - docker -v - -It shows the output: - - Docker version 1.9.0, build 76d6bc9 - -NOTE: The exact version may differ based upon how recently the installation was performed. - -The most important options you'll be using frequently are: - -. `run` - runs a container -. `ps`- lists containers -. `stop` - stops a container -. `rm` - Removes a container - -Get a full list of available commands with - - docker - -A more commonly used list of commands is available at <>. - -### Verify Docker Configuration - -Open Docker shell, check if your Docker Host is running: - - docker-machine ls - -You should see the output similar to: - -[source, text] ----- -NAME ACTIVE DRIVER STATE URL SWARM -default * virtualbox Running tcp://192.168.99.100:2376 ----- - -This machine is shown in "`Running`" state. If the machine state is stopped, start it with: - - docker-machine start default - -After it is started you can find out IP address of your Docker Host with: - - docker-machine ip default - -We already did this during the setup document, remember? So, this is a good chance to check, if you already added this IP to your hosts file. - -Type: - - ping dockerhost - -and see if this resolves to the IP address that the docker-machine command printed out. You should see an output as: - -[source, text] ----- -> ping dockerhost -PING dockerhost (192.168.99.101): 56 data bytes -64 bytes from 192.168.99.101: icmp_seq=0 ttl=64 time=0.394 ms -64 bytes from 192.168.99.101: icmp_seq=1 ttl=64 time=0.387 ms ----- - -If it does, you're ready to start the workshop. diff --git a/chapters/docker-commands.adoc b/chapters/docker-commands.adoc deleted file mode 100644 index 6988e9b..0000000 --- a/chapters/docker-commands.adoc +++ /dev/null @@ -1,35 +0,0 @@ -:imagesdir: images - -[[Common_Docker_Commands]] -## Common Docker Commands - -Here is the list of commonly used Docker commands: - -[width="100%", options="header"] -|================== -| Purpose| Command -2+^s| Image -| Build an image| `docker build --rm=true .` -| Install an image | `docker pull ${IMAGE}` -| List of installed images | `docker images` -| List of installed images (detailed listing) | `docker images --no-trunc` -| Remove an image | `docker rmi ${IMAGE_ID}` -| Remove all untagged images | `docker rmi $(docker images \| grep “^” \| awk “{print $3}”)` -| Remove all images | `docker rm $(docker ps -aq)` -| Remove dangling images | `docker rmi $(docker images --quiet --filter "dangling=true")` -2+^s| Containers -| Run a container | `docker run` -| List of running containers | `docker ps` -| List of all containers | `docker ps -a` -| Stop a container | `docker stop ${CID}` -| Stop all running containers | `docker stop ``docker ps -q``` -| List all exited containers with status 1 | `docker ps -a --filter "exited=1"` -| Remove a container | `docker rm ${CID}` -| Remove container by a regular expression | `docker ps -a \| grep wildfly \| awk '{print $1}' \| xargs docker rm -f` -| Remove all exited containers | `docker rm -f $(docker ps -a \| grep Exit \| awk '{ print $1 }')` -| Remove all containers | `docker rm $(docker ps -aq)` -| Find IP address of the container | `docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${CID}` -| Attach to a container | `docker attach ${CID}` -| Open a shell in to a container | `docker exec -it ${CID} bash` -| Get container id for an image by a regular expression | `docker ps \| grep wildfly \| awk '{print $1}'` -|================== diff --git a/chapters/docker-compose.adoc b/chapters/docker-compose.adoc deleted file mode 100644 index f636d87..0000000 --- a/chapters/docker-compose.adoc +++ /dev/null @@ -1,340 +0,0 @@ -:imagesdir: images - -[[Docker_Compose]] -## Multiple Containers Using Docker Compose - -[quote, github.com/docker/compose] -Docker Compose is a tool for defining and running complex applications with Docker. With Compose, you define a multi-container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running. - -An application using Docker containers will typically consist of multiple containers. With Docker Compose, there is no need to write shell scripts to start your containers. All the containers are defined in a configuration file using _services_, and then `docker-compose` script is used to start, stop, and restart the application and all the services in that application, and all the containers within that service. The complete list of commands is: - -[options="header"] -|==== -| Command | Purpose -| `build` | Build or rebuild services -| `help` | Get help on a command -| `kill` | Kill containers -| `logs` | View output from containers -| `port` | Print the public port for a port binding -| `ps` | List containers -| `pull` | Pulls service images -| `restart` | Restart services -| `rm` | Remove stopped containers -| `run` | Run a one-off command -| `scale` | Set number of containers for a service -| `start` | Start services -| `stop` | Stop services -| `up` | Create and start containers -| `migrate-to-labels Recreate containers to add labels -|==== - -Docker Compose applications can use "`classic`" container linking that is confined to a single host. Alternatively, it can use multi-host networking introduced in Docker 1.9. - -### The Application - -The application used in this section will show how to query a Couchbase sample data using simple Java EE application deployed on WildFly. The Java EE application will use JAX-RS to publish REST endpoint which will then be invoked using `curl`. - -### Configuration File - -. Entry point to Compose is `docker-compose.yml`. Lets use the following file: -+ -[source, yml] ----- -mycouchbase: - container_name: "db" - image: arungupta/couchbase - ports: - - 8091:8091 - - 8092:8092 - - 8093:8093 - - 11210:11210 -mywildfly: - image: arungupta/wildfly-couchbase-javaee7 - environment: - - COUCHBASE_URI=db - ports: - - 8080:8080 ----- -+ -This file is available in https://github.com/javaee-samples/docker-java/raw/master/attendees/docker-compose.yml[] and shows: -+ -.. Two services in this Compose are defined by the name `mycouchbase` and `mywildfly` -.. Image name for each service defined using `image` -... `arungupta/couchbase` starts Couchbase server, configures it using http://developer.couchbase.com/documentation/server/4.0/rest-api/rest-endpoints-all.html[Couchbase REST API], and loads a sample bucket -... `arungupta/wildfly-couchbase-javaee7` starts WildFly and deploys application WAR file built from https://github.com/arun-gupta/couchbase-javaee. This image built using https://github.com/arun-gupta/docker-images/blob/master/wildfly-couchbase-javaee7/Dockerfile. -.. Environment variable for WildFly container is defined in `environment` -.. Couchbase container is linked with WildFly container using `COUCHBASE_URI`. This is used in the application code as shown at https://github.com/arun-gupta/couchbase-javaee/blob/master/src/main/java/org/couchbase/sample/javaee/Database.java#L44. -.. Port forwarding is achieved using `ports` - -### Start Services - -. All services can be started, in detached mode, by giving the command: -+ - docker-compose --x-networking up -d -+ -`--x-networking` will create a bridge network. Docker 1.9 is required to run this application. -+ -And this shows the output as: -+ -[source, text] ----- -docker-compose --x-networking up -d -Creating network "attendees" with driver "None" -Creating attendees_mywildfly_1 -Creating db ----- -+ -An alternate compose file name can be specified using `-f`. -+ -An alternate directory where the compose file exists can be specified using `-p`. -+ -. Started services can be verified as: -+ -[source, text] ----- -docker-compose ps - Name Command State Ports -------------------------------------------------------------------------------------------------------------------------------------- -attendees_mywildfly_1 /opt/jboss/wildfly/bin/sta ... Up 0.0.0.0:8080->8080/tcp, - 0.0.0.0:9990->9990/tcp -db /entrypoint.sh /opt/couchb ... Up 11207/tcp, - 0.0.0.0:11210->11210/tcp, - 11211/tcp, 18091/tcp, - 18092/tcp, - 0.0.0.0:8091->8091/tcp, - 0.0.0.0:8092->8092/tcp, - 0.0.0.0:8093->8093/tcp ----- -+ -This provides a consolidated view of all the services started, and containers within them. -+ -Alternatively, the containers in this application, and any additional containers running on this Docker host can be verified by using the usual `docker ps` command: -+ -[source, text] ----- -docker ps -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -7a0435413a3b arungupta/couchbase "/entrypoint.sh /opt/" About a minute ago Up About a minute 0.0.0.0:8091-8093->8091-8093/tcp, 11207/tcp, 11211/tcp, 0.0.0.0:11210->11210/tcp, 18091-18092/tcp db -be57cb3d1ad6 arungupta/wildfly-couchbase-javaee7 "/opt/jboss/wildfly/b" About a minute ago Up About a minute 0.0.0.0:8080->8080/tcp, 0.0.0.0:9990->9990/tcp attendees_mywildfly_1 ----- -+ -. Service logs can be seen as: -+ -[source, text] ----- -docker-compose logs -Attaching to db, attendees_mywildfly_1 -db | Starting Couchbase Server -- Web UI available at http://:8091 -mywildfly_1 | ========================================================================= -mywildfly_1 | -mywildfly_1 | JBoss Bootstrap Environment -mywildfly_1 | -mywildfly_1 | JBOSS_HOME: /opt/jboss/wildfly -mywildfly_1 | -mywildfly_1 | JAVA: /usr/lib/jvm/java/bin/java -mywildfly_1 | -mywildfly_1 | JAVA_OPTS: -server -XX:+UseCompressedOops -server -XX:+UseCompressedOops -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -mywildfly_1 | -mywildfly_1 | ========================================================================= -mywildfly_1 | -mywildfly_1 | OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 -mywildfly_1 | 01:06:57,381 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.3.Final -mywildfly_1 | 01:06:57,842 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final -mywildfly_1 | 01:06:57,938 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) starting -mywildfly_1 | 01:07:03,068 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 3) WFLYCTL0028: Attribute 'job-repository-type' in the resource at address '/subsystem=batch' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation. -mywildfly_1 | 01:07:03,088 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 7) WFLYCTL0028: Attribute 'enabled' in the resource at address '/subsystem=datasources/data-source=ExampleDS' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation. -mywildfly_1 | 01:07:03,870 INFO [org.jboss.as.repository] (ServerService Thread Pool -- 24) WFLYDR0001: Content added at location /opt/jboss/wildfly/standalone/data/content/b6/5e987fe57e1d90e1414ba1c90e542f6311436d/content -mywildfly_1 | 01:07:03,936 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http) -mywildfly_1 | 01:07:04,064 INFO [org.xnio] (MSC service thread 1-1) XNIO version 3.3.1.Final -mywildfly_1 | 01:07:04,160 INFO [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.3.1.Final -mywildfly_1 | 01:07:04,463 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 37) WFLYIO001: Worker 'default' has auto-configured to 2 core threads with 16 task threads based on your 1 available processors -mywildfly_1 | 01:07:04,418 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 38) WFLYCLINF0001: Activating Infinispan subsystem. -mywildfly_1 | 01:07:04,562 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 56) WFLYWS0002: Activating WebServices Extension -mywildfly_1 | 01:07:04,612 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 44) WFLYJSF0007: Activated the following JSF Implementations: [main] -mywildfly_1 | 01:07:04,567 INFO [org.jboss.as.security] (ServerService Thread Pool -- 53) WFLYSEC0002: Activating Security Subsystem -mywildfly_1 | 01:07:04,567 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 54) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique. -mywildfly_1 | 01:07:04,593 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 46) WFLYNAM0001: Activating Naming Subsystem -mywildfly_1 | 01:07:04,881 INFO [org.jboss.remoting] (MSC service thread 1-1) JBoss Remoting version 4.0.9.Final -mywildfly_1 | 01:07:05,081 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0003: Undertow 1.2.9.Final starting -mywildfly_1 | 01:07:05,207 INFO [org.jboss.as.connector] (MSC service thread 1-2) WFLYJCA0009: Starting JCA Subsystem (IronJacamar 1.2.5.Final) -mywildfly_1 | 01:07:05,277 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3) -mywildfly_1 | 01:07:05,315 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0003: Undertow 1.2.9.Final starting -mywildfly_1 | 01:07:05,686 INFO [org.jboss.as.security] (MSC service thread 1-2) WFLYSEC0001: Current PicketBox version=4.9.2.Final -mywildfly_1 | 01:07:05,954 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0018: Started Driver service with driver-name = h2 -mywildfly_1 | 01:07:05,938 INFO [org.jboss.as.naming] (MSC service thread 1-1) WFLYNAM0003: Starting Naming Service -mywildfly_1 | 01:07:06,130 INFO [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default] -mywildfly_1 | 01:07:06,399 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0014: Creating file handler for path /opt/jboss/wildfly/welcome-content -mywildfly_1 | 01:07:06,888 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0012: Started server default-server. -mywildfly_1 | 01:07:07,303 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0006: Undertow HTTP listener default listening on /0.0.0.0:8080 -mywildfly_1 | 01:07:07,322 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0018: Host default-host starting -mywildfly_1 | 01:07:08,014 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS] -mywildfly_1 | 01:07:08,430 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) WFLYDS0013: Started FileSystemDeploymentService for directory /opt/jboss/wildfly/standalone/deployments -mywildfly_1 | 01:07:08,489 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "airlines.war" (runtime-name: "airlines.war") -mywildfly_1 | 01:07:08,605 INFO [org.jboss.ws.common.management] (MSC service thread 1-1) JBWS022052: Starting JBoss Web Services - Stack CXF Server 5.0.0.Final -mywildfly_1 | 01:07:11,430 INFO [org.jboss.weld.deployer] (MSC service thread 1-1) WFLYWELD0003: Processing weld deployment airlines.war -mywildfly_1 | 01:07:11,730 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-1) HV000001: Hibernate Validator 5.1.3.Final -db | * Trying 127.0.0.1... -db | % Total % Received % Xferd Average Speed Time Time Time Current -db | Dload Upload Total Spent Left Speed - 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 8091 (#0) -db | > POST /pools/default HTTP/1.1 -db | > User-Agent: curl/7.40.0-DEV -db | > Host: 127.0.0.1:8091 -db | > Accept: */* -db | > Content-Length: 36 -db | > Content-Type: application/x-www-form-urlencoded -db | > -db | } [36 bytes data] -db | * upload completely sent off: 36 out of 36 bytes -db | < HTTP/1.1 200 OK -db | < Server: Couchbase Server -db | < Pragma: no-cache -db | < Date: Wed, 23 Dec 2015 01:07:11 GMT -db | < Content-Length: 0 -db | < Cache-Control: no-cache -db | < -100 36 0 0 100 36 0 690 --:--:-- --:--:-- --:--:-- 765 -db | * Connection #0 to host 127.0.0.1 left intact -db | * Trying 127.0.0.1... -db | % Total % Received % Xferd Average Speed Time Time Time Current -db | Dload Upload Total Spent Left Speed - 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 8091 (#0) -db | > POST /node/controller/setupServices HTTP/1.1 -db | > User-Agent: curl/7.40.0-DEV -db | > Host: 127.0.0.1:8091 -db | > Accept: */* -db | > Content-Length: 26 -db | > Content-Type: application/x-www-form-urlencoded -db | > -db | } [26 bytes data] -db | * upload completely sent off: 26 out of 26 bytes -db | < HTTP/1.1 200 OK -db | < Server: Couchbase Server -db | < Pragma: no-cache -db | < Date: Wed, 23 Dec 2015 01:07:11 GMT -db | < Content-Length: 0 -db | < Cache-Control: no-cache -db | < -100 26 0 0 100 26 0 348 --:--:-- --:--:-- --:--:-- 448 -db | * Connection #0 to host 127.0.0.1 left intact -db | * Trying 127.0.0.1... -db | % Total % Received % Xferd Average Speed Time Time Time Current -db | Dload Upload Total Spent Left Speed - 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 8091 (#0) -db | > POST /settings/web HTTP/1.1 -db | > User-Agent: curl/7.40.0-DEV -db | > Host: 127.0.0.1:8091 -db | > Accept: */* -db | > Content-Length: 50 -db | > Content-Type: application/x-www-form-urlencoded -db | > -db | } [50 bytes data] -db | * upload completely sent off: 50 out of 50 bytes -db | < HTTP/1.1 200 OK -db | < Server: Couchbase Server -db | <{"newBaseUri":"http://127.0.0.1:8091/"} Pragma: no-cache -db | < Date: Wed, 23 Dec 2015 01:07:12 GMT -db | < Content-Type: application/json -db | < Content-Length: 39 -db | < Cache-Control: no-cache -db | < -db | { [39 bytes data] -100 89 100 39 100 50 268 344 --:--:-- --:--:-- --:--:-- 420 -db | * Connection #0 to host 127.0.0.1 left intact -db | * Trying 127.0.0.1... -db | % Total % Received % Xferd Average Speed Time Time Time Current -db | Dload Upload Total Spent Left Speed - 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 8091 (#0) -db | * Server auth using Basic with user 'Administrator' -db | > POST /sampleBuckets/install HTTP/1.1 -db | > Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA== -db | > User-Agent: curl/7.40.0-DEV -db | > Host: 127.0.0.1:8091 -db | > Accept: */* -db | > Content-Length: 17 -db | > Content-Type: application/x-www-form-urlencoded -db | > -db | } [17 bytes data] -db | * upload completely sent off: 17 out of 17 bytes -mywildfly_1 | 01:07:12,169 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-1) JNDI bindings for session bean named Database in deployment unit deployment "airlines.war" are as follows: -mywildfly_1 | -mywildfly_1 | java:global/airlines/Database!org.couchbase.sample.javaee.Database -mywildfly_1 | java:app/airlines/Database!org.couchbase.sample.javaee.Database -mywildfly_1 | java:module/Database!org.couchbase.sample.javaee.Database -mywildfly_1 | java:global/airlines/Database -mywildfly_1 | java:app/airlines/Database -mywildfly_1 | java:module/Database -mywildfly_1 | -db | < HTTP/1.1 202 Accepted -db | < Server: Couchbase Server -db | < Pragma: no-cache -db | < Date: Wed, 23 Dec 2015 01:07:12 GMT -db | < Content-Type: application/json -db | < Content-Length: 2 -db | < Cache-Control: no-cache -db | < - 89 19 0 0 100 17 0 40 --:--:-- --:--:-- --:--:-- 46{ [2 b[]ytes data] -100 19 100 2 100 17 4 40 --:--:-- --:--:-- --:--:-- 45 -db | * Connection #0 to host 127.0.0.1 left intact -db | /entrypoint.sh couchbase-server -mywildfly_1 | 01:07:13,117 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) WFLYWELD0006: Starting Services for CDI deployment: airlines.war -mywildfly_1 | 01:07:13,333 INFO [org.jboss.weld.Version] (MSC service thread 1-2) WELD-000900: 2.2.16 (SP1) -mywildfly_1 | 01:07:13,609 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) WFLYWELD0009: Starting weld service for deployment airlines.war -mywildfly_1 | 01:07:17,929 INFO [com.couchbase.client.core.env.CoreEnvironment] (ServerService Thread Pool -- 65) ioPoolSize is less than 3 (1), setting to: 3 -mywildfly_1 | 01:07:17,931 INFO [com.couchbase.client.core.env.CoreEnvironment] (ServerService Thread Pool -- 65) computationPoolSize is less than 3 (1), setting to: 3 -mywildfly_1 | 01:07:18,389 INFO [com.couchbase.client.core.CouchbaseCore] (ServerService Thread Pool -- 65) CouchbaseEnvironment: {sslEnabled=false, sslKeystoreFile='null', sslKeystorePassword='null', queryEnabled=false, queryPort=8093, bootstrapHttpEnabled=true, bootstrapCarrierEnabled=true, bootstrapHttpDirectPort=8091, bootstrapHttpSslPort=18091, bootstrapCarrierDirectPort=11210, bootstrapCarrierSslPort=11207, ioPoolSize=3, computationPoolSize=3, responseBufferSize=16384, requestBufferSize=16384, kvServiceEndpoints=1, viewServiceEndpoints=1, queryServiceEndpoints=1, ioPool=NioEventLoopGroup, coreScheduler=CoreScheduler, eventBus=DefaultEventBus, packageNameAndVersion=couchbase-jvm-core/1.2.1 (git: 1.2.1), dcpEnabled=false, retryStrategy=BestEffort, maxRequestLifetime=75000, retryDelay=ExponentialDelay{growBy 1.0 MICROSECONDS; lower=100, upper=100000}, reconnectDelay=ExponentialDelay{growBy 1.0 MILLISECONDS; lower=32, upper=4096}, observeIntervalDelay=ExponentialDelay{growBy 1.0 MICROSECONDS; lower=10, upper=100000}, keepAliveInterval=30000, autoreleaseAfter=2000, bufferPoolingEnabled=true, tcpNodelayEnabled=true, mutationTokensEnabled=false, socketConnectTimeout=1000, queryTimeout=75000, viewTimeout=75000, kvTimeout=2500, connectTimeout=5000, disconnectTimeout=25000, dnsSrvEnabled=false} -mywildfly_1 | 01:07:20,059 INFO [com.couchbase.client.core.node.Node] (cb-io-1-1) Connected to Node db -mywildfly_1 | 01:07:21,273 INFO [com.couchbase.client.core.config.ConfigurationProvider] (cb-computations-3) Opened bucket travel-sample -mywildfly_1 | 01:07:24,932 INFO [org.jboss.resteasy.spi.ResteasyDeployment] (ServerService Thread Pool -- 65) Deploying javax.ws.rs.core.Application: class org.couchbase.sample.javaee.MyApplication -mywildfly_1 | 01:07:25,193 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 65) WFLYUT0021: Registered web context: /airlines -mywildfly_1 | 01:07:25,440 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "airlines.war" (runtime-name : "airlines.war") -mywildfly_1 | 01:07:25,995 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management -mywildfly_1 | 01:07:25,997 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990 -mywildfly_1 | 01:07:25,999 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) started in 29405ms - Started 313 of 493 services (221 services are lazy, passive or on-demand) ----- - -The log shows: - -. WildFly Application server has started -. Couchbase is configured using the REST API -. `airlines.war` application is deployed - -### Verify Application - -Access the application by invoking the REST API using `curl`: - -[source, text] ----- -curl http://dockerhost:8080/airlines/resources/airline -[{"travel-sample":{"country":"United States","iata":"Q5","callsign":"MILE-AIR","name":"40-Mile Air","icao":"MLA","id":10,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"TQ","callsign":"TXW","name":"Texas Wings","icao":"TXW","id":10123,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"A1","callsign":"atifly","name":"Atifly","icao":"A1F","id":10226,"type":"airline"}}, {"travel-sample":{"country":"United Kingdom","iata":null,"callsign":null,"name":"Jc royal.britannica","icao":"JRB","id":10642,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"ZQ","callsign":"LOCAIR","name":"Locair","icao":"LOC","id":10748,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"K5","callsign":"SASQUATCH","name":"SeaPort Airlines","icao":"SQH","id":10765,"type":"airline"}}, {"travel-sample":{"country":"United States","iata":"KO","callsign":"ACE AIR","name":"Alaska Central Express","icao":"AER","id":109,"type":"airline"}}, {"travel-sample":{"country":"United Kingdom","iata":"5W","callsign":"FLYSTAR","name":"Astraeus","icao":"AEU","id":112,"type":"airline"}}, {"travel-sample":{"country":"France","iata":"UU","callsign":"REUNION","name":"Air Austral","icao":"REU","id":1191,"type":"airline"}}, {"travel-sample":{"country":"France","iata":"A5","callsign":"AIRLINAIR","name":"Airlinair","icao":"RLA","id":1203,"type":"airline"}}] ----- - -Complete set of REST APIs for this application are explained at https://github.com/arun-gupta/couchbase-javaee. - -### Stop Services - -Stop the services as: - -[source, text] ----- -docker-compose stop -Stopping db ... done -Stopping attendees_mywildfly_1 ... done ----- - -### Remove Containers - -Stop the services as: - -[source, text] ----- -docker-compose rm -f -Going to remove db, attendees_mywildfly_1 -Removing db ... done -Removing attendees_mywildfly_1 ... done ----- - -### Scale Services - -https://github.com/arun-gupta/docker-java/issues/51 - diff --git a/chapters/docker-container.adoc b/chapters/docker-container.adoc deleted file mode 100644 index 9d11c29..0000000 --- a/chapters/docker-container.adoc +++ /dev/null @@ -1,344 +0,0 @@ -:imagesdir: images - -## Run a Container - -The first step in running any application on Docker is to run a container from an image. There are plenty of images available from the official Docker registry (aka https://hub.docker.com[Docker Hub]). To run any of them, you just have to ask the Docker Client to run it. The client will check if the image already exists on Docker Host. If it exists then it'll run it, otherwise the host will download the image and then run it. - -### Pull Image - -Let's first check, if any images are available: - -[source, text] ----- -docker images ----- - -At first, this list is empty. Now, let's get a vanilla `jboss/wildfly` image: - -[source, text] ----- -docker pull jboss/wildfly ----- - -By default, docker images are retrieved from https://hub.docker.com/[Docker Hub]. - -You can see, that Docker is downloading the image with it's different layers. - -[NOTE] -==== -In a traditional Linux boot, the Kernel first mounts the root File System as read-only, checks its integrity, and then switches the whole rootfs volume to read-write mode. -When Docker mounts the rootfs, it starts read-only, as in a traditional Linux boot, but then, instead of changing the file system to read-write mode, it takes advantage of a union mount to add a read-write file system over the read-only file system. In fact there may be multiple read-only file systems stacked on top of each other. Consider each one of these file systems as a layer. - -At first, the top read-write layer has nothing in it, but any time a process creates a file, this happens in the top layer. And if something needs to update an existing file in a lower layer, then the file gets copied to the upper layer and changes go into the copy. The version of the file on the lower layer cannot be seen by the applications anymore, but it is there, unchanged. - -We call the union of the read-write layer and all the read-only layers a _union file system_. - -.Docker Layers -image::plain-wildfly0.png[] -==== - -In our particular case, the https://github.com/jboss-dockerfiles/wildfly/blob/master/Dockerfile[jboss/wildfly] image extends the https://github.com/jboss-dockerfiles/base/blob/master/Dockerfile[jboss/base-jdk:7] image which adds the OpenJDK distribution on top of the https://github.com/jboss-dockerfiles/base/blob/master/Dockerfile[jboss/base] image. -The base image is used for all JBoss community images. It provides a base layer that includes: - -. A jboss user (uid/gid 1000) with home directory set to `/opt/jboss` -. A few tools that may be useful when extending the image or installing software, like unzip. - -The "`jboss/base-jdk:7`" image adds: - -. OpenJDK 7 distribution -. Adds a `JAVA_HOME` environment variable - -When the download is done, you can list the images again and will see the following: - -[source, text] ----- -docker images -REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE -jboss/wildfly latest e908c8c95a8b 5 days ago 581.5 MB ----- - -### Run Container - -#### Interactive Container - -Run WildFly container in an interactive mode. - -[source, text] ----- -docker run -it jboss/wildfly ----- - -This will show the output as: - -[source, text] ----- -========================================================================= - - JBoss Bootstrap Environment - - JBOSS_HOME: /opt/jboss/wildfly - - JAVA: /usr/lib/jvm/java/bin/java - - JAVA_OPTS: -server -XX:+UseCompressedOops -server -XX:+UseCompressedOops -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true - -========================================================================= - -OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 -00:44:43,895 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.3.Final -00:44:44,184 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final -00:44:44,267 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 9.0.0.Final (WildFly Core 1.0.0.Final) starting - -. . . - -00:46:54,241 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management -00:46:54,243 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990 -00:46:54,250 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 9.0.0.Final (WildFly Core 1.0.0.Final) started in 4256ms - Started 203 of 379 services (210 services are lazy, passive or on-demand) ----- - -This shows that the server started correctly, congratulations! - -By default, Docker runs in the foreground. `-i` allows to interact with the STDIN and `-t` attach a TTY to the process. Switches can be combined together and used as `-it`. - -Hit Ctrl+C to stop the container. - -#### Detached Container - -Restart the container in detached mode: - -[source, text] ----- -docker run -d jboss/wildfly -972f51cc8422eec0a7ea9a804a55a2827b5537c00a6bfd45f8646cb764bc002a ----- - -`-d`, instead of `-it`, runs the container in detached mode. - -The output is the unique id assigned to the container. Check the logs as: - -[source, text] ----- -> docker logs 972f51cc8422eec0a7ea9a804a55a2827b5537c00a6bfd45f8646cb764bc002a -========================================================================= - - JBoss Bootstrap Environment - - JBOSS_HOME: /opt/jboss/wildfly - -. . . ----- - -We can check it by issuing the `docker ps` command which retrieves the images process which are running and the ports engaged by the process: - -[source, text] ----- -> docker ps -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -922abbb9c63a jboss/wildfly "/opt/jboss/wildfly/ 3 seconds ago Up 2 seconds 8080/tcp desperate_lovelace ----- - -Also try `docker ps -a` to see all the containers on this machine. - -### Run Container with Default Port - -Startup log of the server shows that the server is located in the `/opt/jboss/wildfly`. It also shows that the public interfaces are bound to the `0.0.0.0` address while the admin interfaces are bound just to `localhost`. This information will be useful to learn how to customize the server. - -`docker-machine ip ` gives us the Docker Host IP address and this was already added to the hosts file. So, we can give it another try by accessing: http://dockerhost:8080. However, this will not work either. - -If you want containers to accept incoming connections, you will need to provide special options when invoking `docker run`. The container, we just started, can't be accessed by our browser. We need to stop it again and restart with different options. - -[source, text] ----- -docker stop `docker ps | grep wildfly | awk '{print $1}'` ----- - -Restart the container as: - -[source, text] ----- -docker run -d -P jboss/wildfly ----- - -`-P` map any exposed ports inside the image to a random port on Docker host. This can be verified as: - -[source, text] ----- -> docker ps -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -63a69bff9c69 jboss/wildfly "/opt/jboss/wildfly/ 14 seconds ago Up 13 seconds 0.0.0.0:32768->8080/tcp kickass_bohr ----- - -The port mapping is shown in the `PORTS` column. Access the WildFly server at http://dockerhost:32768. Make sure to use the correct port number as shown in your case. - -NOTE: Exact port number may be different in your case. - -### Run Container with Specified Port - -Lets stop the previously running container as: - -[source, text] ----- -docker stop `docker ps | grep wildfly | awk '{print $1}'` ----- - -Restart the container as: - -[source, text] ----- -docker run -it -p 8080:8080 jboss/wildfly ----- - -The format is `-p hostPort:containerPort`. This option maps container ports to host ports and allows other containers on our host to access them. - -.Docker Port Mapping -[NOTE] -=============================== -Port exposure and mapping are the keys to successful work with Docker. -See more about networking on the Docker website link:https://docs.docker.com/articles/networking/[Advanced Networking] -=============================== - -Now we're ready to test http://dockerhost:8080 again. This works with the exposed port, as expected. - -.Welcome WildFly -image::plain-wildfly1.png[] - -### Stop Container - -. Stop a specific container: -+ -[source, text] ----- -docker stop ----- -+ -. Stop all the running containers -+ -[source, text] ----- -docker stop $(docker ps -q) ----- -+ -. Stop only the exited containers -+ -[source, text] ----- -docker ps -a -f "exited=-1" ----- - -### Remove Container - -. Remove a specific container: -+ -[source, text] ----- -docker rm 0bc123a8ece0 ----- -+ -. Remove containers meeting a regular expression -+ -[source, text] ----- -docker ps -a | grep wildfly | awk '{print $1}' | xargs docker rm ----- -+ -. Remove all containers, without any criteria -+ -[source, text] ----- -docker rm $(docker ps -aq) ----- - -[[Enabling_WildFly_Administration]] -### Enable WildFly Administration (Optional) - -Default WildFly image exposes only port 8080 and thus is not available for administration using either the CLI or Admin Console. Lets expose the ports in different ways. - -#### Default Port Mapping - -The following command will override the default command in Docker file, start WildFly, and bind application and management port to all network interfaces. - -[source, text] ----- -docker run -P -d jboss/wildfly /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0 ----- - -Accessing WildFly Administration Console require a user in administration realm. A pre-created image, with appropriate username/password credentials, is used to start WildFly as: - -[source, text] ----- -docker run -P -d arungupta/wildfly-management ----- - -`-P` map any exposed ports inside the image to a random port on Docker host. - -Look at the exposed ports as: - -[source, text] ----- -docker ps -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -af7d6914a1f9 arungupta/wildfly-management "/opt/jboss/wildfly/ 2 seconds ago Up 1 seconds 0.0.0.0:32770->8080/tcp, 0.0.0.0:32769->9990/tcp happy_bardeen ----- - -Look for the host port that is mapped in the container, `32769` in this case. Access the admin console at http://dockerhost:32769. - -NOTE: Exact port number may be different in your case. - -The username/password credentials are: - -[[WildFly_Administration_Credentials]] -[options="header"] -|==== -| Field | Value -| Username | admin -| Password | docker#admin -|==== - -This shows the admin console as: - -.Welcome WildFly -image::wildfly-admin-console.png[] - -##### Additional Ways To Find Port Mapping - -The exact mapped port can also be found as: - -. Using `docker port`: -+ -[source, text] ----- -docker port 6f610b310a46 ----- -+ -to see the output as: -+ -[source, text] ----- -0.0.0.0:32769->8080/tcp -0.0.0.0:32770->9990/tcp ----- -+ -. Using `docker inspect`: -+ -[source, text] ----- -docker inspect --format='{{(index (index .NetworkSettings.Ports "9990/tcp") 0).HostPort}}' ----- - -[[Management_Fixed_Port_Mapping]] -#### Fixed Port Mapping - -This management image can also be started with a pre-defined port mapping as: - -[source, text] ----- -docker run -p 8080:8080 -p 9990:9990 -d arungupta/wildfly-management ----- - -In this case, Docker port mapping will be shown as: - -[source, text] ----- -8080/tcp -> 0.0.0.0:8080 -9990/tcp -> 0.0.0.0:9990 ----- diff --git a/chapters/docker-continuous-delivery.adoc b/chapters/docker-continuous-delivery.adoc deleted file mode 100644 index 722aab4..0000000 --- a/chapters/docker-continuous-delivery.adoc +++ /dev/null @@ -1,4 +0,0 @@ -## Continuous Delivery Using Docker - -https://github.com/jbossdemocentral/continuous-delivery-demo -https://github.com/amorena/democdonpaas \ No newline at end of file diff --git a/chapters/docker-deployment-options.adoc b/chapters/docker-deployment-options.adoc deleted file mode 100644 index 99b8733..0000000 --- a/chapters/docker-deployment-options.adoc +++ /dev/null @@ -1,221 +0,0 @@ -:imagesdir: images - -## Build and Deploy Java EE 7 Application - -https://github.com/javaee-samples/javaee7-simple-sample[Java EE 7 Simple Sample] is a trivial Java EE 7 sample application. - -[[Build_Application]] -### Build Application - -. Clone the repo: - - git clone https://github.com/javaee-samples/javaee7-simple-sample.git - -. Build the application: - - mvn clean package - -### Start Application Server - -Start WildFly server as: - -[source, text] ----- -docker run --name wildfly -d -p 8080:8080 -v /Users/youruser/javaee7-simple-sample/target:/opt/jboss/wildfly/standalone/deployments/:rw jboss/wildfly ----- - -Make sure to replace `/Users/youruser/javaee7-simple-sample/target` to the target directory of your checked out project. - -This command starts a container named "`wildfly`". - -The `-v` flag maps a directory from the host into the container. This will be the directory to put the deployments. `rw` ensures that the Docker container can write to it. - -WARNING: Windows users, please make sure to use `-v /c/Users/` notation for drive letters. - -Check logs to verify if the server has started. - -[source, text] ----- -docker logs -f wildfly ----- - -Access http://dockerhost:8080 in your browser to make sure the instance is up and running. - -Now you're ready to deploy the application for the first time. - -### Configure JBoss Developer Studio - -Start JBoss Developer Studio, if not already started. - -. Select '`Servers`' tab, create a new server adapter -+ -.Server adapter -image::jbds1.png[] -+ -. Assign an existing or create a new WildFly 9.0.0 runtime (changed properties are highlighted.) -+ -.WildFly Runtime Properties -image::jbds2.png[] -+ -. If a new runtime needs to be created, pick the directory for WildFly 9.0.0: -+ -.WildFly 9.0.0.Final Runtime -image::jbds3.png[] -+ -Click on '`Finish`'. -+ -. Double-click on the newly selected server to configure server properties: -+ -.Server properties -image::jbds4.png[] -+ -The host name is specified to '`dockerhost`'. Two properties on the left are automatically propagated from the previous dialog. Additional two properties on the right side are required to disable to keep deployment scanners in sync with the server. -+ -. Specify a custom deployment folder on Deployment tab of Server Editor -+ -.Custom deployment folder -image::jbds5.png[] -+ -. Right-click on the newly created server adapter and click '`Start`'. -+ -.Started server -image::jbds6.png[] - -### Deploy Application Using Shared Volumes - -. Import javaee7-simple-sample application source code using Import -> Existing Maven Projects. -. Right-click on the project, select '`Run on Server`' and chose the previously created server. - -The project runs and displays the start page of the application. - -.Start Server -image::jbds7.png[] - -Congratulations! - -You've deployed your first application to WildFly running in a Docker container from JBoss Developer Studio. - -Stop WildFly container when you're done. - - docker stop wildfly - -### Deploy Application Using CLI - -The Command Line Interface (CLI) is a tool for connecting to WildFly instances to manage all tasks from command line environment. Some of the tasks that you can do using the CLI are: - -. Deploy/Undeploy web application in standalone/Domain Mode. -. View all information about the deployed application on runtime. -. Start/Stop/Restart Nodes in respective mode i.e. Standalone/Domain. -. Adding/Deleting resource or subsystems to servers. - -Lets use the CLI to deploy javaee7-simple-sample to WildFly running in the container. - -. CLI needs to be locally installed and comes as part of WildFly. This should be available in the previously downloaded WildFly. Unzip into a folder of your choice (e.g. `/Users/arungupta/tools/`). This will create `wildfly-9.0.0.Final` directory here. This folder is referred to $WIDLFY_HOME from here on. Make sure to add the `/Users/arungupta/tools/wildfly-9.0.0.Final/bin` to your $PATH. -+ -. Run the "`wildfly-management`" image with fixed port mapping as explained in <>. -. Run the `jboss-cli` command and connect to the WildFly instance. -+ -[source, text] ----- -jboss-cli.sh --controller=dockerhost:9990 -u=admin -p=docker#admin -c ----- -+ -This will show the output as: -+ -[source, text] ----- -[standalone@dockerhost:9990 /] ----- -+ -. Deploy the application as: -+ -[source, text] ----- -deploy target/javaee7-simple-sample-1.10.war --force ----- - -Now you've sucessfully used the CLI to remote deploy the Java EE 7 sample application to WildFly running as docker container. - -### Deploy Application Using Web Console - -WildFly comes with a web-based administration console. It also relies on the same management APIs that are used by JBoss Developer Tools and the CLI. It provides a simple and easy to use web-based console to manage WildFly instance. For a Docker image, it needs to be explicitly enabled as explained in <>. Once enabled, it can be accessed at http://dockerhost:9990. - -.WildFly Web Console -image::console1.png[] - -Username and password credentials are shown in <>. - -[NOTE] -==== -You may like to stop and remove the Docker container running WildFly. This can be done as `docker ps -a | grep wildfly | awk '{print $1}' | xargs docker rm -f`. - -Start a new container as `docker run -d --name wildfly -p 8080:8080 -p 9990:9990 arungupta/wildfly-management`. -==== - -Deploy the application using the console with the following steps: - -. Go to '`Deployments`' tab. -+ -.Deployments tab in WildFly Web Console -image::wildfly9-deployments-tab.png[] -+ -. Click on '`Add`' button. -. On '`Add Deployment`' screen, take the default of '`Upload a new deployment`' and click '`Next>>`'. -. Click on '`Choose File`', select `/javaee7-simple-sample.war` file on your computer. This would be `javaee7-simple-sample/target/javaee7-simple-sample.war` from <>. -. Click on '`Next>>`'. -. Select '`Enable`' checkbox. -+ -.Enable a deployment -image::wildfly9-add-deployments.png[] -+ -. Click '`Finish`'. -+ -.Java EE 7 Simple Sample Deployed -image::wildfly9-javaee7-simple-sample-deployed.png[] - -This will complete the deployment of the Java EE 7 application using Web Console. The output can be seen out http://dockerhost:8080/javaee7-simple-sample and looks like: - -.Java EE 7 Simple Sample Output -image::wildfly9-javaee7-simple-sample-output.png[] - -### Deploy Application Using Management API - -A standalone WildFly process, process can be configured to listen for remote management requests using its "`native management interface`". The CLI tool that comes with the application server uses this interface, and user can develop custom clients that use it as well. By default, WildFly management interface listens on 127.0.0.1. When running inside a Docker container, the network interface should be bound to all publicly assigned addresses. This can be easily changed by biding to 0.0.0.0 instead of 127.0.0.1. - -. Start another WildFly instance again: -+ -[source, text] ----- -docker run -d --name wildfly -p 8080:8080 -p 9990:9990 arungupta/wildfly-management ----- -+ -In addition to application port 8080, the administration port 9990 is exposed as well. The WildFly image that is used has tweaked the start script such that the management interface is bound to 0.0.0.0. -+ -. Create a new server adapter in JBoss Developer Studio and name it "`WildFly 9.0.0-Management`". Specify the host name as '`dockerhost`'. -+ -image::jbds8.png[] -+ -. Click on '`Next>`' and change the values as shown. -+ -.Create New Server Adapter -image::jbds9.png[] -+ -. Take the default values in '`Remote System Integration`' and click on '`Finish`'. -+ -. Change server properties by double clicking on the newly created server adapter. Specify admin credentials (username: docker, password: docker#admin). Note, you need to delete the existing password and use this instead: -+ -.Management Login Credentials -image::jbds10.png[] -+ -. Right-click on the newly created server adapter and click '`Start`'. Status quickly changes to '`Started`' as shown. -+ -.Synchronized WildFly Server -image::jbds11.png[] -+ -. Right-click on the javaee7-simple-sample project, select '`Run on Server`' and choose this server. The project runs and displays the start page of the application. -. Stop WildFly when you're done. -+ -[source, text] ----- -docker stop wildfly ----- diff --git a/chapters/docker-eclipse.adoc b/chapters/docker-eclipse.adoc deleted file mode 100644 index be6c554..0000000 --- a/chapters/docker-eclipse.adoc +++ /dev/null @@ -1,145 +0,0 @@ -:imagesdir: images - -## Docker Tools in Eclipse - -The Docker tooling is aimed at providing at minimum the same basic level features as the command-line interface, but also provide some advantages by having access to a full fledged UI. - -### Install Docker Tools Plugins - -As this is still in early access stage, you will have to install it first: - -. Use JBoss Developer Studio 9.0 Beta 2. -+ -Alternatively, download http://www.eclipse.org/downloads/index-developer-default.php[Eclipse Mars latest build] and configure JBoss Tools plugin from the update site http://download.jboss.org/jbosstools/updates/nightly/mars/. -+ -. Open JBoss Developer Studio 9.0 Nightly -. Add a new site using the menu items: '`Help`' > '`Install New Software...`' > '`Add...`'. -+ -Specify the '`Name:`' as "`Docker Nightly`" and '`Location:`' as http://download.eclipse.org/linuxtools/updates-docker-nightly/. -+ -.Add Docker Tooling To JBoss Developer Studio -image::jbds-docker-tools1.png[] -+ -. Expand Linux Tools, select '`Docker Client`' and '`Docker Tooling`'. -+ -.Add Docker Tooling -image::jbds-docker-tools-nightly-setup.png[] -+ -. Click on '`Next >`', '`Next >`', accept the terms of the license agreement, and click on '`Finish`'. This will complete the installation of plugins. -+ -Restart the IDE for the changes to take effect. - -### Docker Explorer - -The Docker Explorer provides a wizard to establish a new connection to a Docker daemon. This wizard can detect default settings if the user’s machine runs Docker natively (such as in Linux) or in a VM using Boot2Docker (such as in Mac or Windows). Both Unix sockets on Linux machines and the REST API on other OSes are detected and supported. The wizard also allows remote connections using custom settings. - -. Use the menu '`Window`', '`Show View`', '`Other...`'. Type '`docker`' to see the output as: -+ -image::jbds-docker-tools-docker-view.png[] -+ -. Select '`Docker Explorer`' to open Docker Explorer. -+ -image::jbds-docker-tools-docker-explorer-view.png[] -+ -. Click on the link in this window to create a connection to Docker Host. Specify the settings as shown: -+ -.Docker Explorer -image::jbds-docker-tools2.png[] -+ -Make sure to get IP address of the Docker Host as: -+ -[source, text] ----- -docker-machine ip default ----- -+ -Also, make sure to specify the correct directory for `.docker` on your machine. -+ -. Click on '`Test Connection`' to check the connection. This should show the output as: -+ -.Docker Explorer -image::jbds-docker-tools-test-connection-output.png[] -+ -Click on '`OK`' and '`Finish`' to exit out of the wizard. -+ -. Docker Explorer itself is a tree view that handles multiple connections and provides users with quick overview of the existing images and containers. -+ -.Docker Explorer Tree View -image::jbds-docker-tools3.png[] -+ -. Customize the view by clicking on the arrow in toolbar: -+ -.Docker Explorer Customize View -image::jbds-docker-tools-customize-view-option.png[] -+ -Built-in filters can show/hide intermediate and '`dangling`' images, as well as stopped containers. -+ -.Docker Explorer Customize View Wizard -image::jbds-docker-tools-customize-view-wizard.png[] - -### Docker Images - -The Docker Images view lists all images in the Docker host selected in the Docker Explorer view. This view allows user to manage images, including: - -. Pull/push images from/to the Docker Hub Registry (other registries will be supported as well, https://bugs.eclipse.org/bugs/show_bug.cgi?id=469306[#469306]) -. Build images from a Dockerfile -. Create a container from an image - -Lets take a look at it. - -. Use the menu '`Window`', '`Show View`', '`Other...`', select '`Docker Images`'. It shows the list of images on Docker Host: -+ -.Docker Images View -image::jbds-docker-tools4.png[] -+ -. Right-click on the image ending with "`wildfly:latest`" and click on the green arrow in the toolbar. This will show the following wizard: -+ -.Docker Run Container Wizard -image::jbds-docker-tools-run-container-wizard.png[] -+ -By default, all exports ports from the image are mapped to random ports on the host interface. This setting can be changed by unselecting the first checkbox and specify exact port mapping. -+ -Click on '`Finish`' to start the container. -+ -. When the container is started, all logs are streamed into Eclipse Console: -+ -.Docker Container Logs -image::jbds-docker-tools5.png[] - -### Docker Containers - -Docker Containers view lets the user manage the containers. The view toolbar provides commands to start, stop, pause, unpause, display the logs and kill containers. - -. Use the menu '`Window`', '`Show View`', '`Other...`', select '`Docker Containers`'. It shows the list of running containers on Docker Host: -+ -.Docker Containers View -image::jbds-docker-tools6.png[] -+ -. Pause the container by clicking on the "`pause`" button in the toolbar (https://bugs.eclipse.org/bugs/show_bug.cgi?id=469310[#469310]). Show the complete list of containers by clicking on the '`View Menu`', '`Show all containers`'. -+ -.All Docker Containers -image::jbds-docker-tools-all-containers.png[] -+ -. Select the paused container, and click on the green arrow in the toolbar to restart the container. -. Right-click on any running container and select "`Display Log`" to view the log for this container. -+ -.Eclipse Properties View -image::jbds-docker-tools-display-log.png[] - -TODO: Users can also attach an Eclipse console to a running Docker container to follow the logs and use the STDIN to interact with it. - -### Details on Images and Containers - -Eclipse Properties view is used to provide more information about the containers and images. - -. Just open the Properties View and click on a Connection, Container, or Image in any of the Docker Explorer View, Docker Containers View, or Docker Images View. This will fill in data in the Properties view. -+ -Info view is shown as: -+ -.Docker Container Properties View Info -image::jbds-docker-tools-properties-info.png[] -+ -Inspect view is shown as: -+ -.Docker Container Properties View Inspect -image::jbds-docker-tools-properties-inspect.png[] diff --git a/chapters/docker-image.adoc b/chapters/docker-image.adoc deleted file mode 100644 index 93cb300..0000000 --- a/chapters/docker-image.adoc +++ /dev/null @@ -1,187 +0,0 @@ -:imagesdir: images - -== Build a Docker Image - -*PURPOSE*: This chapter explains how to create a Docker image. - -As explained in <>, Docker image is the *build component* of Docker and a read-only template of application operating system. - -=== Dockerfile - -Docker build images by reading instructions from a _Dockerfile_. A _Dockerfile_ is a text document that contains all the commands a user could call on the command line to assemble an image. `docker build` command uses this file and executes all the commands in succession to create an image. - -`build` command is also passed a context that is used during image creation. This context can be a path on your local filesystem or a URL to a Git repository. - -_Dockerfile_ is usually called _Dockerfile_. The complete list of commands that can be specified in this file are explained at https://docs.docker.com/reference/builder/. The common commands are listed below: - -.Common commands for Dockerfile -[width="100%", options="header", cols="1,4,4"] -|================== -| Command | Purpose | Example -| FROM | First non-comment instruction in _Dockerfile_ | `FROM ubuntu` -| COPY | Copies mulitple source files from the context to the file system of the container at the specified path | `COPY .bash_profile /home` -| ENV | Sets the environment variable | `ENV HOSTNAME=test` -| RUN | Executes a command | `RUN apt-get update` -| CMD | Defaults for an executing container | `CMD ["/bin/echo", "hello world"]` -| EXPOSE | Informs the network ports that the container will listen on | `EXPOSE 8093` -|================== - -=== Create your first Docker image - -. Create a new directory. -. Create a new text file, name it _Dockerfile_, and use the following contents: -+ -[source, text] ----- -FROM ubuntu - -CMD ["/bin/echo", "hello world"] ----- -+ -This image uses `ubuntu` as the base image. `CMD` command defines the command that needs to run. It provides a different entry point of `/bin/echo` and gives the argument "`hello world`". -+ -. Build this image: -+ -```console -> docker build -t helloworld . -Sending build context to Docker daemon 2.048 kB -Step 0 : FROM ubuntu -Pulling repository docker.io/library/ubuntu -a5a467fddcb8: Download complete -3fd0c2ae8ed2: Download complete -9e19ac89d27c: Download complete -ac65c371c3a5: Download complete -Status: Downloaded newer image for ubuntu:latest - ---> a5a467fddcb8 -Step 1 : CMD /bin/echo hello world - ---> Running in 132bb0bf823f - ---> e81a394f71e3 -Removing intermediate container 132bb0bf823f -Successfully built e81a394f71e3 -``` -+ -`.` in this command is the context for `docker build`. -+ -. List the images available: -+ -```console -> docker images -REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE -helloworld latest 9c0e7b56cbee 13 minutes ago 187.9 MB -``` -+ -. Run the container: -+ - docker run helloworld -+ -to see the output: -+ - hello world -+ -. Change the base image from `ubuntu` to `busybox` in `Dockerfile`. Build the image again: -+ - docker build -t helloworld2 . -+ -and view the images as: -+ -```console -> docker images -REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE -helloworld latest e81a394f71e3 26 minutes ago 187.9 MB -helloworld2 latest c458787fadcf 3 seconds ago 1.113 MB -ubuntu latest a5a467fddcb8 2 days ago 187.9 MB -busybox latest 3d5bcd78e074 4 days ago 1.113 MB -``` - -=== WildFly Image - -. Create a new directory. -. Create a new text file, name it _Dockerfile_, and use the following contents: -+ -[source, text] ----- -FROM jboss/wildfly ----- -+ -. Build the image: -+ - docker build -t mywildfly . -+ -. Run the container: -+ - docker run -it mywildfly -+ -NOTE: On Windows, you may have to use `winpty` so that TTY can be attached. The updated command will be `winpty docker run -it mywildfly`. - -=== Java EE 7 Application Image - -. Create a new directory. -. Create a new text file, name it _Dockerfile_, and use the following contents: -+ -[source, text] ----- -FROM jboss/wildfly <1> - -CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-c", "standalone-full.xml", "-b", "0.0.0.0"] <2> - -RUN curl -L https://github.com/javaee-samples/javaee7-hol/raw/master/solution/movieplex7-1.0-SNAPSHOT.war -o /opt/jboss/wildfly/standalone/deployments/movieplex7-1.0-SNAPSHOT.war <3> ----- -+ -Three things in this image: -+ -<1> Uses "`jboss/wildfly`" as the base image -<2> Starts WildFly application server in Full Platform mode -<3> Copies the WAR file from from a URL to the deployment directory of WildFly -+ -. Build the image: - - docker build -t movieplex . - -=== Dockerfile Command Design Patterns - -==== Difference between CMD and ENTRYPOINT - -*TL;DR* `CMD` will work for most of the cases. - -Default entry point for a container is `/bin/sh`, the default shell. - -Running a container as `docker run -it ubuntu` uses that command and starts the default shell. The output is shown as: - -```console -> docker run -it ubuntu -root@88976ddee107:/# -``` - -`ENTRYPOINT` allows to override the entry point to some other command, and even customize it. For example, a container can be started as: - -```console -> docker run -it --entrypoint=/bin/cat ubuntu /etc/passwd -root:x:0:0:root:/root:/bin/bash -daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin -bin:x:2:2:bin:/bin:/usr/sbin/nologin -sys:x:3:3:sys:/dev:/usr/sbin/nologin -. . . -``` - -This command overrides the entry point to the container to `/bin/cat`. The argument(s) passed to the CLI are used by the entry point. - -==== Difference between ADD and COPY - -*TL;DR* `COPY` will work for most of the cases. - -`ADD` has all capabilities of `COPY` and has the following additional features: - -. Allows tar file auto-extraction in the image, for example, `ADD app.tar.gz /opt/var/myapp`. -. Allows files to be downloaded from a remote URL. However, the downloaded files will become part of the image. This causes the image size to bloat. So its recommended to use `curl` or `wget` to download the archive explicitly, extract, and remove the archive. - -==== Import and export images - -Docker images can be saved using `save` command to a .tar file: - - docker save helloworld > helloworld.tar - -These tar files can then be imported using `load` command: - - docker load -i helloworld.tar - - diff --git a/chapters/docker-intellij.adoc b/chapters/docker-intellij.adoc deleted file mode 100644 index 8e22276..0000000 --- a/chapters/docker-intellij.adoc +++ /dev/null @@ -1,5 +0,0 @@ -:imagesdir: images - -## Docker Tools in IntelliJ - -http://blog.jetbrains.com/idea/2015/03/docker-support-in-intellij-idea-14-1/ diff --git a/chapters/docker-javaee7.adoc b/chapters/docker-javaee7.adoc deleted file mode 100644 index 10074a4..0000000 --- a/chapters/docker-javaee7.adoc +++ /dev/null @@ -1,191 +0,0 @@ -:imagesdir: images - -[[JavaEE7_PreBuilt_WAR]] -## Deploy Java EE 7 Application - -https://github.com/javaee-samples/javaee7-hol[Java EE 7 Movieplex] is a standard multi-tier enterprise application that shows design patterns and anti-patterns for a typical Java EE 7 application. - -.Java EE 7 Application Architecture -image::javaee7-hol.png[] - -This section explains how this application can be deployed in a Docker container using a pre-built WAR in two different ways: - -. Using in-memory database in WildFly -. Using container linking to link WildFly and MySQL database - -And then it will cover how to test such applications. - -### Deploy Using Pre-Built WAR - -Pull the Docker image that contains WildFly and pre-built Java EE 7 application WAR file as shown: - -[source, text] ----- -docker pull arungupta/javaee7-hol ----- - -The https://github.com/arun-gupta/docker-images/blob/master/javaee7-hol/Dockerfile[javaee7-hol Dockerfile] is based on `jboss/wildfly` and adds the movieplex7 application as war file. - -Run it: - -[source, text] ----- -docker run -it -p 8080:8080 arungupta/javaee7-hol ----- - -See the application in action at http://dockerhost:8080/movieplex7/. The output is shown: - -.Java EE 7 Application Output -image::javaee7-movieplex7.png[] - -This uses an in-memory database with WildFly application server as shown in the image: - -.In-memory Database -image::javaee7-hol-in-memory-database.png[] - -Only two changes are required to the standard `jboss/wildfly` image: - -. By default, WildFly starts in Web platform. This Java EE 7 application uses some capabilities from the Full Platform and so WildFly is started in that mode instead as: -+ -[source, text] ----- -CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-c", "standalone-full.xml", "-b", "0.0.0.0"] ----- -+ -. WAR file is copied to the `standalone/deployments` directory as: -+ -[source, text] ----- -RUN curl -L https://github.com/javaee-samples/javaee7-hol/raw/master/solution/movieplex7-1.0-SNAPSHOT.war -o /opt/jboss/wildfly/standalone/deployments/movieplex7-1.0-SNAPSHOT.war ----- - -### Deploy Using Container Linking - -<> explained how to use an in-memory database with the application server. This gets you started rather quickly but becomes a bottleneck soon as the database is only in-memory. This means that any changes made to your schema and data are lost when the application server shuts down. In this case, you need to use a database server that resides outside the application server. For example, MySQL as the database server and WildFly as the application server. - -.Two Containers On Same Docker Host -image::javaee7-hol-container-linking.png[] - -This section will show how https://docs.docker.com/userguide/dockerlinks/[Docker Container Linking] can be used to connect to a service running inside a Docker container via a network port. - -. Start MySQL server as: -+ -[source, text] ----- -docker run --name mysqldb -e MYSQL_USER=mysql -e MYSQL_PASSWORD=mysql -e MYSQL_DATABASE=sample -e MYSQL_ROOT_PASSWORD=supersecret -p 3306:3306 -d mysql ----- -+ -`-e` define environment variables that are read by the database at startup and allow us to access the database with this user and password. -+ -. Start WildFly and deploy Java EE 7 application as: -+ -[source, text] ----- -docker run -it --name mywildfly --link mysqldb:db -p 8080:8080 arungupta/wildfly-mysql-javaee7 ----- -+ -`--link` takes two parameters - first is name of the container we're linking to and second is the alias for the link name. -+ -.Container Linking -[NOTE] -=============================== -Creating a link between two containers creates a conduit between a source container and a target container and securely transfer information about source container to target container. - -In our case, target container (WildFly) can see information about source container (MySQL). When containers are linked, information about a source container can be sent to a recipient container. This allows the recipient to see selected data describing aspects of the source container. For example, IP address of MySQL server is expoed at $DB_PORT_3306_TCP_ADDR and port of MySQL server is exposed at $DB_PORT_3306_TCP_PORT. These are then used to create the JDBC resource. - -See more about container communication on the Docker website https://docs.docker.com/userguide/dockerlinks/[Linking Containers Together] -=============================== -+ -. See the output as: -+ -[source, text] ----- -> curl http://dockerhost:8080/employees/resources/employees -1Penny2Sheldon3Amy4Leonard5Bernadette6Raj7Howard8Priya ----- - -### Test Java EE 7 Application - -Testing Java EE applications is a very important aspect. Especially when it comes to in-container tests, http://www.arquillian.org[JBoss Arquillian] is well known to make this very easy for Java EE application servers. Picking up where unit tests leave off, Arquillian handles all the plumbing of container management, deployment and framework initialization so you can focus on the task at hand, writing your tests. - -With Arquillian, you can use http://arquillian.org/modules/wildfly-arquillian-wildfly-remote-container-adapter/[WildFly remote container adapter] and connect to any WildFly instance running in a Docker container. But this wouldn't help with the Docker container lifycycle management. - -http://arquillian.org/modules/cube-extension/[Arquillian Cube], an extension of Arquillian, allows you to control the lifecycle of Docker images as part of the test lifecyle, either automatically or manually. This extension allows to start a Docker container with a server installed, deploy the required deployable file within it and execute Arquillian tests. - -The key point here is that if Docker is used as deployable platform in production, your tests are executed in a the same container as it will be in production, so your tests are even more real than before. - -. Check out the workspace: -+ -[source, text] ----- -git clone http://github.com/javaee-samples/javaee-arquillian-cube ----- -+ -. Edit `src/test/resources/arquillian.xml` file and change the IP address specified in `serverUri` property value to point to your Docker host's IP. This can be found out as: -+ -[source, text] ----- -docker-machine ip lab ----- -+ -. Run the tests as: -+ -[source, text] ----- -mvn test ----- -+ -This will create a container using the image defined in `src/test/resources/wildfly/Dockerfile`. The container qualifier in `arquillian.xml` defines the directory name in `src/test/resources` directory. -+ -[NOTE] -==== -A pre-built image can be used by specifying: - - wildfly: - image: jboss/wildfly - -instead of - - wildfly: - buildImage: - dockerfileLocation: src/test/resources/wildfly -==== -+ -By default, the "`cube`" profile is activated and this includes all the required dependencies. -+ -The result is shown as: -+ -[source, text] ----- -Running org.javaee7.sample.PersonDatabaseTest -Jun 16, 2015 9:23:04 AM org.jboss.arquillian.container.impl.MapObject populate -WARNING: Configuration contain properties not supported by the backing object org.jboss.as.arquillian.container.remote.RemoteContainerConfiguration -Unused property entries: {target=wildfly:8.1.0.Final:remote} -Supported property names: [managementAddress, password, managementPort, managementProtocol, username] -Jun 16, 2015 9:23:13 AM org.xnio.Xnio -INFO: XNIO version 3.2.0.Beta4 -Jun 16, 2015 9:23:13 AM org.xnio.nio.NioXnio -INFO: XNIO NIO Implementation Version 3.2.0.Beta4 -Jun 16, 2015 9:23:13 AM org.jboss.remoting3.EndpointImpl -INFO: JBoss Remoting version (unknown) -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 16.406 sec - in org.javaee7.sample.PersonDatabaseTest - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -[INFO] ------------------------------------------------------------------------ -[INFO] BUILD SUCCESS -[INFO] ------------------------------------------------------------------------ ----- -+ -. In `arquillian.xml`, add the following property: -+ -[source, xml] ----- -STARTORCONNECT ----- -+ -This bypasses the create/start Cube commands if a Docker Container with the same name is already running on the target system. -+ -This allows you to prestart the containers manually during development and just connect to them to avoid the extra cost of starting the Docker Containers for each test run. This assumes you are not changing the actual definition of the Docker Container itself. diff --git a/chapters/docker-kubernetes-fabric8.adoc b/chapters/docker-kubernetes-fabric8.adoc deleted file mode 100644 index e262caa..0000000 --- a/chapters/docker-kubernetes-fabric8.adoc +++ /dev/null @@ -1,28 +0,0 @@ -:imagesdir: images - -== Kubernetes and Fabric8 -Fabric8 is a set of tools and services geared toward middleware and application developers that make it easy to develop microervices using Docker and Kubernetes. - -=== Fabic 8 Console - -The Fabric8 console is rich with visual diagrams showing what you've got deployed, where it's deployed, how many, and so on. You can also make changes to your kubernetes cluster (deploy apps, edit replica sizes, delete services, etc) from a single dashboard. Screen shots and demos to come. - - -=== Inject k8s resources using @Inject in Java EE client -Fabric8 has lots of java [libraries](http://fabric8.io/guide/javaLibraries.html) for making working with kubernetes and kubernetes resources easier. For example, there is a [kubernetes Java client](https://github.com/fabric8io/kubernetes-client) with a fluent DSL for interacting with the Kube API. More examples to come. - -=== Maven plugin to generate JSON for your WAR file and deploy it in k8s -Java developers are used to Maven and other tools in the Java ecosystem. Fabric8's maven plugins aim to bridge the gap between app development and the kubernetes cluster engine. With these plugins you can create docker images and control how they're created using Maven properties and plugin configurations. You can also generate the kubenetes JSON files, inject environment variables, and also apply the JSON directly to Kube. - -=== Built in CI/CD with workflow and promotion -Java developers eventually want to deploy their application. Fabric8 brings a set of curated, yet pluggable, services like Git, Jenkins, Nexus, Gerrit and integrates them together with an issue tracker, chat room, and flexible per-project configurations which allow you to set up CI/CD with proper gates and promotion practices with a single click or with a single yml file. - -=== Out of the box tooling for your Apache Camel apps -Apache Camel is a very powerful integration library and can be used along with Fabric8 and Kubernetes to provide an iPaaS. The tooling included in Fabric8 gives a UI based access to visualizations, debugging, tracing, metrics and indicators, etc. - -=== API management for your APIs -Accessing your services can become complicated if you consider token provisioning, authZ/authN, metering, chargeback, etc,etc. Fabric8 has built in API management for your APIs. - -=== Logging/Metrics for your apps built in -Fabric8 leverages InfluxDB/Grafana and Elasticsearch/Kibana for in-container metrics and logging that is valuable for any insight into what your apps or middleware are doing - diff --git a/chapters/docker-kubernetes.adoc b/chapters/docker-kubernetes.adoc deleted file mode 100644 index e439def..0000000 --- a/chapters/docker-kubernetes.adoc +++ /dev/null @@ -1,769 +0,0 @@ -:imagesdir: images - -## Deploy Application on Kubernetes Cluster - -[quote, github.com/GoogleCloudPlatform/kubernetes/] -Kubernetes is an open source system for managing containerized applications across multiple hosts, providing basic mechanisms for deployment, maintenance, and scaling of applications. - -Kubernetes, or "`k8s`" in short, allows the user to provide declarative primitives for the desired state, for example "`need 5 WildFly servers and 1 MySQL server running`". Kubernetes self-healing mechanisms, such as auto-restarting, re-scheduling, and replicating containers then ensure that this state is met. The user just define the state and Kubernetes ensures that the state is met at all times on the cluster. - -*How is it related to Docker?* - -Docker provides the lifecycle management of containers. A Docker image defines a build time representation of the runtime containers. There are commands to start, stop, restart, link, and perform other lifecycle methods on these containers. Kubernetes uses Docker to package, instantiate, and run containerized applications. - -*How does Kubernetes simplify containerized application deployment?* - -A typical application would have a cluster of containers across multiple hosts. For example, your web tier (for example Apache) might run as a few instances, and likely on a set of containers. Similarly, your application tier (for example, WildFly) would run on a different set of containers. The web tier would need to delegate the request to application tier. The web, application, and database tier would generally run on a separate set of containers. These containers would need to talk to each other. Using any of the solutions mentioned above would require scripting to start the containers, and monitoring/bouncing if something goes down. Kubernetes does all of that for the user after the application state has been defined. - -### Key Components - -At a very high level, there are three key components: - -. *Pods* are the smallest deployable units that can be created, scheduled, and managed. Its a logical collection of containers that belong to an application. -. *Master* is the central control point that provides a unified view of the cluster. There is a single master node that control multiple worker nodes. -. *Node* (née minion) is a worker node that run tasks as delegated by the master. Nodes can run one or more pods. It provides an application-specific "`virtual host`" in a containerized environment. - -A picture is always worth a thousand words and so this is a high-level logical block diagram for Kubernetes: - -.Kubernetes Key Components -image::kubernetes-key-components.png[] - -After the 50,000 feet view, lets fly a little lower at 30,000 feet and take a look at how Kubernetes make all of this happen. There are a few key components at Master and Node that make this happen. - -. *Replication Controller* is a resource at Master that ensures that requested number of pods are running on nodes at all times. -. *Service* is an object on master that provides load balancing across a replicated group of pods. -Label is an arbitrary key/value pair in a distributed watchable storage that the Replication Controller uses for service discovery. -. *Kubelet* Each node runs services to run containers and be managed from the master. In addition to Docker, Kubelet is another key service installed there. It reads container manifests as YAML files that describes a pod. Kubelet ensures that the containers defined in the pods are started and continue running. -. Master serves *RESTful Kubernetes API* that validate and configure Pod, Service, and Replication Controller. - -### Start Kubernetes Cluster - -Kubernetes cluster can be easily started using Vagrant. Start a Kubernetes cluster as explained in <>. - -#### Verify the Cluster - -. Verify the Kubernetes cluster as: -+ -[source, text] ----- -vagrant status -Current machine states: - -master running (virtualbox) -minion-1 running (virtualbox) - -This environment represents multiple VMs. The VMs are all listed -above with their current state. For more information about a specific -VM, run `vagrant status NAME`. ----- -+ -By default, the Vagrant setup will create a single Master and one node. Each VM will take 1 GB, so make sure you have at least 2GB to 4GB of free memory (plus appropriate free disk space). -+ -NOTE: By default, only one node is created. This can be manipulated by setting an environment variable NUM_MINIONS variable to an integer before invoking `kube-up.sh` script. -+ -.Kubernetes Cluster using Vagrant -image::kubernetes-cluster-vagrant.png[] -+ -By default, each VM in the cluster is running Fedora, Kubelet is installed into ``systemd'', and all other Kubernetes services are running as containers on Master. -+ -. Access https://10.245.1.2 (or whatever IP address is assigned to your kubernetes cluster start up log). This may present the warning as shown below: -+ -image::kubernetes-master-default-output-certificate.png[] -+ -Click on '`Advanced`', on '`Proceed to 10.245.1.2`', enter the username as '`vagrant`' and password as '`vagrant`' to see the output as: -+ -.Kubernetes Output from Master -image::kubernetes-master-default-output.png[] -+ -Check the list of nodes as: -+ -[source, text] ----- -./cluster/kubectl.sh get nodes -NAME LABELS STATUS AGE -10.245.1.3 kubernetes.io/hostname=10.245.1.3 Ready 1m ----- -+ -. Check the list of pods: -+ -[source, text] ----- -./cluster/kubectl.sh get po -NAME READY STATUS RESTARTS AGE ----- -+ -. Check the list of services running: -+ -[source, text] ----- -./cluster/kubectl.sh get svc -NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE -kubernetes 10.247.0.1 443/TCP 3m ----- -+ -. Check the list of replication controllers: -+ -[source, text] ----- -./cluster/kubectl.sh get rc -CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS ----- - -[[Deploy_JavaEE_Kubernetes_Multiple_Config]] -### Deploy Java EE Application (multiple configuration files) - -Pods, and the IP addresses assigned to them, are ephemeral. If a pod dies then Kubernetes will recreate that pod because of its self-healing features, but it might recreate it on a different host. Even if it is on the same host, a different IP address could be assigned to it. And so any application cannot rely upon the IP address of the pod. - -Kubernetes services is an abstraction which defines a logical set of pods. A service is typically back-ended by one or more physical pods (associated using labels), and it has a permanent IP address that can be used by other pods/applications. For example, WildFly pod can not directly connect to a Couchbase pod but can connect to Couchbase service. In essence, Kubernetes service offers clients an IP and port pair which, when accessed, redirects to the appropriate backends. - -.Kubernetes Service -image::kubernetes-service.png[] - -NOTE: In this case, all the pods are running on a single node. This is because, that is the default number for a Kubernetes cluster. The pod can be on another node if more number of nodes are configured to start in the cluster. - -Any Service that a Pod wants to access must be created before the Pod itself, or else the environment variables will not be populated. - -The order of Service and the targeted Pods does not matter. However Service needs to be started before any other Pods consuming the Service are started. - -#### Start Couchbase Pod - -. Start Couchbase Pod: -+ -[source, text] ----- -./cluster/kubectl.sh create -f ~/workspaces/docker-java/attendees/kubernetes/app-couchbase-pod.yaml -pod "couchbase-pod" created ----- -+ -It uses the following configuration file: -+ -[source, yaml] ----- -apiVersion: v1 -kind: Pod -metadata: - name: couchbase-pod - labels: - name: couchbase-pod - context: docker-k8s-lab -spec: - containers: - - - name: couchbase - image: arungupta/couchbase - ports: - - - containerPort: 8091 - containerPort: 8092 - containerPort: 8093 - containerPort: 11210 ----- -+ -`arungupta/couchbase` image starts Couchbase server, configures it using http://developer.couchbase.com/documentation/server/4.0/rest-api/rest-endpoints-all.html[Couchbase REST API], and loads a sample data bucket. -+ -. Get status of the Pod: -+ -[source, text] ----- -./cluster/kubectl.sh get -w po -NAME READY STATUS RESTARTS AGE -couchbase-pod 0/1 Pending 0 16s -NAME READY STATUS RESTARTS AGE -couchbase-pod 0/1 Running 0 40s -couchbase-pod 1/1 Running 0 40s ----- -+ -`-w` watches for changes to the requested object. Wait for the Couchbase pod to be in Running status. -+ -Hit `Ctrl` + `C` to terminate the watch. - -#### Start Couchbase service - -. Start Couchbase Service: -+ -[source, text] ----- -./cluster/kubectl.sh create -f ~/workspaces/docker-java/attendees/kubernetes/app-couchbase-service.yaml -service "couchbase-service" created ----- -+ -It uses the following configuration file: -+ -[source, yaml] ----- -apiVersion: v1 -kind: Service -metadata: - name: couchbase-service - labels: - name: couchbase-pod - context: docker-k8s-lab -spec: - ports: - # the port that this service should serve on - - name: admin - port: 8091 - - name: queries - port: 8092 - - name: rest - port: 8093 - - name: nodes - port: 11210 - # label keys and values that must match in order to receive traffic for this service - selector: - name: couchbase-pod - context: docker-k8s-lab ----- -+ -Once again, the label "`context: docker-k8s-lab`" is used. This simplifies querying the created pods later on. -+ -. Get status of the Service: -+ -[source, text] ----- -./cluster/kubectl.sh get svc -NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE -couchbase-service 10.247.202.53 8091/TCP,8092/TCP,8093/TCP,11210/TCP context=docker-k8s-lab,name=couchbase-pod 1m -kubernetes 10.247.0.1 443/TCP 32m ----- -+ -If multiple services are running, then it can be narrowed by specifying the labels: -+ -[source, text] ----- -./cluster/kubectl.sh get svc -l context=docker-k8s-lab,name=couchbase-pod -NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE -couchbase-service 10.247.202.53 8091/TCP,8092/TCP,8093/TCP,11210/TCP context=docker-k8s-lab,name=couchbase-pod 1m ----- -+ -This is also the selector label used by Service to target Pods. -+ -When a Service is run on a node, the kubelet adds a set of environment variables for each active Service. It supports both Docker links compatible variables and simpler `{SVCNAME}_SERVICE_HOST` and `{SVCNAME}_SERVICE_PORT` variables, where the Service name is upper-cased and dashes are converted to underscores. -+ -Our service name is "`couchbase-service`" and so `COUCHBASE_SERVICE_SERVICE_HOST` and `COUCHBASE_SERVICE_SERVICE_PORT` variables are available to other pods. - -Kubernetes also allows services to be resolved using DNS configuration. Send a Pull Request for adding this functionality to the lab as explained in https://github.com/javaee-samples/docker-java/issues/62[#62]. - -#### Start WildFly Replication Controller - -. Start WildFly replication controller: -+ -[source, text] ----- -./cluster/kubectl.sh create -f ~/workspaces/docker-java/attendees/kubernetes/app-wildfly-rc.yaml -replicationcontroller "wildfly-rc" created ----- -+ -It uses the following configuration file: -+ -[source, yaml] ----- -apiVersion: v1 -kind: ReplicationController -metadata: - name: wildfly-rc - labels: - name: wildfly - context: docker-k8s-lab -spec: - replicas: 1 - template: - metadata: - labels: - name: wildfly - spec: - containers: - - name: wildfly-rc-pod - image: arungupta/wildfly-couchbase-javaee7 - env: - - name: COUCHBASE_URI - value: $COUCHBASE_SERVICE_SERVICE_HOST - ports: - - containerPort: 8080 ----- -+ -. Check status of the Replication Controller: -+ -[source, text] ----- -./cluster/kubectl.sh get rc -CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS AGE -wildfly-rc wildfly-rc-pod arungupta/wildfly-mysql-javaee7:k8s name=wildfly 1 1m ----- -+ -. Check status of the Pod inside Replication Controller: -+ -[source, text] ----- -./cluster/kubectl.sh get -w po -NAME READY STATUS RESTARTS AGE -mysql-pod 1/1 Running 0 4m -wildfly-rc-ca1ug 0/1 Pending 0 1m -NAME READY STATUS RESTARTS AGE -wildfly-rc-ca1ug 0/1 Running 0 3m -wildfly-rc-ca1ug 1/1 Running 0 3m ----- -+ -. Use the Pod's name to get IP address: -+ -[source, text] ----- -./cluster/kubectl.sh get -o template po wildfly-rc-ca1ug --template={{.status.podIP}} -10.246.96.7 ----- - -[[Access_Kubernetes_Application_Node]] -#### Access the application (using node) - -. Log in to node: -+ -[source, text] ----- -vagrant ssh minion-1 ----- -+ -. Access the application using `curl http://10.246.96.7:8080/employees/resources/employees` and replace IP address with the one obtained earlier: -+ -[source, text] ----- -> vagrant ssh minion-1 -Last login: Sat Nov 21 01:02:52 2015 from 10.0.2.2 -[vagrant@kubernetes-minion-1 ~]$ curl http://10.246.96.7:8080/employees/resources/employees -1Penny2Sheldon3Amy4Leonard5Bernadette6Raj7Howard8Priya[vagrant@kubernetes-minion-1 ~] ----- -+ -. Log out of the minion -+ -[source, text] ----- -[vagrant@kubernetes-minion-1 ~]$ exit -logout -Connection to 127.0.0.1 closed. ----- - -[[Access_Kubernetes_Application_Proxy]] -#### Access the application (using proxy) - -Send a PR for https://github.com/javaee-samples/docker-java/issues/80 - -### Deploy Java EE Application (one configuration file) - -Kubernetes allow multiple resources to be specified in a single configuration file. This allows to create a "`Kubernetes Application`" that can consists of multiple resources easily. - -<> showed how to deploy the Java EE application using multiple configuration files. This application can be delpoyed using a single configuration file as well. - -. First delete the the existing pods and replication controller using the context label: -+ -[source, text] ----- -./cluster/kubectl.sh delete svc,po,replicationController -l context="docker-k8s-lab" -service "mysql-service" deleted -pod "mysql-pod" deleted -replicationcontroller "wildfly-rc" deleted ----- -+ -. Start the application using the configuration file: -+ -[source, yaml] -.... -apiVersion: v1 -kind: Pod -metadata: - name: mysql-pod - labels: - name: mysql-pod - context: docker-k8s-lab -spec: - containers: - - - name: mysql - image: mysql:latest - env: - - - name: "MYSQL_USER" - value: "mysql" - - - name: "MYSQL_PASSWORD" - value: "mysql" - - - name: "MYSQL_DATABASE" - value: "sample" - - - name: "MYSQL_ROOT_PASSWORD" - value: "supersecret" - ports: - - - containerPort: 3306 ----- -apiVersion: v1 -kind: Service -metadata: - name: mysql-service - labels: - name: mysql-pod - context: docker-k8s-lab -spec: - ports: - # the port that this service should serve on - - port: 3306 - # label keys and values that must match in order to receive traffic for this service - selector: - name: mysql-pod - context: docker-k8s-lab ----- -apiVersion: v1 -kind: ReplicationController -metadata: - name: wildfly-rc - labels: - name: wildfly - context: docker-k8s-lab -spec: - replicas: 1 - template: - metadata: - labels: - name: wildfly - spec: - containers: - - name: wildfly-rc-pod - image: arungupta/wildfly-mysql-javaee7:k8s - ports: - - containerPort: 8080 -.... -+ -Notice that each section, one each for MySQL Pod, MySQL Service, and WildFly Replication Controller, is separated by `----`. -+ -. Start the application: -+ -[source, text] ----- -./cluster/kubectl.sh create -f ~/workspaces/docker-java/attendees/kubernetes/app.yaml -pod "mysql-pod" created -service "mysql-service" created -replicationcontroller "wildfly-rc" created ----- -+ -. Access the application using <> or <>. - -### Rescheduling Pods - -Replication Controller ensures that specified number of pod "`replicas`" are running at any one time. If there are too many, the replication controller kills some pods. If there are too few, it starts more. - -WildFly Replication Controller is already running with one Pod. Lets delete this Pod and see how a new Pod is automatically rescheduled. - -. Find the Pod's name: -+ -[source, text] ----- -./cluster/kubectl.sh get po -NAME READY STATUS RESTARTS AGE -mysql-pod 1/1 Running 0 21s -wildfly-rc-l2cto 1/1 Running 0 21s ----- -+ -. Delete the Pod: -+ -[source, text] ----- -./cluster/kubectl.sh delete po wildfly-rc-l2cto -pod "wildfly-rc-l2cto" deleted ----- -+ -Status of the Pods can be seen: -+ -[source, text] ----- -./cluster/kubectl.sh get -w po -NAME READY STATUS RESTARTS AGE -mysql-pod 1/1 Running 0 1m -wildfly-rc-2o8vd 1/1 Running 0 13s -wildfly-rc-l2cto 1/1 Terminating 0 1m ----- -+ -Notice how Pod with name "`wildfly-rc-l2cto`" was deleted and a new Pod with the name "`wildfly-rc-2o8vd`" was created. The status "`Terminating`" does not update correctly and is filed as https://github.com/kubernetes/kubernetes/issues/17612. - -### Scaling Pods - -Replication Controller allows dynamic scaling up and down of Pods. - -. Scale up the number of Pods: -+ -[source, text] ----- -./cluster/kubectl.sh scale --replicas=2 rc wildfly-rc -replicationcontroller "wildfly-rc" scaled ----- -+ -. Status of the Pods can be seen in another shell: -+ -[source, text] ----- -./cluster/kubectl.sh get -w po -TBD ----- -+ -Pods are not scaled correctly as explained at https://github.com/kubernetes/kubernetes/issues/17613. -+ -TBD: Notice a new Pod with the name "`wildfly-rc-bymu7`" is created. -+ -. Scale down the number of Pods: -+ -[source, text] ----- -./cluster/kubectl.sh scale --replicas=1 rc wildfly-rc -scaled ----- -+ -. Status of the Pods using `-w` is not shown correctly https://github.com/GoogleCloudPlatform/kubernetes/issues/11338[#11338]. But status of the Pods can be seen correctly as: -+ -[source, text] ----- -./cluster/kubectl.sh get po -NAME READY STATUS RESTARTS AGE -wildfly-rc-bgtkg 1/1 Running 0 9m ----- -+ -Notice only one Pod is running now. - -### Couchbase Cluster and Persistent Volumes - -A _Kubernetes Volume_ outlives any containers that run within the Pod, and data is preserved across Container restarts. However the volume will cease to exist when a Pod ceases to exist. This is solved by _Persistent Volumes_ that provide persistent, cluster-scoped storage for applications that require long lived data. - -Creating and using a persistent volume is a three step process: - -. Administrator provision a _networked storage in the cluster_. This is called as `PersistentVolume`. -. User requests storage for pods by using _claims_. Claims can specify levels of resources (CPU and memory), specific sizes and access modes (e.g. can be mounted once read/write or many times write only). This is called as `PersistentVolumeClaim`. -. Claims are mounted as volumes and used in pods for storage. - -#### Create Kubernetes resources - -. Create persistent volume: -+ -```console -./cluster/kubectl.sh create -f ~/workspaces/docker-java/attendees/kubernetes/couchbase-pv.yaml -persistentvolume "pv001" created -``` -+ -. Create a claim for volume: -+ -```console -./cluster/kubectl.sh create -f ~/workspaces/docker-java/attendees/kubernetes/couchbase-pvc.yaml -persistentvolumeclaim "pvc001" created -``` -+ -. Start the Couchbase Replication Controller (claim is used in Pod's definition): -+ -```console -./cluster/kubectl.sh create -f ~/workspaces/docker-java/attendees/kubernetes/couchbase-rc.yaml -replicationcontroller "couchbase-rc" created -``` -+ -Check status of Replication Controller: -+ -```console -./cluster/kubectl.sh get -w po -NAME READY STATUS RESTARTS AGE -couchbase-rc-s5o22 0/1 Pending 0 9s -NAME READY STATUS RESTARTS AGE -couchbase-rc-s5o22 0/1 Running 0 47s -couchbase-rc-s5o22 1/1 Running 0 47s -``` -+ -. Start Couchbase Service: -+ -```console -./cluster/kubectl.sh create -f ~/workspaces/docker-java/attendees/kubernetes/couchbase-service.yaml -service "couchbase-service" created -``` - -#### Initialize Couchbase Cluster - -. Set data and index memory quota for Couchbase: -+ -```console -./cluster/kubectl.sh exec couchbase-rc-s5o22 -- curl -v -X POST http://localhost:8091/pools/default -d memoryQuota=300 -d indexMemoryQuota=300 -``` -+ -. Configure Data and Query service on Couchbase server: -+ -```console -./cluster/kubectl.sh exec couchbase-rc-s5o22 -- /opt/couchbase/bin/couchbase-cli cluster-init -u Administrator -p password -c localhost:8091 --cluster-ramsize=256 --cluster-index-ramsize=256 --services=index,data,query -SUCCESS: init/edit localhost -``` -+ -. Install travel-sample bucket: -+ -```console -./cluster/kubectl.sh exec couchbase-rc-s5o22 -- curl -v -u Administrator:password -X POST http://localhost:8091/sampleBuckets/install -d '["travel-sample"]' -* Trying ::1... -* connect to ::1 port 8091 failed: Connection refused -* Trying 127.0.0.1... -* Connected to localhost (127.0.0.1) port 8091 (#0) -* Server auth using Basic with user 'Administrator' -> POST /sampleBuckets/install HTTP/1.1 -> Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA== -> User-Agent: curl/7.40.0-DEV -> Host: localhost:8091 -> Accept: */* -> Content-Length: 17 -> Content-Type: application/x-www-form-urlencoded -> -* upload completely sent off: 17 out of 17 bytes -< HTTP/1.1 202 Accepted -< Server: Couchbase Server -< Pragma: no-cache -< Date: Mon, 23 Nov 2015 04:31:22 GMT -< Content-Type: application/json -< Content-Length: 2 -< Cache-Control: no-cache -< -* Connection #0 to host localhost left intact -``` -+ -. Query using `cbq` gives error: -+ -```console -./cluster/kubectl.sh exec -it couchbase-rc-s5o22 -- /opt/couchbase/bin/cbq -``` -+ -shows the message: -+ -```console -Couchbase query shell connected to http://localhost:8093/ . Type Ctrl-D to exit. -``` - - -#### Add a new Couchbase server to the cluster - -. Scale using RC - -### Application Logs - -. Get a list of the Pods: -+ -[source, text] ----- -./cluster/kubectl.sh get po -NAME READY STATUS RESTARTS AGE -mysql-pod 1/1 Running 0 18h -wildfly-rc-w2kk5 1/1 Running 0 16h ----- -+ -. Get logs for the WildFly Pod: -+ -[source, text] ----- -./cluster/kubectl.sh logs wildfly-rc-w2kk5 -=> Starting WildFly server -=> Waiting for the server to boot -========================================================================= - - JBoss Bootstrap Environment - - JBOSS_HOME: /opt/jboss/wildfly - - . . . ----- - -Logs can be obtained for any Kubernetes resources using this way. Alternatively, the logs can also be seen by logging into the node: - -. Log in to the node VM: -+ -[source, text] ----- -> vagrant ssh minion-1 -Last login: Fri Jun 5 23:01:36 2015 from 10.0.2.2 -[vagrant@kubernetes-minion-1 ~]$ ----- -+ -. Log in as root: -+ -[source, text] ----- -[vagrant@kubernetes-minion-1 ~]$ su - -Password: -[root@kubernetes-minion-1 ~]# ----- -+ -Default root password for VM images created by Vagrant is '`vagrant`'. -+ -. See the list of Docker containers running on this VM: -+ -[source, text] ----- -docker ps ----- -+ -. View WildFly log as: -+ -[source, text] ----- -docker logs $(docker ps | grep arungupta/wildfly | awk '{print $1}') ----- -+ -. View MySQL log as: -+ -[source, text] ----- -docker logs ----- - -### Delete Kubernetes Resources - -Individual resources (service, replication controller, or pod) can be deleted by using `delete` command instead of `create` command. Alternatively, all services and replication controllers can be deleted using a label as: - -[source, text] ----- -kubectl delete -l se,po context=docker-k8s-lab ----- - -### Stop Kubernetes Cluster - -[source, text] ----- -> ./cluster/kube-down.sh -Bringing down cluster using provider: vagrant -==> minion-1: Forcing shutdown of VM... -==> minion-1: Destroying VM and associated drives... -==> master: Forcing shutdown of VM... -==> master: Destroying VM and associated drives... -Done ----- - -### Debug Kubernetes Master - -. Log in to the master as: -+ -[source, text] ----- -vagrant ssh master -Last login: Wed Jul 15 20:36:32 2015 from 10.0.2.2 -[vagrant@kubernetes-master ~]$ ----- -+ -. Log in as root: -+ -[source, text] ----- -[vagrant@kubernetes-master ~]$ su - -Password: -[root@kubernetes-master ~]# ----- -+ -Default root password for VM images created by Vagrant is '`vagrant`'. -+ -. Check the containers running on master: -+ -[source, text] ----- -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -dc59a764953c gcr.io/google_containers/etcd:2.0.12 "/bin/sh -c '/usr/lo 20 hours ago Up 20 hours k8s_etcd-container.fa2ab1d9_etcd-server-kubernetes-master_default_7b64ecafde589b94a342982699601a19_2b69c4d5 -b722e22d3ddb gcr.io/google_containers/kube-scheduler:d1107ff3b8fcdcbf5a9d78d9d6dbafb1 "/bin/sh -c '/usr/lo 20 hours ago Up 20 hours k8s_kube-scheduler.7501c229_kube-scheduler-kubernetes-master_default_98b354f725c1589ea5a12119795546ae_b81b9740 -38a73e342866 gcr.io/google_containers/kube-controller-manager:fafaf8100ccc963e643b55e35386d713 "/bin/sh -c '/usr/lo 20 hours ago Up 20 hours k8s_kube-controller-manager.db050993_kube-controller-manager-kubernetes-master_default_f5c25224fbfb2de87e1e5c35e6b3a293_dcd4cb5d -01001de6409e gcr.io/google_containers/kube-apiserver:cff9e185796caa8b281e7d961aea828b "/bin/sh -c '/usr/lo 20 hours ago Up 20 hours k8s_kube-apiserver.7e06f4e1_kube-apiserver-kubernetes-master_default_829f8c23fd5fc7951253cac7618447fc_b39c0a5d -0f8ccb144ece gcr.io/google_containers/pause:0.8.0 "/pause" 20 hours ago Up 20 hours k8s_POD.e4cc795_kube-scheduler-kubernetes-master_default_98b354f725c1589ea5a12119795546ae_eb1efcac -0b8f527456c0 gcr.io/google_containers/pause:0.8.0 "/pause" 20 hours ago Up 20 hours k8s_POD.e4cc795_kube-apiserver-kubernetes-master_default_829f8c23fd5fc7951253cac7618447fc_5dd4dee7 -39d9c41ab1a2 gcr.io/google_containers/pause:0.8.0 "/pause" 20 hours ago Up 20 hours k8s_POD.e4cc795_kube-controller-manager-kubernetes-master_default_f5c25224fbfb2de87e1e5c35e6b3a293_522972ae -d970ddff7046 gcr.io/google_containers/pause:0.8.0 "/pause" 20 hours ago Up 20 hours k8s_POD.e4cc795_etcd-server-kubernetes-master_default_7b64ecafde589b94a342982699601a19_fa75b27f ----- diff --git a/chapters/docker-lattice.adoc b/chapters/docker-lattice.adoc deleted file mode 100644 index 3c61495..0000000 --- a/chapters/docker-lattice.adoc +++ /dev/null @@ -1,36 +0,0 @@ -:imagesdir: images - -## Java EE Application on Lattice Cluster - -[quote, github.com/cloudfoundry-incubator/lattice] -Lattice is an open source project for running containerized workloads on a cluster. Lattice bundles up http load-balancing, a cluster scheduler, log aggregation/streaming and health management into an easy-to-deploy and easy-to-use package. - -*How is it related to Docker?* - -ADD DETAILS HERE - -### Key Components - -### Lattice Cluster - -#### Start Lattice Cluster - -#### Verify Lattice Cluster - -### Deploy Java EE Application - -#### Start MySQL Container - -#### Start WildFly Container - -#### Access the application - -### Rescheduling Containers - -### Scaling Containers - -### Application Logs - -### Stop Lattice Cluster - -### Debug Lattice Cluster diff --git a/chapters/docker-maven.adoc b/chapters/docker-maven.adoc deleted file mode 100644 index 5f92123..0000000 --- a/chapters/docker-maven.adoc +++ /dev/null @@ -1,126 +0,0 @@ -:imagesdir: images - -## Docker Maven Plugin - -Maven plugin allows you to manage Docker images and containers from `pom.xml`. It comes with predefined goals: - -[options="header"] -|==== -|Goal | Description -| `docker:start` | Create and start containers -| `docker:stop` | Stop and destroy containers -| `docker:build` | Build images -| `docker:push` | Push images to a registry -| `docker:remove` | Remove images from local docker host -| `docker:logs` | Show container logs -|==== - -### Run Java EE Application - -. Clone the workspace as: - - git clone https://github.com/javaee-samples/javaee7-docker-maven.git - -. Build the image as: - - mvn package -Pdocker - -. Verify the image as: -+ -[source, text] ----- -docker images -REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE -arungupta/javaee7-docker-maven latest 2e51b3fca40f 4 seconds ago 581.5 MB ----- -+ -. Run the container as: - - mvn install -Pdocker - -. Access your application at http://dockerhost:8080/javaee7-docker-maven/resources/persons. It shows the output as: -+ -[source, xml] ----- -curl http://dockerhost:8080/javaee7-docker-maven/resources/persons -PennyLeonardSheldonAmyHowardBernadetteRajPriya ----- - -### Understand Plugin Configuration - -`pom.xml` is updated to include docker-maven-plugin as: - -[source, xml] ----- - - org.jolokia - docker-maven-plugin - 0.11.5 - - - - user - arungupta/javaee7-docker-maven - - arungupta/wildfly:8.2 - - assembly.xml - / - - - 8080 - - - - - 8080:8080 - - - - - - - - docker:build - package - - build - - - - docker:start - install - - start - - - - ----- - -Each image configuration has three parts: - -. Image name and alias -. `` that defines how the image is created. Base image, build artifacts and their dependencies, ports to be exposed, etc to be included in the image are specified here. http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html[Assembly descriptor format] is used to specify the artifacts to be included and is defined in the `src/main/docker` directory. -+ -`assembly.xml` in our case looks like: -+ -[source, xml] ----- - - javaee7-docker-maven - - - - org.javaee7.sample:javaee7-docker-maven - - /opt/jboss/wildfly/standalone/deployments/ - javaee7-docker-maven.war - - - ----- -+ -. `` that defines how the container is run. Ports that need to be exposed are specified here. - -In addition, `package` phase is tied to `docker:build` goal and `install` phase is tied to `docker:start` goal. diff --git a/chapters/docker-mesos.adoc b/chapters/docker-mesos.adoc deleted file mode 100644 index 5b71dd9..0000000 --- a/chapters/docker-mesos.adoc +++ /dev/null @@ -1,40 +0,0 @@ -:imagesdir: images - -## Java EE Application on Mesos + Marathon Cluster - -[quote, mesos.apache.org/] -Apache Mesos abstracts CPU, memory, storage, and other compute resources away from machines (physical or virtual), enabling fault-tolerant and elastic distributed systems to easily be built and run effectively. - -Mesos is built using the same principles as the Linux kernel, only at a different level of abstraction. The Mesos kernel runs on every machine and provides applications (e.g., Hadoop, Spark, Kafka, Elastic Search) with API’s for resource management and scheduling across entire datacenter and cloud environments. - -TODO: Add Solomon's quote about Mesos production for Docker - -*How is it related to Docker?* - -ADD DETAILS HERE - -### Key Components - -### Mesos Cluster - -#### Start Mesos Cluster - -#### Verify Mesos Cluster - -### Deploy Java EE Application - -#### Start MySQL Container - -#### Start WildFly Container - -#### Access the application - -### Rescheduling Containers - -### Scaling Containers - -### Application Logs - -### Stop Mesos Cluster - -### Debug Mesos Cluster diff --git a/chapters/docker-mod-cluster.adoc b/chapters/docker-mod-cluster.adoc deleted file mode 100644 index 946a9e0..0000000 --- a/chapters/docker-mod-cluster.adoc +++ /dev/null @@ -1,67 +0,0 @@ -:imagesdir: images - -[[JavaEE_Application_Docker_Cluster]] -## Java EE Application on Mod Cluster - -A frequent requirement for Java EE based applications is running them on a cluster of application server. While setup and test can be complicated on developer machines, this is where Docker can play to it's full potential. With the help of images and automatic port mapping, we're ready to test Ticket Monster on a couple of WildFly instances and add and remove them randomly. - -The diagram below shows what will be achieved in this section: - -.Standalone Cluster with WildFly and mod_cluster -image::wildfly_cluster1.png[] - -. Start Apache HTTPD server -+ -[source, text] ----- -docker run -d --name modcluster -p 80:80 classroom.example.com:5000/mod_cluster ----- -+ -. Open http://dockerhost/mod_cluster_manager in your browser to see the empty console as: -+ -.Apache HTTPD runing mod_cluster_manager interface -image::wildfly_cluster2.png[] -+ -. Start Postgres database container, if not already running: -+ -[source, text] ----- -docker run --name db -d -p 5432:5432 -e POSTGRES_USER=ticketmonster -e POSTGRES_PASSWORD=ticketmonster-docker classroom.example.com:5000/postgres ----- -+ -. Start the first WildFly instance: -+ -[source, text] ----- -docker run -d --name server1 --link db:db --link modcluster:modcluster classroom.example.com:5000/ticketmonster-pgsql-wildfly ----- -+ -Besides linking the database container using `--link db:db`, we also link the ``modcluster'' container. This should be done rather quickly and if you now revisit the http://dockerhost/mod_cluster_manager/[mod_cluster_manager] in your browser, then you can see that the first server was registered with the loadbalancer: -+ -.First WildFly instance registered with Load Balancer -image::wildfly_cluster3.png[] -+ -. To make sure the Ticket Monster application is also running just visit http://dockerhost/ticket-monster and you will be presented with the Ticket Monster welcome screen. -+ -.Clustered Ticket Monster Application -image::wildfly_cluster4.png[] -+ -. Start as many WildFly instances as you want (and your computer memory can handle): -+ -[source, text] ----- -docker run -d --name server2 --link db:db --link modcluster:modcluster classroom.example.com:5000/ticketmonster-pgsql-wildfly -docker run -d --name server3 --link db:db --link modcluster:modcluster classroom.example.com:5000/ticketmonster-pgsql-wildfly -docker run -d --name server4 --link db:db --link modcluster:modcluster classroom.example.com:5000/ticketmonster-pgsql-wildfly ----- -+ -. Stop some servers: -+ -[source, text] ----- -docker stop server1 -docker stop server3 ----- -+ -Ensure that the application is still accessible at http://dockerhost/ticket-monster. - diff --git a/chapters/docker-netbeans.adoc b/chapters/docker-netbeans.adoc deleted file mode 100644 index 40db149..0000000 --- a/chapters/docker-netbeans.adoc +++ /dev/null @@ -1,3 +0,0 @@ -:imagesdir: images - -## Docker Tools in NetBeans diff --git a/chapters/docker-openshift.adoc b/chapters/docker-openshift.adoc deleted file mode 100644 index a04c498..0000000 --- a/chapters/docker-openshift.adoc +++ /dev/null @@ -1,60 +0,0 @@ -:imagesdir: images - -## OpenShift v3 (Optional Part, No Windows?) - -[quote, github.com/openshift/origin] -OpenShift adds developer and operational centric tools on top of Kubernetes to enable rapid application development, easy deployment and scaling, and long-term lifecycle maintenance for small and large teams and applications. - -OpenShift is Red Hat’s open source PaaS platform. OpenShift v3 (due to be released this year) will provide a holistic experience on running your microservices using Docker and Kubernetes. In a classic Red Hat way, all the work is done in the open source at OpenShift Origin. This will also drive the next major release of OpenShift Online and OpenShift Enterprise. - -OpenShift v3 uses a new platform stack that is using plenty of community projects where Red Hat contributes such as Fedora, Centos, Docker, Project Atomic, Kubernetes, and OpenStack. OpenShift v3 Platform Combines Docker, Kubernetes, Atomic and More explain this platform stack in detail. - -image::openshiftv3-stack.png[] - -### Download and Run OpenShift Origin - -OpenShift Origin is available as a Docker container. It has all of the software prebuilt and pre-installed, but you do need to do a few things to get it going. - -. Create a `/var/lib/openshift` folder on your Docker host. This volume will be mounted in the container to hold any data such that it is preserved after restart. -+ -[source, text] ----- -docker-machine ssh lab "mkdir /var/lib/openshift" ----- -+ -. Download and run the OpenShift Origin container as: -+ -[source, text] ----- -$ docker run -d --name "openshift-origin" --net=host --privileged \ --v /var/run/docker.sock:/var/run/docker.sock \ --v /var/lib/openshift:/var/lib/openshift \ -classroom.example.com:5000/openshift start ----- -+ -. Check that the container is running: -+ -[source, text] ----- -> docker ps -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -df29f4cdff9e openshift/origin:latest "/usr/bin/openshift 57 seconds ago Up 57 seconds openshift-origin ----- - -### Run Java EE Application - -Here is the deployment diagram of our application: - -image::openshiftv3-wildfly-mysql-deployment.png[] - -. WildFly and MySQL are running on separate pods. -. Each of them is wrapped in a Replication Controller to enable simplified scaling. -. Each Replication Controller is published as a Service. -. WildFly talks to the MySQL service, as opposed to directly to the pod. This is important as Pods, and IP addresses assigned to them, are ephemeral. - -Lets get started! - -. Docker host is already configured to trust insecure registry service. This registry will be used to push images for build/test/deploy cycle. - - -http://blog.arungupta.me/openshift-v3-getting-started-javaee7-wildfly-mysql/ diff --git a/chapters/docker-preface.adoc b/chapters/docker-preface.adoc deleted file mode 100644 index 0a3e865..0000000 --- a/chapters/docker-preface.adoc +++ /dev/null @@ -1,11 +0,0 @@ -:imagesdir: images - -## Preface - -Containers are enabling developers to package their applications (and underlying dependencies) in new ways that are portable and work consistently everywhere? On your machine, in production, in your data center, and in the cloud. And Docker has become the de facto standard for those portable containers in the cloud. - -Docker is the developer-friendly Linux container technology that enables creation of your stack: OS, JVM, app server, app, and all your custom configuration. So with all it offers, how comfortable are you and your team taking Docker from development to production? Are you hearing developers say, “But it works on my machine!” when code breaks in production? - -This lab offers developers an intro-level, hands-on session with Docker, from installation, to exploring Docker Hub, to crafting their own images, to adding Java apps and running custom containers. It will also explain how to use Swarm to orchestrate these containers together. This is a BYOL (bring your own laptop) session, so bring your Windows, OSX, or Linux laptop and be ready to dig into a tool that promises to be at the forefront of our industry for some time to come. - -NOTE: Latest content of this workshop is always at https://github.com/javaee-samples/docker-java diff --git a/chapters/docker-references.adoc b/chapters/docker-references.adoc deleted file mode 100644 index 7a08bf3..0000000 --- a/chapters/docker-references.adoc +++ /dev/null @@ -1,8 +0,0 @@ -:imagesdir: images - -## References - -. Docker Docs: http://docs.docker.com -. Kubernetes Docs: https://github.com/kubernetes/kubernetes/tree/master/docs -. JBoss and Docker: http://www.jboss.org/docker/ -. Latest lab content: https://github.com/javaee-samples/docker-java diff --git a/chapters/docker-setup.adoc b/chapters/docker-setup.adoc deleted file mode 100644 index 5551d4b..0000000 --- a/chapters/docker-setup.adoc +++ /dev/null @@ -1,157 +0,0 @@ -:imagesdir: images - -## Setup Environments - -This section describes the software needed for this workshop. This workshop is designed for a BYOL (Brying Your Own Laptop) style hands-on-lab. - -### Hardware - -. Operating System: Mac OS X (10.8+), Windows 7+, Ubuntu 12+, CentOS 7+, Fedora 21+ -. Memory: At least 4 GB+, preferred 8 GB - -### Docker - -#### Docker Toolbox or Packages - -Docker runs natively on Linux. Because the Docker daemon uses Linux-specific kernel features, you can’t run Docker natively in OS X or Windows. Instead, you must use `docker-machine` to create and attach to a virtual machine (VM). This machine is a Linux VM that hosts Docker for you on your Mac or Windows. This can be easily installed using https://www.docker.com/docker-toolbox[Docker Toolbox]. - -Follow the instructions to install Docker: - -. https://github.com/docker/toolbox/releases/download/v1.10.0/DockerToolbox-1.10.0.pkg[Docker Tool Box 1.10.0 for Mac] -. https://github.com/docker/toolbox/releases/download/v1.10.0/DockerToolbox-1.10.0.exe[Docker Toolbox 1.10.0 for Windows] -. http://docs.docker.com/engine/installation/ubuntulinux/[Docker on Ubuntu] -. http://docs.docker.com/engine/installation/centos/[Docker on Centos] -. http://docs.docker.com/engine/installation/fedora/[Docker on Fedora] - -Complete set of operating systems are listed at http://docs.docker.com/engine/installation/[Install Docker Engine]. - -#### Checkout `docker-java` workspace - -```console -git clone https://github.com/javaee-samples/docker-java -``` - -#### Pull Docker images - -IMPORTANT: For Mac and Windows, this commands need to be issued from the Docker shell or Command Prompt where `eval $(docker-machine env default)` command was issued. This command need to be issued in the `attendees` directory of `docker-java` workspace. - -```console -docker-compose -f docker-compose-pull-images.yml pull -``` - -#### Create Docker Host Mapping - -. To make it easier to start/stop the containers, an entry is added into the host mapping table of your operating system. Find out the IP address of your machine: -+ -```console -docker-machine ip default -``` -+ -This will provide the IP address associated with the Docker Machine created earlier. -+ -. Edit `/etc/hosts` (Mac OS or Linux) or `C:\Windows\System32\drivers\etc\hosts` (Windows) and add: -+ -[source, text] ----- - dockerhost ----- - -#### Optional Software - -The following software needs to be downloaded if you want to build/deploy a Java EE application. - -##### Java Development Kit - -. Java: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html[Oracle JDK 8u65] - -##### Maven - -. Download Apache Maven from https://maven.apache.org/download.cgi. -. Unzip to a directory of your choice and add it to the `PATH`. - -##### WildFly - -. Download WildFly 10.0 from http://download.jboss.org/wildfly/10.0.0.Final/wildfly-10.0.0.Final.zip. -. Install it by extracting the archive. - -##### JBoss Developer Studio 9.0 - -To install JBoss Developer Studio stand-alone, complete the following steps: - -. Download http://tools.jboss.org/downloads/devstudio/mars/9.0.0.GA.html[9.0.0]. -. Start the installer as: -+ -```console -java -jar -``` -+ -Follow the on-screen instructions to complete the installation process. - -[[Kubernetes_Setup]] -### Kubernetes - -. Download Vagrant from https://www.vagrantup.com/downloads.html and install. -+ -Kubernetes requires Vagrant >= 1.6.2. So if you have an older version then make sure you install the latest one. -+ -. If you've not installed Docker Toolbox, then you need to additionally download Virtual Box 5.0.8 from https://www.virtualbox.org/wiki/Downloads. -. Download Kubernetes (1.1.2) from https://github.com/kubernetes/kubernetes/releases/download/v1.1.3/kubernetes.tar.gz. -. On Windows, Python interpreter needs to be installed and included in the `%PATH%`. Download from https://www.python.org/downloads/windows/ and setup `%PATH%` in Control Panel. -. Extract the archive and install it: -+ -```console -export KUBERNETES_PROVIDER=vagrant -cd kubernetes -./cluster/kube-up.sh -``` -+ -NOTE: Vagrant provider should be included in the path. For example, for VirtualBox, `vboxmanage` command should work from the shell or command prompt where `./cluster/kube-up.sh` script is invoked. -+ -If more than one Vagrant provider (such as VirtualBox and Parallels) are installed, Kubernetes will usually pick the appropriate one. You can override by setting the VAGRANT_DEFAULT_PROVIDER environment variable: -+ -```console -export VAGRANT_DEFAULT_PROVIDER=virtualbox -export KUBERNETES_PROVIDER=vagrant -./cluster/kube-up.sh -``` -+ -NOTE: This will take a few minutes, so be patience! Vagrant will provision each machine in the cluster with all the necessary components to run Kubernetes. -+ -It shows the output as: -+ -[source, text] ----- -kubernetes > ./cluster/kube-up.sh -... Starting cluster using provider: vagrant -... calling verify-prereqs -... calling kube-up -Bringing machine 'master' up with 'virtualbox' provider... -Bringing machine 'minion-1' up with 'virtualbox' provider... -==> master: Importing base box 'kube-fedora21'... -==> master: Matching MAC address for NAT networking... -==> master: Setting the name of the VM: kubernetes_master_1450804087843_75902 - -. . . - -... calling validate-cluster -Found 1 node(s). -NAME LABELS STATUS AGE -10.245.1.3 kubernetes.io/hostname=10.245.1.3 Ready 5s -Validate output: -NAME STATUS MESSAGE ERROR -controller-manager Healthy ok nil -scheduler Healthy ok nil -etcd-0 Healthy {"health": "true"} nil -etcd-1 Healthy {"health": "true"} nil -Cluster validation succeeded -Done, listing cluster services: - -Kubernetes master is running at https://10.245.1.2 -Heapster is running at https://10.245.1.2/api/v1/proxy/namespaces/kube-system/services/heapster -KubeDNS is running at https://10.245.1.2/api/v1/proxy/namespaces/kube-system/services/kube-dns -KubeUI is running at https://10.245.1.2/api/v1/proxy/namespaces/kube-system/services/kube-ui -Grafana is running at https://10.245.1.2/api/v1/proxy/namespaces/kube-system/services/monitoring-grafana -InfluxDB is running at https://10.245.1.2/api/v1/proxy/namespaces/kube-system/services/monitoring-influxdb ----- -+ -Note down the address for Kubernetes master, `https://10.245.1.2` in this case. diff --git a/chapters/docker-swarm.adoc b/chapters/docker-swarm.adoc deleted file mode 100644 index 7e66d3e..0000000 --- a/chapters/docker-swarm.adoc +++ /dev/null @@ -1,508 +0,0 @@ -:imagesdir: images - -[[Docker_Swarm]] -## Deploy Application on Docker Swarm Cluster - -Docker Swarm is native clustering for Docker. It allows you to create and access a pool of Docker hosts using the full suite of Docker tools. Because Docker Swarm serves the standard Docker API, any tool that already communicates with a Docker daemon can use Swarm to transparently scale to multiple hosts. - -### Key Components of Docker Swarm - -.Key Components of Docker Swarm -image::docker-swarm-components.png[] - -*Swarm Manager*: Docker Swarm has a Manager that is a pre-defined Docker Host and is a single point for all administration. Swarm manager orchestrates and schedules containers in the entire cluster. Swarm Manager can be configured to enable https://docs.docker.com/swarm/multi-manager-setup/[High Availability]. - -*Swarm Nodes*: The containers are deployed on Nodes that are additional Docker Hosts. Each Swarm Node must be accessible by the manager, each node must listen to the same network interface (TCP port). Each node runs a Docker Swarm agent that registers the referenced Docker daemon, monitors it, and updates the discovery backend with the node’s status. The containers run on a node. - -*Scheduler Strategy*: Different scheduler strategies ("`binpack`", "`spread`" (default), and "`random`") can be applied to pick the best node to run your container. The default strategy optimizes the node for least number of running containers. There are multiple kinds of filters, such as constraints and affinity. This should allow for a decent scheduling algorithm. - -*Node Discovery Service*: Swarm manager talks to a hosted discovery service. This service maintains a list of IPs in the Swarm cluster. Docker Hub hosts a discovery service that can be used during development. In production, this is replaced by other services such as `etcd`, `consul`, or `zookeeper`. You can even use a static file. This is particularly useful if there is no Internet access or you are running in a closed network. - -*Standard Docker API*: Docker Swarm serves the standard Docker API and thus any tool that talks to a single Docker host will seamlessly scale to multiple hosts now. That means that if you were using shell scripts using Docker CLI to configure multiple Docker hosts, the same CLI could now talk to the Swarm cluster. - -There are a lots of other concepts but these are the main ones. - -This section will deploy an application that will provide a CRUD/REST interface on a data bucket in Couchbase. This is achieved by using a Java EE application deployed on WildFly to access the database. - -### Create Discovery Service - -. Create a Machine that will host discovery service: -+ -[source, text] ----- -docker-machine create -d=virtualbox consul-machine -Running pre-create checks... -Creating machine... -Waiting for machine to be running, this may take a few minutes... -Machine is running, waiting for SSH to be available... -Detecting operating system of created instance... -Provisioning created instance... -Copying certs to the local machine directory... -Copying certs to the remote machine... -Setting Docker configuration on the remote daemon... -To see how to connect Docker to this machine, run: docker-machine env consul-machine ----- -+ -. Connect to this Machine: - - eval $(docker-machine env consul-machine) - -. Run Consul service using the following Compose file: -+ -[source, text] ----- -myconsul: - image: progrium/consul - restart: always - hostname: consul - ports: - - 8500:8500 - command: "-server -bootstrap" ----- -+ -This Compose file is available at https://github.com/arun-gupta/docker-images/blob/master/consul/docker-compose.yml. -+ -Start this service as: -+ -[source, text] ----- -docker-compose up -d -Pulling myconsul (progrium/consul:latest)... -latest: Pulling from progrium/consul -3b4d28ce80e4: Pull complete -e5ab901dcf2d: Pull complete -30ad296c0ea0: Pull complete -3dba40dec256: Pull complete -f2ef4387b95e: Pull complete -53bc8dcc4791: Pull complete -75ed0b50ba1d: Pull complete -17c3a7ed5521: Pull complete -8aca9e0ecf68: Pull complete -4d1828359d36: Pull complete -46ed7df7f742: Pull complete -b5e8ce623ef8: Pull complete -049dca6ef253: Pull complete -bdb608bc4555: Pull complete -8b3d489cfb73: Pull complete -c74500bbce24: Pull complete -9f3e605442f6: Pull complete -d9125e9e799b: Pull complete -Digest: sha256:8cc8023462905929df9a79ff67ee435a36848ce7a10f18d6d0faba9306b97274 -Status: Downloaded newer image for progrium/consul:latest -Creating consul_myconsul_1 ----- -+ -Started container can be verified as: -+ -[source, text] ----- -docker ps -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -f05d8dd11e7f progrium/consul "/bin/start -server -" 30 seconds ago Up 29 seconds 53/tcp, 53/udp, 8300-8302/tcp, 8400/tcp, 0.0.0.0:8500->8500/tcp, 8301-8302/udp consul_myconsul_1 ----- - -### Create Docker Swarm Cluster - -Swarm is fully integrated with Machine, and so is the easiest way to get started. - -. Create a Swarm Master and point to the Consul discovery service: -+ -[source, text] ----- -docker-machine create -d virtualbox --virtualbox-disk-size "5000" --swarm --swarm-master --swarm-discovery="consul://$(docker-machine ip consul-machine):8500" --engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" --engine-opt="cluster-advertise=eth1:2376" swarm-master -Running pre-create checks... -Creating machine... -Waiting for machine to be running, this may take a few minutes... -Machine is running, waiting for SSH to be available... -Detecting operating system of created instance... -Provisioning created instance... -Copying certs to the local machine directory... -Copying certs to the remote machine... -Setting Docker configuration on the remote daemon... -Configuring swarm... -To see how to connect Docker to this machine, run: docker-machine env swarm-master ----- -+ -Few options to look here: -+ -.. `--swarm` configures the Machine with Swarm -.. `--swarm-master` configures the created Machine to be Swarm master -.. `--swarm-discovery` defines address of the discovery service -.. `--cluster-advertise` advertise the machine on the network -.. `--cluster-store` designate a distributed k/v storage backend for the cluster -.. `--virtualbox-disk-size` sets the disk size for the created Machine to 5GB. This is required so that WildFly and Couchbase image can be downloaded on any of the nodes. -+ -. Find some information about this machine: -+ -[source, json] ----- -docker-machine inspect --format='{{json .Driver}}' swarm-master -{"Boot2DockerImportVM":"","Boot2DockerURL":"","CPU":1,"DiskSize":5000,"HostOnlyCIDR":"192.168.99.1/24","HostOnlyNicType":"82540EM","HostOnlyPromiscMode":"deny","IPAddress":"192.168.99.102","MachineName":"swarm-master","Memory":1024,"NoShare":false,"SSHPort":51972,"SSHUser":"docker","StorePath":"/Users/arungupta/.docker/machine","SwarmDiscovery":"consul://192.168.99.100:8500","SwarmHost":"tcp://0.0.0.0:3376","SwarmMaster":true,"VBoxManager":{}} ----- -+ -Note that the disk size is 5GB. -+ -. Connect to the Swarm cluster by using the command: -+ - eval "$(docker-machine env --swarm swarm-master)" -+ -NOTE: `--swarm` is specified to connect to the Swarm cluster. Otherwise the command will connect to `swarm-master` Machine only. However, if you're on Windows, then use the `docker-machine env swarm-master` command only. Then copy the output into an editor to replace all appearances of EXPORT with SET, remove the quotes, and all appearances of "/" with "\". Finally, issue the three commands at your command prompt. -+ -. Get information about the cluster: -+ -[source, text] ----- -docker info -Containers: 2 -Images: 1 -Role: primary -Strategy: spread -Filters: health, port, dependency, affinity, constraint -Nodes: 1 - swarm-master: 192.168.99.102:2376 - └ Containers: 2 - └ Reserved CPUs: 0 / 1 - └ Reserved Memory: 0 B / 1.021 GiB - └ Labels: executiondriver=native-0.2, kernelversion=4.1.13-boot2docker, operatingsystem=Boot2Docker 1.9.1 (TCL 6.4.1); master : cef800b - Fri Nov 20 19:33:59 UTC 2015, provider=virtualbox, storagedriver=aufs -CPUs: 1 -Total Memory: 1.021 GiB -Name: d074fd97682e ----- -+ -This cluster has one node and that node has two containers. -+ -. Create the first Swarm node to join this cluster: -+ -[source, text] ----- -docker-machine create -d virtualbox --virtualbox-disk-size "5000" --swarm --swarm-discovery="consul://$(docker-machine ip consul-machine):8500" --engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" --engine-opt="cluster-advertise=eth1:2376" swarm-node-01 -Running pre-create checks... -Creating machine... -Waiting for machine to be running, this may take a few minutes... -Machine is running, waiting for SSH to be available... -Detecting operating system of created instance... -Provisioning created instance... -Copying certs to the local machine directory... -Copying certs to the remote machine... -Setting Docker configuration on the remote daemon... -Configuring swarm... -To see how to connect Docker to this machine, run: docker-machine env swarm-node-01 ----- -+ -Notice no `--swarm-master` is specified in this command. This ensure that the created Machines are _worker_ nodes. -+ -. Create a second Swarm node to join this cluster: -+ -[source, text] ----- -docker-machine create -d virtualbox --virtualbox-disk-size "5000" --swarm --swarm-discovery="consul://$(docker-machine ip consul-machine):8500" --engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" --engine-opt="cluster-advertise=eth1:2376" swarm-node-02 -Running pre-create checks... -Creating machine... -Waiting for machine to be running, this may take a few minutes... -Machine is running, waiting for SSH to be available... -Detecting operating system of created instance... -Provisioning created instance... -Copying certs to the local machine directory... -Copying certs to the remote machine... -Setting Docker configuration on the remote daemon... -Configuring swarm... -To see how to connect Docker to this machine, run: docker-machine env swarm-node-02 ----- -+ -. List all the created Machines: -+ -[source, text] ----- -docker-machine ls -NAME ACTIVE DRIVER STATE URL SWARM -consul-machine - virtualbox Running tcp://192.168.99.100:2376 -swarm-master * virtualbox Running tcp://192.168.99.101:2376 swarm-master (master) -swarm-node-01 - virtualbox Running tcp://192.168.99.102:2376 swarm-master -swarm-node-02 - virtualbox Running tcp://192.168.99.103:2376 swarm-master ----- -+ -The machines that are part of the cluster have cluster’s name in the SWARM column. If the SWARM column is blank, then it is a standalone machine. For example, `consul-machine` is a standalone machine as opposed to all other machines which are part of the `swarm-master` cluster. The Swarm master is identified by (master) in the SWARM column. -+ -. Get information about the cluster again: -+ -[source, text] ----- -docker info -Containers: 4 -Images: 3 -Role: primary -Strategy: spread -Filters: health, port, dependency, affinity, constraint -Nodes: 3 - swarm-master: 192.168.99.102:2376 - └ Containers: 2 - └ Reserved CPUs: 0 / 1 - └ Reserved Memory: 0 B / 1.021 GiB - └ Labels: executiondriver=native-0.2, kernelversion=4.1.13-boot2docker, operatingsystem=Boot2Docker 1.9.1 (TCL 6.4.1); master : cef800b - Fri Nov 20 19:33:59 UTC 2015, provider=virtualbox, storagedriver=aufs - swarm-node-01: 192.168.99.103:2376 - └ Containers: 1 - └ Reserved CPUs: 0 / 1 - └ Reserved Memory: 0 B / 1.021 GiB - └ Labels: executiondriver=native-0.2, kernelversion=4.1.13-boot2docker, operatingsystem=Boot2Docker 1.9.1 (TCL 6.4.1); master : cef800b - Fri Nov 20 19:33:59 UTC 2015, provider=virtualbox, storagedriver=aufs - swarm-node-02: 192.168.99.104:2376 - └ Containers: 1 - └ Reserved CPUs: 0 / 1 - └ Reserved Memory: 0 B / 1.021 GiB - └ Labels: executiondriver=native-0.2, kernelversion=4.1.13-boot2docker, operatingsystem=Boot2Docker 1.9.1 (TCL 6.4.1); master : cef800b - Fri Nov 20 19:33:59 UTC 2015, provider=virtualbox, storagedriver=aufs -CPUs: 3 -Total Memory: 3.064 GiB -Name: d074fd97682e ----- -+ -Now there are 3 nodes – one Swarm master and 2 Swarm _worker_ nodes. There are a total of 4 containers running in this cluster – a swarm-agent on each node and an additional swarm-agent-master running on the master. This can be verified by connecting to the master Machine (without specifying `--swarm`) and listing all the containers: -+ -[source, text] ----- -eval "$(docker-machine env swarm-master)" -docker ps -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -cf5edbf4ada7 swarm:latest "/swarm join --advert" 49 seconds ago Up 49 seconds 2375/tcp swarm-agent -c7c3b80bceb4 swarm:latest "/swarm manage --tlsv" 49 seconds ago Up 49 seconds 2375/tcp, 0.0.0.0:3376->3376/tcp swarm-agent-master ----- -+ -. You can also query the Consul discovery service while connected to the Swarm cluster, master, or any worker node in the cluster to list the nodes in the cluster: -+ -[source, text] ----- -docker run swarm list consul://$(docker-machine ip consul-machine):8500 -192.168.99.102:2376 -192.168.99.103:2376 -192.168.99.104:2376 ----- - -### Start Application Environment Using Docker Compose - -. Connect to the Swarm cluster: -+ - eval "$(docker-machine env --swarm swarm-master)" -+ -. List all the networks created by Docker so far: -+ -[source, text] ----- -docker network ls -NETWORK ID NAME DRIVER -33a619ddc5d2 swarm-node-02/bridge bridge -e0b73c96ffec swarm-node-02/none null -b315e67f0363 swarm-node-02/host host -879d6167be47 swarm-master/bridge bridge -f771ddc7d957 swarm-node-01/none null -e042754df336 swarm-node-01/host host -d2f3b512f9dc swarm-node-01/bridge bridge -5b5bcf135d7b swarm-master/none null -fffc34eae907 swarm-master/host host ----- -+ -Docker creates three networks for each host automatically: -+ -[options="header", cols="1,3", width="80%"] -|==== -| Network Name | Purpose -| `bridge` | Default network that containers connect to. This is `docker0` network in all Docker installations. -| `none` | Container-specific networking stack -| `host` | Adds a container on hosts networking stack. Network configuration is identical to the host. -|==== -+ -A total of nine networks are created for this three-node Swarm cluster because three networks are created for each node. -+ -. Use Compose file to start WildFly and Couchbase: -+ -[source, text] ----- -mycouchbase: - container_name: "db" - image: couchbase/server - ports: - - 8091:8091 - - 8092:8092 - - 8093:8093 - - 11210:11210 -mywildfly: - image: arungupta/wildfly-admin - environment: - - COUCHBASE_URI=db - ports: - - 8080:8080 - - 9990:9990 ----- -+ -In this Compose file: -+ -.. Couchbase service has a custom container name defined by `container_name`. This name is used when creating a new environment variable `COUCHBASE_URI` during WildFly startup. -.. `arungupta/wildfly-admin` image is used as it binds WildFly’s management to all network interfaces, and in addition also exposes port 9990. This enables WildFly Maven Plugin to be used to deploy the application. -+ -Source for this file is at https://github.com/arun-gupta/docker-images/blob/master/wildfly-couchbase-javaee7/docker-compose.yml. -+ -This application environment can be started as: -+ -[source, text] ----- -docker-compose --x-networking up -d -Creating network "wildflycouchbasejavaee7" with driver "None" -Pulling mywildfly (arungupta/wildfly-admin:latest)... -swarm-node-02: Pulling arungupta/wildfly-admin:latest... : downloaded -swarm-master: Pulling arungupta/wildfly-admin:latest... : downloaded -swarm-node-01: Pulling arungupta/wildfly-admin:latest... : downloaded -Creating wildflycouchbasejavaee7_mywildfly_1 -Pulling mycouchbase (couchbase/server:latest)... -swarm-node-02: Pulling couchbase/server:latest... : downloaded -swarm-master: Pulling couchbase/server:latest... : downloaded -swarm-node-01: Pulling couchbase/server:latest... : downloaded -Creating db ----- -+ -`--x-networking` creates an overlay network for the Swarm cluster. This can be verified by listing networks again: -+ -[source, text] ----- -docker network ls -NETWORK ID NAME DRIVER -5e93fc34b4d9 swarm-node-01/docker_gwbridge bridge -1c041242f51d wildflycouchbasejavaee7 overlay -cc8697c6ce13 swarm-master/docker_gwbridge bridge -f771ddc7d957 swarm-node-01/none null -879d6167be47 swarm-master/bridge bridge -5b5bcf135d7b swarm-master/none null -fffc34eae907 swarm-master/host host -e042754df336 swarm-node-01/host host -d2f3b512f9dc swarm-node-01/bridge bridge -33a619ddc5d2 swarm-node-02/bridge bridge -e0b73c96ffec swarm-node-02/none null -b315e67f0363 swarm-node-02/host host ----- -+ -Three new networks are created: -+ -... Containers connected to the multi-host network are automatically connected to the `docker_gwbridge` network. This network allows the containers to have external connectivity outside of their cluster, and is created on each worker node. -... A new overlay network `wildflycouchbasejavaee7` is created. Connect to different Swarm nodes and check that the overlay network exists on them. -+ -Lets begin with master: -+ -[source, text] ----- -eval "$(docker-machine env swarm-master)" -docker network ls -NETWORK ID NAME DRIVER -1c041242f51d wildflycouchbasejavaee7 overlay -879d6167be47 bridge bridge -5b5bcf135d7b none null -fffc34eae907 host host -cc8697c6ce13 docker_gwbridge bridge ----- -+ -Next, with `swarm-node-01`: -+ -[source, text] ----- -eval "$(docker-machine env swarm-node-01)" -docker network ls -NETWORK ID NAME DRIVER -1c041242f51d wildflycouchbasejavaee7 overlay -d2f3b512f9dc bridge bridge -f771ddc7d957 none null -e042754df336 host host -5e93fc34b4d9 docker_gwbridge bridge ----- -+ -Finally, with `swarm-node-02`: -+ -[source, text] ----- -eval "$(docker-machine env swarm-node-02)" -docker network ls -NETWORK ID NAME DRIVER -1c041242f51d wildflycouchbasejavaee7 overlay -e0b73c96ffec none null -b315e67f0363 host host -33a619ddc5d2 bridge bridge ----- -+ -As seen, `wildflycouchbasejavaee7` overlay network exists on all Machines. This confirms that the overlay network created for Swarm cluster was added to each host in the cluster. `docker_gwbridge` only exists on Machines that have application containers running. -+ -Read more about https://docs.docker.com/engine/userguide/networking/dockernetworks/[Docker Networks]. -+ -. Connect to the Swarm cluster and verify that WildFly and Couchbase are running: -+ -[source, text] ----- -eval "$(docker-machine env --swarm swarm-master)" -docker ps -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -23a581295a2b couchbase/server "/entrypoint.sh couch" 9 seconds ago Up 8 seconds 192.168.99.102:8091-8093->8091-8093/tcp, 11207/tcp, 11211/tcp, 192.168.99.102:11210->11210/tcp, 18091-18092/tcp swarm-master/db -7a8a885b23f3 arungupta/wildfly-admin "/opt/jboss/wildfly/b" 9 seconds ago Up 8 seconds 192.168.99.103:8080->8080/tcp, 192.168.99.103:9990->9990/tcp swarm-node-01/wildflycouchbasejavaee7_mywildfly_1 ----- -+ -Note that, in this example, the Couchbase server is running on `swarm-master` node and WildFly is running on `swarm-node-01`. Take a note on which nodes your Couchbase and WildFly servers are running and update the following commands accordingly. - -### Configure Couchbase server - -. Clone https://github.com/arun-gupta/couchbase-javaee.git. This workspace contains a simple Java EE application that is deployed on WildFly and provides a REST API over `travel-sample` bucket in Couchbase. -. Couchbase server can be configured using http://developer.couchbase.com/documentation/server/4.0/rest-api/rest-endpoints-all.html[REST API]. The application contains a Maven profile that allows to configure the Couchbase server with `travel-sample` bucket. This can be invoked as: (Note that you may need to replace `swarm-master` with the node in your cluster that is running Couchbase) -+ -[source, text] ----- -mvn install -Pcouchbase -Ddocker.host=$(docker-machine ip swarm-master) - -. . . - -* Server auth using Basic with user 'Administrator' -> POST /sampleBuckets/install HTTP/1.1 -> Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA== - -. . . - -} [data not shown] -* upload completely sent off: 17 out of 17 bytes -< HTTP/1.1 202 Accepted -* Server Couchbase Server is not blacklisted -< Server: Couchbase Server - -. . . ----- - -### Deploy Application - -Deploy the application to WildFly by specifying three parameters: - -. Host IP address where WildFly is running (swarm-node-01 in this example but update as needed for your cluster) -. Username of a user in WildFly's administrative realm -. Password of the user specified in WildFly's administrative realm - -[source, text] ----- -mvn install -Pwildfly -Dwildfly.hostname=$(docker-machine ip swarm-node-01) -Dwildfly.username=admin -Dwildfly.password=Admin#007 - -. . . - -Nov 29, 2015 12:11:14 AM org.xnio.Xnio -INFO: XNIO version 3.3.1.Final -Nov 29, 2015 12:11:14 AM org.xnio.nio.NioXnio -INFO: XNIO NIO Implementation Version 3.3.1.Final -Nov 29, 2015 12:11:15 AM org.jboss.remoting3.EndpointImpl -INFO: JBoss Remoting version 4.0.9.Final -[INFO] Authenticating against security realm: ManagementRealm -[INFO] ------------------------------------------------------------------------ -[INFO] BUILD SUCCESS -[INFO] ------------------------------------------------------------------------ - -. . . ----- - -### Access Application - -Now that the WildFly and Couchbase servers have started, lets access the application. You need to specify the IP address of the Machine where WildFly is running (swarm-node-01 in this example but update as needed for your cluster): - -[source, text] ----- -curl http://$(docker-machine ip swarm-node-01):8080/couchbase-javaee/resources/airline -[{"travel-sample":{"id":10123,"iata":"TQ","icao":"TXW","name":"Texas Wings","callsign":"TXW","type":"airline","country":"United States"}}, {"travel-sample":{"id":10642,"iata":null,"icao":"JRB","name":"Jc royal.britannica","callsign":null,"type":"airline","country":"United Kingdom"}}, {"travel-sample":{"id":112,"iata":"5W","icao":"AEU","name":"Astraeus","callsign":"FLYSTAR","type":"airline","country":"United Kingdom"}}, {"travel-sample":{"id":1355,"iata":"BA","icao":"BAW","name":"British Airways","callsign":"SPEEDBIRD","type":"airline","country":"United Kingdom"}}, {"travel-sample":{"id":10765,"iata":"K5","icao":"SQH","name":"SeaPort Airlines","callsign":"SASQUATCH","type":"airline","country":"United States"}}, {"travel-sample":{"id":13633,"iata":"WQ","icao":"PQW","name":"PanAm World Airways","callsign":null,"type":"airline","country":"United States"}}, {"travel-sample":{"id":139,"iata":"SB","icao":"ACI","name":"Air Caledonie International","callsign":"AIRCALIN","type":"airline","country":"France"}}, {"travel-sample":{"id":13391,"iata":"-+","icao":"--+","name":"U.S. Air","callsign":null,"type":"airline","country":"United States"}}, {"travel-sample":{"id":1191,"iata":"UU","icao":"REU","name":"Air Austral","callsign":"REUNION","type":"airline","country":"France"}}, {"travel-sample":{"id":1316,"iata":"FL","icao":"TRS","name":"AirTran Airways","callsign":"CITRUS","type":"airline","country":"United States"}}] ----- - -Check state of the cluster by connecting to different nodes. - -Add container visualization using https://github.com/javaee-samples/docker-java/issues/55. diff --git a/chapters/docker-ticket-monster.adoc b/chapters/docker-ticket-monster.adoc deleted file mode 100644 index 6531991..0000000 --- a/chapters/docker-ticket-monster.adoc +++ /dev/null @@ -1,272 +0,0 @@ -:imagesdir: images - -## Build and Deploy Java EE 6 Application (Ticket Monster) - -http://www.jboss.org/ticket-monster/[Ticket Monster] is an example application that focuses on Java EE6 - JPA 2, CDI, EJB 3.1 and JAX-RS along with HTML5 and jQuery Mobile. It is a moderately complex application that demonstrates how to build modern web applications optimized for mobile & desktop. TicketMonster is representative of an online ticketing broker - providing access to events (e.g. concerts, shows, etc) with an online booking application. - -.TicketMonster architecture -image::ticket-monster_tutorial_architecture.png[] - -The application uses Java EE 6 services to provide business logic and persistence, utilizing technologies such as CDI, EJB 3.1 and JAX-RS, JPA 2. These services back the user-facing booking process, which is implemented using HTML5 and JavaScript, with support for mobile devices through jQuery Mobile. - -[[Build_Application]] -### Build Application - -In order to build the application from source, create a directory and change to it: - -[source, text] ----- -mkdir docker-java/ -cd docker-java/ ----- - -Checkout sources from the git repository. - -[source, text] ----- -ifdef::classroom[git clone -b WildFly-docker-test http://root:dockeradmin@classroom.example.com:10080/root/ticket-monster.git] -ifdef::public[] ----- - -`-b WildFly-docker-test` is a branch of Ticket Monster that contains a ``docker-test'' profile to run Arquillian Cube test. More on this later. - -NOTE: You're free to explore the application. Open it with with the favorite IDE of your choice. Find more background about the use-cases and how the application is designed at http://www.jboss.org/ticket-monster/whatisticketmonster/[Ticket Monster Website]. - -Copy the Maven `lab-settings.xml` file that you have downloaded from the instructor machine and place it inside `docker-java` directory. - -When you're ready, it is time to build the application. Switch to the checkout directory and run maven package. - -[source, text] ----- -cd docker-java/ -mvn -s lab-settings.xml -f ticket-monster/demo/pom.xml -Ppostgresql clean package ----- - -Congratulations! You just build the applications war file. Let's deploy it! - -### Start Database Server - -The application require an application server and a database server. This lab will use WildFly and Postgres for them respectively. - -Start Postgres database as: - -[source, text] ----- -docker run --name db -d -p 5432:5432 -e POSTGRES_USER=ticketmonster -e POSTGRES_PASSWORD=ticketmonster-docker classroom.example.com:5000/postgres ----- - -This command starts a container named ``db'' from the image in your instructor's registry `classroom.example.com:5000/postgres`. As this will not be present locally, it needs to be downloaded first. But you'll have a very quick connection to the instructor registry and this shouldn't take long. - -The two `-e` options define environment variables which are read by the db at startup and allow us to access the database with this user and password. - -Finally, the `-d` option tells docker to start a demon process. Which means, that the console window, you're running this command in, will be available again after it is issued. If you skip this parameter, the console will be directly showing the output from the process. - -`-p` option maps container ports to host ports and allows other containers on our host to access them. - -This starts the database container. It can be confirmed as: - -[source, text] ----- -> docker ps -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -047bab6a86fe classroom.example.com:5000/postgres:latest "/docker-entrypoint. 42 seconds ago Up 3 seconds 0.0.0.0:5432->5432/tcp db ----- - -Server logs can be viewed as: - -[source, text] ----- -docker logs -f db ----- - -The `-f` flag keeps refreshing the logs and pushes new events directly out to the console. - -### Start Application Server - -Start WildFly server as: - -[source, text] ----- -docker run -d --name wildfly -p 8080:8080 --link db:db -v /Users/youruser/tmp/deployments:/opt/jboss/wildfly/standalone/deployments/:rw classroom.example.com:5000/wildfly ----- - -Make sure to replace `/Users/youruser/tmp/deployments` to a directory on your local machine. Also, make sure this directory already exists. - -This command starts a container named ``wildfly''. `--link` takes two parameters - first is name of the container we're linking to and second is the alias for the link name. - -.Container Linking -[NOTE] -=============================== -Creating a link between two containers creates a conduit between a source container and a target container and securely transfer information about source container to target container. - -In our case, target container (WildFly) can see information about source container (Postgres). When containers are linked, information about a source container can be sent to a recipient container. This allows the recipient to see selected data describing aspects of the source container. - -See more about container communication on the Docker website link:https://docs.docker.com/userguide/dockerlinks/[Linking Containers Together] -=============================== - -The `-v` flag maps a directory from the host into the container. This will be the directory to put the deployments. `rw` ensures that the Docker container can write to it. - -WARNING: Windows users, please make sure to use `-v /c/Users/` notation for drive letters. - -Check logs to verify if the server has started. - -[source, text] ----- -docker logs -f wildfly ----- - -And access the http://dockerhost:8080 with your webbrowser to make sure the instance is up and running. - -Now you're ready to deploy the application for the first time. Let's use JBoss Developer Studio for this. - -### Configure JBoss Developer Studio - -Start JBoss Developer Studio, if not already started. - -. Create a server adapter -+ -.Server adapter -image::jbds1.png[] -+ -. Assign or create a WildFly 8.x runtime (changed properties are highlighted.) -+ -.WildFly Runtime Properties -image::jbds2.png[] -+ -. Setup server properties as shown in the following image. -+ -Two properties on the left are automatically propagated from the previous dialog. Additional two properties on the right side are required to disable to keep deployment scanners in sync with the server. -+ -.Server properties -image::jbds3.png[] -+ -. Specify a custom deployment folder on Deployment tab of Server Editor -+ -.Server Editor -image::jbds4.png[] -+ -. Right-click on the newly created server adapter and click ``Start''. -+ -.Start Server -image::jbds5.png[] - -### Deploy Application Using Shared Volumes - -Open Ticket Monster application source code. Right-click on the project, select ``Run on Server'' and chose the previously created server. - -The project runs and displays the start page of Ticket Monster application. - -.Start Server -image::jbds6.png[] - -Congratulations! You've just deployed your first application to WildFly running in a Docker container from JBoss Developer Studio. - -Stop WildFly container when you're done. - -[source, text] ----- -docker stop wildfly ----- - -### Deploy Application Using CLI (OPTIONAL) - -The Command Line Interface (CLI) is a tool for connecting to WildFly instances to manage all tasks from command line environment. Some of the tasks that you can do using the CLI are: - -. Deploy/Undeploy web application in standalone/Domain Mode. -. View all information about the deployed application on runtime. -. Start/Stop/Restart Nodes in respective mode i.e. Standalone/Domain. -. Adding/Deleting resource or subsystems to servers. - -Lets use the CLI to deploy Ticket Monster to WildFly running in the container. - -. CLI needs to be locally installed and comes as part of WildFly. Download WildFly 8.2 from http://classroom.example.com:8082/downloads/wildfly-8.2.0.Final.zip. Unzip into a folder of your choice (e.g. `/Users/arungupta/tools/`). This will create `wildfly-8.2.0.Final` directory here. This folder is named $WIDLFY_HOME from here on. Make sure to add the `/Users/arungupta/tools/wildfly-8.2.0.Final/bin` to your $PATH. -+ -[source, text] ----- -# Windows Example -set PATH=%PATH%;%WILDFLY_HOME%/bin ----- -+ -. Run the ``wildfly-management'' image with fixed port mapping as explained in <>. -. Run the `jboss-cli` command and connect to the WildFly instance. -+ -[source, text] ----- -cd %WIDLFY_HOME%/bin -./jboss-cli.sh --controller=dockerhost:9990 -u=admin -p=docker#admin -c ----- -+ -This will show the output as: -+ -[source, text] ----- -[standalone@dockerhost:9990 /] ----- -+ -. Deploy the application as: -+ -[source, text] ----- -deploy /ticket-monster.war --force ----- - -Now you've sucessfully used the CLI to remote deploy the Ticket Monster application to WildFly running as docker container. - -And again, keep the container running, we're going to look into the last deployment option you have. - -### Deploy Application Using Web Console (OPTIONAL) - -WildFly comes with a web-based administration console. It also relies on the same management APIs that we've already been using via JBoss Developer Tools and the CLI. It does provide a nice web-based way to administrate your instance and if you've already exposed the container ports, you can simply access it via the URL: http://dockerhost:9990 in your web browser. - -.WildFly Web Console -image::console1.png[] - -Username and password credentials are shown in <>. Now navigate through the console and execute the following steps to deploy the application: - -. Go to the ``Deployments'' tab. -. Click on ``Add'' button. -. On ``Step 1/2: Deployment Selection'' screen, select the /ticket-monster.war file on your computer and click ``Next''. This would be `ticket-monster/demo/target/ticket-monster.war` from <>. -. On the ``Step 2/2: Verify Deployment Names'' screen, select ``Enable'' checkbox, and click on ``Save''. - -This will complete the deployment of Ticket Monster using Admin Console. - -### Deploy Application Using Management API (OPTIONAL) - -A standalone WildFly process, process can be configured to listen for remote management requests using its ``native management interface''. The CLI tool that comes with the application server uses this interface, and user can develop custom clients that use it as well. In order to use this, WildFly management interface listen IP needs to be changed from 127.0.0.1 to 0.0.0.0 which basically means, that it is not only listening on the localhost but also on all publicly assigned IP addresses. - -. Start another WildFly instance again: -+ -[source, text] ----- -docker run -d --name wildflymngm -p 8080:8080 -p 9990:9990 --link db:db classroom.example.com:5000/wildfly-management ----- -+ -There is no mapped volume in this case but an additional port exposed. The WildFly image that is used makes it easier for you to play around with the deployment via the management API. It has a tweaked start script which changes the management interface according to the behavior described in the first sentence. -+ -. Create another new server adapter in JBoss Developer Studio. -+ -.Create New Server Adapter -image::jbds7.png[] -+ -. Keep the defaults in the adapter properties. -+ -.Adapter Properties -image::jbds8.png[] -+ -. Set up server properties by specifying the admin credentials (docker#admin). Note, you need to delete the existing password and use this instead: -+ -.Management Login Credentials -image::jbds9.png[] -+ -. Right-click on the newly created server adapter and click ``Start''. Status quickly changes to ``Started, Synchronized'' as shown. -+ -.Synchronized WildFly Server -image::jbds10.png[] -+ -. Right-click on the Ticket Monster project, select ``Run on Server'' and choose this server. The project runs and displays the start page of ticket-monster. -. Stop WildFly when you're done. -+ -[source, text] ----- -docker stop wildflymngm ----- diff --git a/chapters/docker-troubleshooting.adoc b/chapters/docker-troubleshooting.adoc deleted file mode 100644 index b163eb8..0000000 --- a/chapters/docker-troubleshooting.adoc +++ /dev/null @@ -1,112 +0,0 @@ -:imagesdir: images - -== Troubleshooting - -=== Network Timed Out - -Depending upon the network speed and restrictions, you may not be able to download Docker images from Docker Hub. The error message may look like: - -```console -$ docker pull arungupta/wildfly-mysql-javaee7 -Using default tag: latest -Pulling repository docker.io/arungupta/wildfly-mysql-javaee7 -Network timed out while trying to connect to https://index.docker.io/v1/repositories/arungupta/wildfly-mysql-javaee7/images. You may want to check your internet connection or if you are behind a proxy. -``` - -This section provide a couple of alternatives to solve this. - -==== Restart Docker Machine - -It seems like Docker Machine gets into a strange state and restarting it fixes that. - -```console -docker-machine restart -eval $(docker-machine env ) -``` - -==== Loading Images Offline - -Images can be downloaded from a previously saved `.tar` file. All images required for this workshop can be downloaded from: - -https://drive.google.com/folderview?id=0B8g4lYJ4uB37RkdqbFpPZU5ZS2s&usp=sharing - -Load the tar file: - -[source, text] ----- -docker load -i ----- - -For example: - -[source, text] ----- -docker load -i arungupta-javaee7-hol.tar ----- - -Now `docker images` should show the image. - -=== Cannot create Docker Machine on Windows - -Are you not able to create Docker Machine on Windows? - -Try starting a `cmd` with Administrator privileges and then give the command again. - -=== No route to host - -Accessing the WildFly and MySQL sample in Kubernetes gives 404 when you give the command `curl http://10.246.1.23:8080/employees/resources/employees/`. - -This may be resolved by stopping the node and restarting the cluster again: - -```console -vagrant halt minion-1 -./cluster/kube-up.sh -``` - -These commands need to be given in the '`kubernetes`' directory. - -=== Docker machine creation fails with an error about dial tcp: i/o timeout - -If you get the following error when creating a docker machine - -[source, text] ----- -Error creating machine: Error in driver during machine creation: Get https://api.github.com/repos/boot2docker/boot2docker/releases: dial tcp: i/o timeout ----- - -Then you need to go to the boot2docker releases page on - -https://github.com/boot2docker/boot2docker/releases - -And download the latest .iso - -After that you can move that iso to the docker cache directory. This is located in `~/.docker/machine/cache` on Mac & Linux and `/Users/yourUserName/.docker/machine/cache` on Windows. - -Issue: https://github.com/docker/machine/issues/2186 is raised so that the docker-machine team can hopefully find a way around this. - -=== "`You may be getting rate limited by Github`" error message - -Credits: https://github.com/docker/machine/blob/master/README.md#troubleshooting - -In order to `create` or `upgrade` virtual machines running Docker, Docker -Machine will check the Github API for the latest release of the [boot2docker -operating system](https://github.com/boot2docker/boot2docker). The Github API -allows for a small number of unauthenticated requests from a given client, but -if you share an IP address with many other users (e.g. in an office), you may -get rate limited by their API, and Docker Machine will error out with messages -indicating this. - -In order to work around this issue, you can https://help.github.com/articles/creating-an-access-token-for-command-line-use/[generate a -token] and pass it to Docker Machine using the global `--github-api-token` flag: - -```console -$ docker-machine --github-api-token=token create -d virtualbox newbox -``` - -This should eliminate any issues you've been experiencing with rate limiting. - -=== Docker Machine Troubleshooting - -https://github.com/docker/machine/blob/master/README.md#troubleshooting[Docker Machine Troubleshooting] section has good tips on what can possibly go wrong with Docker Machine. Look there if your issue is not explained here. - -=== diff --git a/chapters/docker-tutum.adoc b/chapters/docker-tutum.adoc deleted file mode 100644 index c885a07..0000000 --- a/chapters/docker-tutum.adoc +++ /dev/null @@ -1,135 +0,0 @@ -:imagesdir: images - -== Deploy Docker Containers to Amazon using Tutum - -=== Key Concepts - -Docker Tutum is a SaaS that allows you to build, deploy and manage Docker containers in a variety of clouds. - -There are three main features: - -- *Build* and run your code using Tutum's free private registry -- *Deploy* applications using Tutum to manage Clusters that are fault tolerant and scalable. Tutum handles the orchestration of your infrastructure and application containers. -- *Manage* your applications through Tutum's intuitive Dashboard, simple API, or CLI tool. With built-in logs and data monitoring, all the info you need is at your fingertips. - -The main concepts of Docker Tutum are explained below: - -.Tutum Architecture -image:images/docker-tutum-architecture.png[] - -. (A) Node clusters are logical groups of nodes of the same type. Tutum pools your nodes resources, so your apps can run together thereby reducing complexity and waste. Node Clusters can be easily scaled with a drag of the slider. -. (B) Nodes are individual Linux hosts/VMs used to deploy and run your applications. New nodes can be provisioned right from within Tutum to increase the capacity of your Node Clusters. -. (C) Containers, (D) Links and (E) Volumes are Docker concepts. -. (F) Services are logical groups of Docker containers from the same image. Services make it simple to scale your application across different nodes. Simply drag a slider to increase or decrease the availability, performance, and redundancy of your application. - -=== Deploy Couchbase Docker Container on Amazon using Tutum - -https://support.tutum.co/support/solutions/5000042949[Docker Tutum Getting Started] provides detailed steps on how to get started. Here are the steps that you need to follow to run Couchbase Docker container in Amazon using Docker Tutum. - -. Get started for free (at least while its in beta) by https://dashboard.tutum.co/accounts/login/[logging in] using Docker Hub account. -. Link https://support.tutum.co/support/solutions/articles/5000224910-link-your-amazon-web-services-account[Amazon Web Services credentials with Tutum]. I just had to specify Access Key Id and Secret Access Key.If you create a new account for this then you may have to attach a policy to enable privileges such that new instances can be provisioned on your behalf. -. Create a new node cluster at dashboard.tutum.co/node/launch/ -+ -image:images/docker-tutum-new-node-cluster.png[] -+ -The values that need to be specified/changed: -+ -.. Node cluster name -.. Deploy tags (optional) -.. Type/size to t2.medium -.. Disk size reduce from 60 to 20 GB (optional) -+ -Takes a few minutes to provision the AMI. Updated status could be seen on https://us-west-1.console.aws.amazon.com/ec2/v2/home?region=us-west-1#Instances:sort=instanceId[AWS Console]: -+ -image:images/docker-tutum-aws-console.png[] -+ -Tutum dashboard shows the following status after the node is created: -+ -image:images/docker-tutum-node-created.png[] -+ -. Create your first service at http://dashboard.tutum.co/container/launch/. Select "`Public Repositories`" and search for "`arungupta/couchbase-node`". -+ -image:images/docker-tutum-new-service.png[] -+ -This image is created from http://github.com/arun-gupta/docker-images/tree/master/couchbase-node. This image performs the following: -+ -.. Starts Couchbase server -.. Configures the server using http://developer.couchbase.com/documentation/server/current/rest-api/rest-endpoints-all.html[Couchbase REST API] -+ -. Click on "`Select`" and configure. You only need to override the ports and take all other defaults: -+ -image:images/docker-tutum-couchbase-configuration.png[] -+ -Click on "`Create and Deploy`". -+ -. Dashboard is updated after the service is deployed: -+ -image:images/docker-tutum-couchbase-service.png[] -+ -. Click on "`Logs`" to see logs from the Couchbase Docker container: -+ -image:images/docker-tutum-couchbase-logs.png[] -+ -. Find IP address from the AWS Console: -+ -image:images/docker-tutum-aws-console-ipaddress.png[] -+ -. Access Couchbase Console at :8091, in our case http://54.67.111.235:8091. This will show the login screen of Couchbase: -+ -image:images/docker-tutum-couchbase-console-login.png[] -+ -Enter the username "`Administrator`" and password "`password`". -+ -. This shows the Couchbase Console: -+ -image:images/docker-tutum-couchbase-console.png[] - -=== Create/Access Sample Bucket on Couchbase - -. Click on "`Settings`", "`Sample Buckets`". This shows the list of sample buckets that can be installed. -. Select "`travel-sample`" and click on "`Create`". The updated console looks like: -+ -image:images/docker-tutum-couchbase-travel-sample.png[] -+ -. If you've downloaded Couchbase server locally, then you can use http://developer.couchbase.com/documentation/server/current/cli/cbq-tool.html[Couchbase Query CLI Tool] (cbq) to connect and query: -+ -[source, text] ----- -bin > ./cbq -engine=http://54.67.111.235:8093 -Couchbase query shell connected to http://54.67.111.235:8093/ . Type Ctrl-D to exit. -cbq> select * from `travel-sample` limit 1; -{ - "requestID": "aec63fba-a85a-4763-9453-1d7ea0c5409c", - "signature": { - "*": "*" - }, - "results": [ - { - "travel-sample": { - "callsign": "MILE-AIR", - "country": "United States", - "iata": "Q5", - "icao": "MLA", - "id": 10, - "name": "40-Mile Air", - "type": "airline" - } - } - ], - "status": "success", - "metrics": { - "elapsedTime": "10.135335ms", - "executionTime": "10.091507ms", - "resultCount": 1, - "resultSize": 300 - } -} ----- -+ -Couchbase allows to query document database using http://www.couchbase.com/n1ql[SQL-like syntax], aka N1QL. - -=== Access Couchbase using Java application - -Use instructions from https://github.com/arun-gupta/couchbase-javaee. - - diff --git a/chapters/docker-vs-kubernetes.adoc b/chapters/docker-vs-kubernetes.adoc deleted file mode 100644 index 40f34fa..0000000 --- a/chapters/docker-vs-kubernetes.adoc +++ /dev/null @@ -1,22 +0,0 @@ -:imagesdir: images - -== Docker Swarm vs Kubernetes - -[width="100%", options="header"] -|================== -| Feature | Docker Swarm | Kubernetes -| Single Master | Yes | Yes -| Multiple Master | Yes | Status on Version 1: http://kubernetes.io/v1.0/docs/admin/high-availability.html, Proposal: http://kubernetes.io/v1.0/docs/proposals/high-availability.html -| Multi-host networking | 1.9+ | Yes -| Multiple clouds | https://docs.docker.com/machine/drivers/ | http://kubernetes.io/v1.0/docs/getting-started-guides/#turn-key-cloud-solutions -| Cluster across multiple clouds | Yes | Yes when using cross-cloud network solution -| Dynamic Scaling | Compose Services (partial) | Replication Controller -| Container distribution strategies | spread, binpack, random | Yes -| Pluggable strategies | Yes | Yes -| Development | Docker Machine | Vagrant -| Service Discovery | `container_name` in Compose | Service -| Commercially supported | 1.9+ | Yes -| Affinity | Labels | Pods -| Constraits | `-c`, `-m` | Labels -| Persistent Volumes | https://docs.docker.com/v1.8/userguide/dockervolumes/ | http://kubernetes.io/v1.0/docs/user-guide/persistent-volumes.html -|================== diff --git a/chapters/ducp.adoc b/chapters/ducp.adoc deleted file mode 100644 index 5719c86..0000000 --- a/chapters/ducp.adoc +++ /dev/null @@ -1,5 +0,0 @@ -:imagesdir: images - -= Docker Universal Control Plane - -Docker Universal Control Plane (DUCP) offers an on-premises management solution for Docker apps - regardless of where they run. DUCP can deployed to any private infrastructure and public clouds including Microsoft Azure, Digital Ocean, Amazon Web Services, and SoftLayer. diff --git a/chapters/images/console1.png b/chapters/images/console1.png deleted file mode 100644 index 8f9103c..0000000 Binary files a/chapters/images/console1.png and /dev/null differ diff --git a/chapters/images/docker-architecture.png b/chapters/images/docker-architecture.png deleted file mode 100644 index 26d8058..0000000 Binary files a/chapters/images/docker-architecture.png and /dev/null differ diff --git a/chapters/images/docker-swarm-components.png b/chapters/images/docker-swarm-components.png deleted file mode 100644 index 21b498d..0000000 Binary files a/chapters/images/docker-swarm-components.png and /dev/null differ diff --git a/chapters/images/docker-tutum-architecture.png b/chapters/images/docker-tutum-architecture.png deleted file mode 100644 index c62cc20..0000000 Binary files a/chapters/images/docker-tutum-architecture.png and /dev/null differ diff --git a/chapters/images/docker-tutum-aws-console-ipaddress.png b/chapters/images/docker-tutum-aws-console-ipaddress.png deleted file mode 100644 index 134c6ee..0000000 Binary files a/chapters/images/docker-tutum-aws-console-ipaddress.png and /dev/null differ diff --git a/chapters/images/docker-tutum-aws-console.png b/chapters/images/docker-tutum-aws-console.png deleted file mode 100644 index 8c33304..0000000 Binary files a/chapters/images/docker-tutum-aws-console.png and /dev/null differ diff --git a/chapters/images/docker-tutum-couchbase-configuration.png b/chapters/images/docker-tutum-couchbase-configuration.png deleted file mode 100644 index ec45716..0000000 Binary files a/chapters/images/docker-tutum-couchbase-configuration.png and /dev/null differ diff --git a/chapters/images/docker-tutum-couchbase-console-login.png b/chapters/images/docker-tutum-couchbase-console-login.png deleted file mode 100644 index ccf6b88..0000000 Binary files a/chapters/images/docker-tutum-couchbase-console-login.png and /dev/null differ diff --git a/chapters/images/docker-tutum-couchbase-console.png b/chapters/images/docker-tutum-couchbase-console.png deleted file mode 100644 index db74d3a..0000000 Binary files a/chapters/images/docker-tutum-couchbase-console.png and /dev/null differ diff --git a/chapters/images/docker-tutum-couchbase-logs.png b/chapters/images/docker-tutum-couchbase-logs.png deleted file mode 100644 index e00166d..0000000 Binary files a/chapters/images/docker-tutum-couchbase-logs.png and /dev/null differ diff --git a/chapters/images/docker-tutum-couchbase-service.png b/chapters/images/docker-tutum-couchbase-service.png deleted file mode 100644 index 912445e..0000000 Binary files a/chapters/images/docker-tutum-couchbase-service.png and /dev/null differ diff --git a/chapters/images/docker-tutum-couchbase-travel-sample.png b/chapters/images/docker-tutum-couchbase-travel-sample.png deleted file mode 100644 index ffd4b12..0000000 Binary files a/chapters/images/docker-tutum-couchbase-travel-sample.png and /dev/null differ diff --git a/chapters/images/docker-tutum-new-node-cluster.png b/chapters/images/docker-tutum-new-node-cluster.png deleted file mode 100644 index f3acb90..0000000 Binary files a/chapters/images/docker-tutum-new-node-cluster.png and /dev/null differ diff --git a/chapters/images/docker-tutum-new-service.png b/chapters/images/docker-tutum-new-service.png deleted file mode 100644 index a7d1819..0000000 Binary files a/chapters/images/docker-tutum-new-service.png and /dev/null differ diff --git a/chapters/images/docker-tutum-node-created.png b/chapters/images/docker-tutum-node-created.png deleted file mode 100644 index c144f92..0000000 Binary files a/chapters/images/docker-tutum-node-created.png and /dev/null differ diff --git a/chapters/images/javaee7-hol-container-linking.png b/chapters/images/javaee7-hol-container-linking.png deleted file mode 100644 index 3bc6e1a..0000000 Binary files a/chapters/images/javaee7-hol-container-linking.png and /dev/null differ diff --git a/chapters/images/javaee7-hol-in-memory-database.png b/chapters/images/javaee7-hol-in-memory-database.png deleted file mode 100644 index d5262f1..0000000 Binary files a/chapters/images/javaee7-hol-in-memory-database.png and /dev/null differ diff --git a/chapters/images/javaee7-hol.png b/chapters/images/javaee7-hol.png deleted file mode 100644 index ebf0f96..0000000 Binary files a/chapters/images/javaee7-hol.png and /dev/null differ diff --git a/chapters/images/javaee7-movieplex7.png b/chapters/images/javaee7-movieplex7.png deleted file mode 100644 index dc3b09f..0000000 Binary files a/chapters/images/javaee7-movieplex7.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools-all-containers.png b/chapters/images/jbds-docker-tools-all-containers.png deleted file mode 100644 index 3a7f734..0000000 Binary files a/chapters/images/jbds-docker-tools-all-containers.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools-customize-view-option.png b/chapters/images/jbds-docker-tools-customize-view-option.png deleted file mode 100644 index adcfe9e..0000000 Binary files a/chapters/images/jbds-docker-tools-customize-view-option.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools-customize-view-wizard.png b/chapters/images/jbds-docker-tools-customize-view-wizard.png deleted file mode 100644 index b4d6f88..0000000 Binary files a/chapters/images/jbds-docker-tools-customize-view-wizard.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools-display-log.png b/chapters/images/jbds-docker-tools-display-log.png deleted file mode 100644 index 4feb7e8..0000000 Binary files a/chapters/images/jbds-docker-tools-display-log.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools-docker-explorer-view.png b/chapters/images/jbds-docker-tools-docker-explorer-view.png deleted file mode 100644 index d2920e5..0000000 Binary files a/chapters/images/jbds-docker-tools-docker-explorer-view.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools-docker-view.png b/chapters/images/jbds-docker-tools-docker-view.png deleted file mode 100644 index 4b81921..0000000 Binary files a/chapters/images/jbds-docker-tools-docker-view.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools-nightly-setup.png b/chapters/images/jbds-docker-tools-nightly-setup.png deleted file mode 100644 index 0ad6ac2..0000000 Binary files a/chapters/images/jbds-docker-tools-nightly-setup.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools-properties-info.png b/chapters/images/jbds-docker-tools-properties-info.png deleted file mode 100644 index 8985907..0000000 Binary files a/chapters/images/jbds-docker-tools-properties-info.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools-properties-inspect.png b/chapters/images/jbds-docker-tools-properties-inspect.png deleted file mode 100644 index acbbf6f..0000000 Binary files a/chapters/images/jbds-docker-tools-properties-inspect.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools-run-container-wizard.png b/chapters/images/jbds-docker-tools-run-container-wizard.png deleted file mode 100644 index 5d252c2..0000000 Binary files a/chapters/images/jbds-docker-tools-run-container-wizard.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools-test-connection-output.png b/chapters/images/jbds-docker-tools-test-connection-output.png deleted file mode 100644 index 80de4b9..0000000 Binary files a/chapters/images/jbds-docker-tools-test-connection-output.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools1.png b/chapters/images/jbds-docker-tools1.png deleted file mode 100644 index 414f2eb..0000000 Binary files a/chapters/images/jbds-docker-tools1.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools2.png b/chapters/images/jbds-docker-tools2.png deleted file mode 100644 index 3080bbb..0000000 Binary files a/chapters/images/jbds-docker-tools2.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools3.png b/chapters/images/jbds-docker-tools3.png deleted file mode 100644 index 51998e5..0000000 Binary files a/chapters/images/jbds-docker-tools3.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools4.png b/chapters/images/jbds-docker-tools4.png deleted file mode 100644 index 9391143..0000000 Binary files a/chapters/images/jbds-docker-tools4.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools5.png b/chapters/images/jbds-docker-tools5.png deleted file mode 100644 index d2dba49..0000000 Binary files a/chapters/images/jbds-docker-tools5.png and /dev/null differ diff --git a/chapters/images/jbds-docker-tools6.png b/chapters/images/jbds-docker-tools6.png deleted file mode 100644 index 83ef088..0000000 Binary files a/chapters/images/jbds-docker-tools6.png and /dev/null differ diff --git a/chapters/images/jbds1.png b/chapters/images/jbds1.png deleted file mode 100644 index e3a6323..0000000 Binary files a/chapters/images/jbds1.png and /dev/null differ diff --git a/chapters/images/jbds10.png b/chapters/images/jbds10.png deleted file mode 100644 index 129a36e..0000000 Binary files a/chapters/images/jbds10.png and /dev/null differ diff --git a/chapters/images/jbds11.png b/chapters/images/jbds11.png deleted file mode 100644 index c48c0e3..0000000 Binary files a/chapters/images/jbds11.png and /dev/null differ diff --git a/chapters/images/jbds2.png b/chapters/images/jbds2.png deleted file mode 100644 index 5fe5692..0000000 Binary files a/chapters/images/jbds2.png and /dev/null differ diff --git a/chapters/images/jbds3.png b/chapters/images/jbds3.png deleted file mode 100644 index 8538773..0000000 Binary files a/chapters/images/jbds3.png and /dev/null differ diff --git a/chapters/images/jbds4.png b/chapters/images/jbds4.png deleted file mode 100644 index 55cd5ed..0000000 Binary files a/chapters/images/jbds4.png and /dev/null differ diff --git a/chapters/images/jbds5.png b/chapters/images/jbds5.png deleted file mode 100644 index 71b9012..0000000 Binary files a/chapters/images/jbds5.png and /dev/null differ diff --git a/chapters/images/jbds6.png b/chapters/images/jbds6.png deleted file mode 100644 index f0cc952..0000000 Binary files a/chapters/images/jbds6.png and /dev/null differ diff --git a/chapters/images/jbds7.png b/chapters/images/jbds7.png deleted file mode 100644 index 17c1c41..0000000 Binary files a/chapters/images/jbds7.png and /dev/null differ diff --git a/chapters/images/jbds8.png b/chapters/images/jbds8.png deleted file mode 100644 index 675d7f7..0000000 Binary files a/chapters/images/jbds8.png and /dev/null differ diff --git a/chapters/images/jbds9.png b/chapters/images/jbds9.png deleted file mode 100644 index 02efa97..0000000 Binary files a/chapters/images/jbds9.png and /dev/null differ diff --git a/chapters/images/kubernetes-cluster-vagrant.png b/chapters/images/kubernetes-cluster-vagrant.png deleted file mode 100644 index 1297b95..0000000 Binary files a/chapters/images/kubernetes-cluster-vagrant.png and /dev/null differ diff --git a/chapters/images/kubernetes-key-components.png b/chapters/images/kubernetes-key-components.png deleted file mode 100644 index 4ccab77..0000000 Binary files a/chapters/images/kubernetes-key-components.png and /dev/null differ diff --git a/chapters/images/kubernetes-master-default-output-certificate.png b/chapters/images/kubernetes-master-default-output-certificate.png deleted file mode 100644 index d85f769..0000000 Binary files a/chapters/images/kubernetes-master-default-output-certificate.png and /dev/null differ diff --git a/chapters/images/kubernetes-master-default-output.png b/chapters/images/kubernetes-master-default-output.png deleted file mode 100644 index 92072df..0000000 Binary files a/chapters/images/kubernetes-master-default-output.png and /dev/null differ diff --git a/chapters/images/kubernetes-service.png b/chapters/images/kubernetes-service.png deleted file mode 100644 index 7a153b3..0000000 Binary files a/chapters/images/kubernetes-service.png and /dev/null differ diff --git a/chapters/images/openshiftv3-stack.png b/chapters/images/openshiftv3-stack.png deleted file mode 100644 index f67fcc2..0000000 Binary files a/chapters/images/openshiftv3-stack.png and /dev/null differ diff --git a/chapters/images/openshiftv3-wildfly-mysql-deployment.png b/chapters/images/openshiftv3-wildfly-mysql-deployment.png deleted file mode 100644 index 5d7a392..0000000 Binary files a/chapters/images/openshiftv3-wildfly-mysql-deployment.png and /dev/null differ diff --git a/chapters/images/plain-wildfly0.png b/chapters/images/plain-wildfly0.png deleted file mode 100644 index 58d5484..0000000 Binary files a/chapters/images/plain-wildfly0.png and /dev/null differ diff --git a/chapters/images/plain-wildfly1.png b/chapters/images/plain-wildfly1.png deleted file mode 100644 index 7759697..0000000 Binary files a/chapters/images/plain-wildfly1.png and /dev/null differ diff --git a/chapters/images/ticket-monster_tutorial_architecture.png b/chapters/images/ticket-monster_tutorial_architecture.png deleted file mode 100644 index c3dcd29..0000000 Binary files a/chapters/images/ticket-monster_tutorial_architecture.png and /dev/null differ diff --git a/chapters/images/wildfly-admin-console.png b/chapters/images/wildfly-admin-console.png deleted file mode 100644 index e5c3d68..0000000 Binary files a/chapters/images/wildfly-admin-console.png and /dev/null differ diff --git a/chapters/images/wildfly9-add-deployments.png b/chapters/images/wildfly9-add-deployments.png deleted file mode 100644 index a3661d8..0000000 Binary files a/chapters/images/wildfly9-add-deployments.png and /dev/null differ diff --git a/chapters/images/wildfly9-deployments-tab.png b/chapters/images/wildfly9-deployments-tab.png deleted file mode 100644 index 8eb582f..0000000 Binary files a/chapters/images/wildfly9-deployments-tab.png and /dev/null differ diff --git a/chapters/images/wildfly9-javaee7-simple-sample-deployed.png b/chapters/images/wildfly9-javaee7-simple-sample-deployed.png deleted file mode 100644 index f66d36c..0000000 Binary files a/chapters/images/wildfly9-javaee7-simple-sample-deployed.png and /dev/null differ diff --git a/chapters/images/wildfly9-javaee7-simple-sample-output.png b/chapters/images/wildfly9-javaee7-simple-sample-output.png deleted file mode 100644 index fefe161..0000000 Binary files a/chapters/images/wildfly9-javaee7-simple-sample-output.png and /dev/null differ diff --git a/chapters/images/wildfly_cluster1.png b/chapters/images/wildfly_cluster1.png deleted file mode 100644 index 3307a19..0000000 Binary files a/chapters/images/wildfly_cluster1.png and /dev/null differ diff --git a/chapters/images/wildfly_cluster2.png b/chapters/images/wildfly_cluster2.png deleted file mode 100644 index fbfb28b..0000000 Binary files a/chapters/images/wildfly_cluster2.png and /dev/null differ diff --git a/chapters/images/wildfly_cluster3.png b/chapters/images/wildfly_cluster3.png deleted file mode 100644 index 4012648..0000000 Binary files a/chapters/images/wildfly_cluster3.png and /dev/null differ diff --git a/chapters/images/wildfly_cluster4.png b/chapters/images/wildfly_cluster4.png deleted file mode 100644 index 050750b..0000000 Binary files a/chapters/images/wildfly_cluster4.png and /dev/null differ diff --git a/convert.sh b/convert.sh deleted file mode 100755 index 6329515..0000000 --- a/convert.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -# Run using: -# -# ./convert.sh -# -# or -# -# ./convert.sh html,pdf -# -# ...where the first argument is a comma-delimited list of formats - -# Program paths -ASCIIDOCTOR=asciidoctor -FOPUB=./asciidoctor-tools/asciidoctor-fopub/fopub -ASCIIDOCTOR_PDF=./asciidcotor-tools/asciidoctor-pdf/bin/asciidoctor-pdf -#FOPUB=~/projects/asciidoctor/fopub/fopub -#ASCIIDOCTOR_PDF=~/projects/asciidoctor/asciidoctor-pdf/bin/asciidoctor-pdf - -# File names -MASTER_ADOC=readme.adoc -MASTER_DOCBOOK=${MASTER_ADOC/.adoc/.xml} - -# Command options -SHARED_OPTIONS='-a numbered -a experimental -a source-highlighter=coderay -a imagesdir=images' - -# Formats -if [ ! -z $1 ]; then - read -a FORMATS <<<$(IFS=','; echo $1) -else - FORMATS=(html -docbook -fopdf) -fi - -for f in ${FORMATS[*]}; do - if [ $f == 'html' ]; then - echo "Converting to HTML ..." - $ASCIIDOCTOR -v $SHARED_OPTIONS $MASTER_ADOC - elif [ $f == 'docbook' ]; then - echo "Converting to DocBook ..." - $ASCIIDOCTOR -b docbook $SHARED_OPTIONS $MASTER_ADOC - elif [ $f == 'fopdf' ]; then - echo "Converting to FO-PDF ..." - $FOPUB $MASTER_DOCBOOK - elif [ $f == 'pdf' ]; then - echo "Converting to PDF ..." - $ASCIIDOCTOR_PDF $SHARED_OPTIONS $MASTER_ADOC - fi -done - -exit 0 diff --git a/docker-orchestration-frameworks.adoc b/docker-orchestration-frameworks.adoc new file mode 100644 index 0000000..b8e9499 --- /dev/null +++ b/docker-orchestration-frameworks.adoc @@ -0,0 +1,30 @@ += Docker vs Kubernetes vs DC/OS vs ECS + +This document compares the four container orchestration frameworks: http://github.com/docker/docker[Docker Engine w/ Swarm Mode], https://github.com/kubernetes/kubernetes[Kubernetes], https://github.com/dcos/dcos[DC/OS], and https://aws.amazon.com/ecs/[ECS]. + + +[width="100%", options="header"] +|================== +| Feature | http://github.com/docker/docker[Docker] | https://github.com/kubernetes/kubernetes[Kubernetes] | https://github.com/dcos/dcos[DC/OS] | https://aws.amazon.com/ecs/[ECS] +| Local Development | https://www.docker.com/community-edition[Docker Community Edition] | https://github.com/kubernetes/minikube[minikube] | https://dcos.io/docs/1.8/administration/installing/local[DC/OS Vagrant] | https://github.com/blox/blox[Blox] +| Multiple clouds | https://docs.docker.com/docker-cloud/overview/[Docker Cloud], https://docs.docker.com/machine/drivers/[Docker Machine Drivers], https://www.docker.com/products/overview[Docker for AWS/Azure] | http://kubernetes.io/docs/getting-started-guides/#turn-key-cloud-solutions[Turn Key Cloud] | https://dcos.io/install/[Mulitple clouds] | AWS +| Service Discovery and Load Balancer | Docker-compse: DNS + +Docker Swarm: (https://docs.docker.com/engine/swarm/services/[Service]) | `Service` | Yes (https://dcos.io/docs/1.8/usage/service-discovery/[multiple]: DNS-based and proxy-based/L4 load balancer) | https://github.com/awslabs/service-discovery-ecs-dns[DNS-based], https://github.com/awslabs/ecs-refarch-service-discovery[ELB-based], https://github.com/awslabs/ecs-refarch-cloudformation[ALB-based] +| Dynamic Scaling | http://blog.couchbase.com/2016/july/docker-services-stack-distributed-application-bundle[Services, Distributed Application Bundle, Stack] | `Replica Set`, `Replication Controller`, `Deployment`, `Horizontal Pod Autoscaling` | Marathon app spec (instance count) and https://dcos.io/docs/1.8/usage/tutorials/autoscaling/[multiple options] | http://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-auto-scaling.html[Service Auto Scaling] +| Exposing a service | Routing mesh | `type=LoadBalancer` in `Deployment` | Multiple (direct placement on public agent or, preferred, via https://dcos.io/docs/1.8/usage/service-discovery/marathon-lb/marathon-lb-basic-tutorial/[Marathon-LB] | http://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-load-balancing.html[Classic and Application Load Balancer] +| Run-once job | `docker run` | `Job` | https://docs.mesosphere.com/1.8/usage/jobs/[Jobs] | http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_run_task.html[Tasks] +| Namespace | `docker-compose -p ` | `Namespace` | via labels in System Marathon | http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html#attributes[Custom Attributes] +| Global service| `--mode=global` | `DaemonSet` | Unique Attribute | 'distinctInstance' http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html#constraint-types[Task Placement Constraint] +| Maven | https://github.com/fabric8io/docker-maven-plugin[fabric8-maven-plugin] | https://github.com/fabric8io/docker-maven-plugin[fabric8-maven-plugin] | https://github.com/dcos-labs/dcos-maven-plugin[dcos-maven-plugin] | No +| Volumes | https://docs.docker.com/engine/tutorials/dockervolumes/[Docker Volumes] | http://kubernetes.io/docs/user-guide/persistent-volumes/[Persistent Volumes] | https://dcos.io/docs/1.8/usage/storage/persistent-volume/[local persistent volumes] as well as https://dcos.io/docs/1.8/usage/storage/external-storage/[external persistent volumes] | http://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_data_volumes.html[Using Data Volumes in Tasks] +| Multiple Master | Yes | link:https://github.com/kubernetes/kops[Yes] | Yes | Yes (default) +| Multi-host networking | Yes | Yes | Yes | https://github.com/aws/amazon-ecs-agent/pull/701[Proposed implementation] +| Rolling Update | https://github.com/arun-gupta/docker-scripts/blob/master/rolling-updates.adoc | https://github.com/arun-gupta/kubernetes-java-sample/tree/master/rolling-update | https://github.com/mhausenblas/zdd-lab[ZDD Lab] | http://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service.html[Updating a Service] +| Container distribution strategies | Automatic? | Automatic, but custom schedulers supported. | Automatic | http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html[Task Placement Strategies] +| Affinity | Labels | Node (1.2) and Pod (1.4) affinity http://kubernetes.io/docs/user-guide/node-selection/ | https://mesosphere.github.io/marathon/docs/constraints.html[Marathon constraints] and pods (in 1.9) | Via Task Placement Strategies and Constraints +| Constraints | `-c`, `-m` | `Labels` | https://mesosphere.github.io/marathon/docs/constraints.html[Marathon constraints] | http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html[Task Placement Constraints] +| On-premise | Yes | Yes | Yes | No +| Cluster across multiple clouds | Yes | Yes (http://kubernetes.io/docs/admin/multiple-zones/[partly]) | Yes (agents) | No (Can span multiple AZ) +| Commercially supported | https://www.docker.com/enterprise-edition[Docker Enterprise Edition] | Google, Apprenda, Canonical, CoreOS, link:http://cloud-rti.com[Cloud RTI] others? | https://mesosphere.com/product/[Mesosphere Enterprise DC/OS] | https://aws.amazon.com/premiumsupport/[AWS Support] +| Creating Couchbase Cluster | http://blog.couchbase.com/2016/may/couchbase-cluster-docker-swarm-compose-machine[blog] | http://blog.kubernetes.io/2016/08/create-couchbase-cluster-using-kubernetes.html[blog] | http://blog.couchbase.com/2016/november/couchbase-cluster-mesos-dcos[blog] | https://blog.couchbase.com/couchbase-docker-container-amazon-ecs/[blog] (one node) +|================== diff --git a/managed-container-service.adoc b/managed-container-service.adoc new file mode 100644 index 0000000..55dd186 --- /dev/null +++ b/managed-container-service.adoc @@ -0,0 +1,23 @@ += Managed Container Service + +This document compares managed container services. + +. https://www.docker.com/products/docker-datacenter[Docker Data Center] or https://docs.docker.com/docker-for-aws/[Docker for AWS] / https://docs.docker.com/docker-for-azure/[Azure] +. https://cloud.google.com/container-engine/[Google Container Engine] (GCE) +. https://dcos.io/[DC/OS] +. https://azure.microsoft.com/en-us/services/container-service/[Azure Container Service] (Azure) +. https://aws.amazon.com/ecs/[Amazon Elastic Container Service] (ECS) +. https://www.openshift.org/[Red Hat OpenShift] +. https://cloud.oracle.com/container[Oracle Cloud Container Service] + +[width="100%", options="header"] +|================== +| Feature | Docker | GCE | DC/OS | Azure | ECS | OpenShift | Oracle +| Company | Docker | Google | Mesosphere | Microsoft | Amazon | Red Hat | Oracle +| Orchestration Framework | Docker Engine | Kubernetes | Apache Mesos | Kubernetes | Closed source | Kubernetes | Closed source +| Docker version | | | | | | | +| CI/CD | | | | | | | +| REST API | | | | | | | +| Console | | | | | | | +|================== + diff --git a/readme.adoc b/readme.adoc index 5b8f4a0..b9c9726 100644 --- a/readme.adoc +++ b/readme.adoc @@ -1,56 +1,13 @@ -# Docker and Kubernetes for Java Developers -v1.6, Feb 12, 2016 -:toc: -:toc-title: Table of Contents -:toclevels: 3 -:toc-placement!: += Docker and Kubernetes for Java Developers -toc::[] +https://github.com/docker/labs/tree/master/developer-tools/java[Docker for Java developers] -link:chapters/docker-preface.adoc[Preface] +https://github.com/arun-gupta/kubernetes-java-sample/[Kubernetes for Java developers] -link:chapters/docker-setup.adoc[Setup Environments] +== Software Requirements -link:chapters/docker-basics.adoc[Docker Basics] - -link:chapters/docker-image.adoc[Build a Docker Image] - -link:chapters/docker-container.adoc[Run a Docker Container] - -link:chapters/docker-javaee7.adoc[Deploy and Test Java EE 7 Application] - -link:chapters/docker-deployment-options.adoc[Build and Deploy Java EE 7 Application] - -link:chapters/docker-maven.adoc[Docker Maven Plugin] - -link:chapters/docker-eclipse.adoc[Docker Tools in Eclipse] - -//// -link:chapters/docker-netbeans.adoc[] - -link:chapters/docker-intellij.adoc[] -//// - -link:chapters/docker-compose.adoc[Multiple Containers Using Docker Compose] - -//// -link:chapters/docker-mod-cluster.adoc[] -//// - -link:chapters/docker-swarm.adoc[Deploy Application on Docker Swarm Cluster] - -link:chapters/docker-tutum.adoc[Deploy Docker Containers to Amazon using Tutum] - -link:chapters/docker-kubernetes.adoc[Deploy Application on Kubernetes Cluster] - -//// -link:chapters/docker-continuous-delivery.adoc[] - -link:chapters/docker-openshift.adoc[] -//// - -link:chapters/docker-commands.adoc[Common Docker Commands] - -link:chapters/docker-troubleshooting.adoc[Troubleshooting] - -link:chapters/docker-references.adoc[References] +. Docker for Java: https://github.com/docker/labs/blob/master/developer-tools/java/chapters/ch01-setup.adoc +. Kubernetes for Java +.. Install: https://github.com/arun-gupta/kubernetes-java-sample/blob/master/workshop.adoc#initial-setup +.. An Amazon Web Services account +.. Clone: https://github.com/arun-gupta/kubernetes-java-sample diff --git a/scripts/jdays-keynote.adoc b/scripts/jdays-keynote.adoc new file mode 100644 index 0000000..160ded5 --- /dev/null +++ b/scripts/jdays-keynote.adoc @@ -0,0 +1,72 @@ += JDays Keynote Script + +== Docker (local dev) + +. `docker swarm init` +. `docker node ls` +. `docker info` +. +. Use `docker-compose.yml`: ++ +``` +version: "3" +services: + db: + image: arungupta/couchbase:travel + ports: + - 8091:8091 + - 8092:8092 + - 8093:8093 + - 11210:11210 + web: + image: arungupta/wildfly-couchbase-javaee:travel + environment: + - COUCHBASE_URI=db + ports: + - 8080:8080 + - 9990:9990 +``` ++ +. Deploy the app: `docker deploy --compose-file=docker-compose.yml webapp` +. `docker stack ls` +. `docker service ls` +. `docker service logs webapp_web` + +== Kubernetes + +. Register a domain: `kubernetes.arungupta.me` +. Create Route53 records +. Create NS records in GoDaddy +. Create a cluster: ++ +``` +kops create cluster \ +--name=kubernetes.arungupta.me \ +--cloud=aws \ +--zones=us-west-2a,us-west-2b,us-west-2c \ +--master-size=m3.medium \ +--node-count=3 \ +--node-size=m3.xlarge \ +--master-zones=us-west-2a,us-west-2b,us-west-2c \ +--state=s3://kops2 \ +--yes +``` + +== DC/OS + +. Launch https://downloads.dcos.io/dcos/stable/aws.html?_ga=1.207445715.1510362819.1478208859[DC/OS CloudFormation template] +. If not done already, download CLI +. `dcos config set core.dcos_url http://DCOS-ElasticLoadBa-OG73USRXKTX-912507967.us-west-1.elb.amazonaws.com` +. `dcos auth login` +. `dcos config show core.dcos_acs_token` +.. Copy the value in `.dcos-token` +. `dcos package install marathon-lb` +. Update `app-definition.json` with `PublicSlaveDnsAddress` +. Update `pom.xml` with `DnsAddress` +. Deploy app: `mvn install -Pdcos` +. Show services deployed at http:// +. Access application: curl http:///airlines/resources/airline + +== AWS ECS + +Show how to create a cluster and talk about service discovery diff --git a/slides/2016-Devoxx-Migrate-VM-to-Containers.key b/slides/2016-Devoxx-Migrate-VM-to-Containers.key new file mode 100644 index 0000000..8aaed2c Binary files /dev/null and b/slides/2016-Devoxx-Migrate-VM-to-Containers.key differ diff --git a/slides/2016-Devoxx-Migrate-VM-to-Containers.pdf b/slides/2016-Devoxx-Migrate-VM-to-Containers.pdf new file mode 100644 index 0000000..dd082a1 Binary files /dev/null and b/slides/2016-Devoxx-Migrate-VM-to-Containers.pdf differ diff --git a/slides/container-orchestration-aws.key b/slides/container-orchestration-aws.key new file mode 100644 index 0000000..089dee9 Binary files /dev/null and b/slides/container-orchestration-aws.key differ diff --git a/slides/container-orchestration-aws.pdf b/slides/container-orchestration-aws.pdf new file mode 100644 index 0000000..fa2c22e Binary files /dev/null and b/slides/container-orchestration-aws.pdf differ diff --git a/slides/course/chapter1.key b/slides/course/chapter1.key new file mode 100644 index 0000000..7835bac Binary files /dev/null and b/slides/course/chapter1.key differ diff --git a/slides/course/chapter2.key b/slides/course/chapter2.key new file mode 100644 index 0000000..113b592 Binary files /dev/null and b/slides/course/chapter2.key differ diff --git a/slides/course/chapter3.key b/slides/course/chapter3.key new file mode 100644 index 0000000..d318d49 Binary files /dev/null and b/slides/course/chapter3.key differ diff --git a/slides/course/chapter4.key b/slides/course/chapter4.key new file mode 100644 index 0000000..f059702 Binary files /dev/null and b/slides/course/chapter4.key differ diff --git a/slides/course/chapter5.key b/slides/course/chapter5.key new file mode 100644 index 0000000..da63f39 Binary files /dev/null and b/slides/course/chapter5.key differ diff --git a/slides/course/chapter6.key b/slides/course/chapter6.key new file mode 100644 index 0000000..56f1230 Binary files /dev/null and b/slides/course/chapter6.key differ diff --git a/slides/course/pre.key b/slides/course/pre.key new file mode 100644 index 0000000..8f6f556 Binary files /dev/null and b/slides/course/pre.key differ diff --git a/slides/docker-introduction.key b/slides/docker-introduction.key index 12067fc..f222026 100644 Binary files a/slides/docker-introduction.key and b/slides/docker-introduction.key differ diff --git a/slides/docker-introduction.pdf b/slides/docker-introduction.pdf index 488fe89..fcbe407 100644 Binary files a/slides/docker-introduction.pdf and b/slides/docker-introduction.pdf differ diff --git a/slides/kubernetes-introduction.key b/slides/docker-kubernetes-recipes.key similarity index 65% rename from slides/kubernetes-introduction.key rename to slides/docker-kubernetes-recipes.key index 3ef6d91..613ef9f 100644 Binary files a/slides/kubernetes-introduction.key and b/slides/docker-kubernetes-recipes.key differ diff --git a/slides/docker-kubernetes-recipes.pdf b/slides/docker-kubernetes-recipes.pdf new file mode 100644 index 0000000..e7d41f3 Binary files /dev/null and b/slides/docker-kubernetes-recipes.pdf differ diff --git a/slides/docker-kubernetes.key b/slides/docker-kubernetes.key new file mode 100644 index 0000000..2391b8b Binary files /dev/null and b/slides/docker-kubernetes.key differ diff --git a/slides/docker-kubernetes.pdf b/slides/docker-kubernetes.pdf new file mode 100644 index 0000000..c9a1fb0 Binary files /dev/null and b/slides/docker-kubernetes.pdf differ diff --git a/slides/ecs-introduction.key b/slides/ecs-introduction.key new file mode 100644 index 0000000..e7f6977 Binary files /dev/null and b/slides/ecs-introduction.key differ diff --git a/slides/jdays-keynote.key b/slides/jdays-keynote.key new file mode 100644 index 0000000..e8ccb6e Binary files /dev/null and b/slides/jdays-keynote.key differ diff --git a/slides/jdays-keynote.pdf b/slides/jdays-keynote.pdf new file mode 100644 index 0000000..b9dff05 Binary files /dev/null and b/slides/jdays-keynote.pdf differ diff --git a/slides/kubernetes-introduction.pdf b/slides/kubernetes-introduction.pdf deleted file mode 100644 index 9868007..0000000 Binary files a/slides/kubernetes-introduction.pdf and /dev/null differ diff --git a/slides/mesos-introduction.key b/slides/mesos-introduction.key new file mode 100644 index 0000000..3aaee75 Binary files /dev/null and b/slides/mesos-introduction.key differ diff --git a/slides/mesos-introduction.pdf b/slides/mesos-introduction.pdf new file mode 100644 index 0000000..ee9af97 Binary files /dev/null and b/slides/mesos-introduction.pdf differ diff --git a/slides/service-discovery-oscon2017.key b/slides/service-discovery-oscon2017.key new file mode 100644 index 0000000..7a0937b Binary files /dev/null and b/slides/service-discovery-oscon2017.key differ diff --git a/slides/service-discovery-oscon2017.pdf b/slides/service-discovery-oscon2017.pdf new file mode 100644 index 0000000..61936df Binary files /dev/null and b/slides/service-discovery-oscon2017.pdf differ diff --git a/slides/service-discovery.key b/slides/service-discovery.key new file mode 100644 index 0000000..3b7e19c Binary files /dev/null and b/slides/service-discovery.key differ diff --git a/slides/service-discovery.pdf b/slides/service-discovery.pdf new file mode 100644 index 0000000..de3ae9a Binary files /dev/null and b/slides/service-discovery.pdf differ