Skip to content

Commit 14b236d

Browse files
committed
Various fixes and improvements
1 parent c431a2b commit 14b236d

9 files changed

Lines changed: 513 additions & 254 deletions

File tree

chapters/docker-compose.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ sudo chmod +x /usr/local/bin/docker-compose
4343
[source, yml]
4444
----
4545
mysqldb:
46-
#From Internet
46+
#From Internet (use only one image instruction)
4747
image: mysql
48-
#From Instructor
48+
#From Instructor (use only one image instruction)
4949
image: classroom.example.com:5000/mysql
5050
environment:
5151
MYSQL_DATABASE: sample
5252
MYSQL_USER: mysql
5353
MYSQL_PASSWORD: mysql
5454
MYSQL_ROOT_PASSWORD: supersecret
5555
mywildfly:
56-
#From Internet
56+
#From Internet (use only one image instruction)
5757
image: arungupta/wildfly-mysql-javaee7
58-
#From Instructor
58+
#From Instructor (use only one image instruction)
5959
image: classroom.example.com:5000/wildfly-mysql-javaee7
6060
links:
6161
- mysqldb:db

chapters/docker-container.adoc

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ Let's first check, if any images are available:
1111
docker images
1212
----
1313

14-
At first, this list only contains the Docker swarm image, we used earlier.
14+
At first, this list is empty.
1515

1616
[source, text]
1717
----
18-
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
19-
swarm latest 556c60f87888 33 hours ago 10.2 MB
18+
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
19+
2020
----
2121

2222
Now, let's get a vanilla `jboss/wildfly` image:
@@ -254,21 +254,21 @@ image::images/plain-wildfly1.png[]
254254
### Stop Container
255255

256256
. Stop a specific container:
257-
+
257+
258258
[source, text]
259259
----
260260
docker stop <CONTAINER ID>
261261
----
262-
+
262+
263263
. Stop all the running containers
264-
+
264+
265265
[source, text]
266266
----
267267
docker stop $(docker ps -q)
268268
----
269-
+
269+
270270
. Stop only the exited containers
271-
+
271+
272272
[source, text]
273273
----
274274
docker ps -a -f "exited=-1"
@@ -277,25 +277,26 @@ docker ps -a -f "exited=-1"
277277
### Remove Container
278278

279279
. Remove a specific container:
280-
+
280+
281281
[source, text]
282282
----
283283
docker rm 0bc123a8ece0
284284
----
285-
+
285+
286286
. Remove containers meeting a regular expression
287-
+
287+
288288
[source, text]
289289
----
290290
docker ps -a | grep wildfly | awk '{print $1}' | xargs docker rm
291291
----
292-
+
292+
293293
. Remove all containers, without any criteria
294-
+
294+
295295
[source, text]
296296
----
297297
docker rm $(docker ps -aq)
298298
----
299+
299300
[[Enabling_WildFly_Administration]]
300301
### Enabling WildFly Administration
301302

chapters/docker-deployment-options.adoc

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ We're going to build the application first.
1111

1212
#From Internet
1313
git clone https://github.com/javaee-samples/javaee7-simple-sample.git
14-
14+
1515
#From Instructor
1616
git clone http://root:dockeradmin@classroom.example.com:10080/root/javaee7-simple-sample.git
1717

@@ -79,36 +79,36 @@ Now you're ready to deploy the application for the first time.
7979
Start JBoss Developer Studio, if not already started.
8080

8181
. Select '`Servers`' tab, create a new server adapter
82-
+
82+
8383
.Server adapter
8484
image::images/jbds1.png[]
85-
+
85+
8686
. Assign an existing or create a new WildFly 9.0.0 runtime (changed properties are highlighted.)
87-
+
87+
8888
.WildFly Runtime Properties
8989
image::images/jbds2.png[]
90-
+
90+
9191
. If a new runtime needs to be created, pick the directory for WildFly 9.0.2:
92-
+
92+
9393
.WildFly 9.0.2.Final Runtime
9494
image::images/jbds3.png[]
95-
+
95+
9696
Click on '`Finish`'.
97-
+
97+
9898
. Double-click on the newly selected server to configure server properties:
99-
+
99+
100100
.Server properties
101101
image::images/jbds4.png[]
102-
+
102+
103103
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.
104-
+
104+
105105
. Specify a custom deployment folder on Deployment tab of Server Editor
106-
+
106+
107107
.Custom deployment folder
108108
image::images/jbds5.png[]
109-
+
109+
110110
. Right-click on the newly created server adapter and click '`Start`'.
111-
+
111+
112112
.Started server
113113
image::images/jbds6.png[]
114114

@@ -142,7 +142,7 @@ TThe Command Line Interface (CLI) is a tool for connecting to WildFly instances
142142
Lets use the CLI to deploy javaee7-simple-sample to WildFly running in the container.
143143

144144
. 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/<USER>/tools/`). This will create `wildfly-9.0.2.Final` directory here. This folder is referred to $WIDLFY_HOME from here on. Make sure to add the `/Users/<USER>/tools/wildfly-9.0.2.Final/bin` to your $PATH.
145-
+
145+
146146
. Run the "`wildfly-management`" image with fixed port mapping as explained in <<Management_Fixed_Port_Mapping>>.
147147
. Run the `jboss-cli` command and connect to the WildFly instance.
148148

@@ -200,21 +200,21 @@ Start a new container as `docker run -d --name wildfly -p 8080:8080 -p 9990:9990
200200
Deploy the application using the console with the following steps:
201201

202202
. Go to '`Deployments`' tab.
203-
+
203+
204204
.Deployments tab in WildFly Web Console
205205
image::images/wildfly9-deployments-tab.png[]
206-
+
206+
207207
. Click on '`Add`' button.
208208
. On '`Add Deployment`' screen, take the default of '`Upload a new deployment`' and click '`Next>>`'.
209209
. Click on '`Choose File`', select `<javaee7-simple-sample PATH>/javaee7-simple-sample.war` file on your computer. This would be `javaee7-simple-sample/target/javaee7-simple-sample.war` from <<Build_Application>>.
210210
. Click on '`Next>>`'.
211211
. Select '`Enable`' checkbox.
212-
+
212+
213213
.Enable a deployment
214214
image::images/wildfly9-add-deployments.png[]
215-
+
215+
216216
. Click '`Finish`'.
217-
+
217+
218218
.Java EE 7 Simple Sample Deployed
219219
image::images/wildfly9-javaee7-simple-sample-deployed.png[]
220220

@@ -228,7 +228,7 @@ image::images/wildfly9-javaee7-simple-sample-output.png[]
228228
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.
229229

230230
. Start another WildFly instance again:
231-
+
231+
232232
[source, text]
233233
----
234234
#From Internet
@@ -237,33 +237,33 @@ docker run -d --name wildfly -p 8080:8080 -p 9990:9990 rafabene/wildfly-admin
237237
#From Instructor
238238
docker run -d --name wildfly -p 8080:8080 -p 9990:9990 classroom.example.com:5000/wildfly-management
239239
----
240-
+
240+
241241
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.
242-
+
242+
243243
. Create a new server adapter in JBoss Developer Studio and name it "`WildFly 9.0.2-Management`". Specify the host name as '`dockerhost`'.
244-
+
244+
245245
image::images/jbds8.png[]
246-
+
246+
247247
. Click on '`Next>`' and change the values as shown.
248-
+
248+
249249
.Create New Server Adapter
250250
image::images/jbds9.png[]
251-
+
251+
252252
. Take the default values in '`Remote System Integration`' and click on '`Finish`'.
253-
+
253+
254254
. 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:
255-
+
255+
256256
.Management Login Credentials
257257
image::images/jbds10.png[]
258-
+
258+
259259
. Right-click on the newly created server adapter and click '`Start`'. Status quickly changes to '`Started`' as shown.
260-
+
260+
261261
.Synchronized WildFly Server
262262
image::images/jbds11.png[]
263-
+
263+
264264
. 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.
265265
. Stop WildFly when you're done.
266-
+
266+
267267
[source, text]
268268
----
269269
docker stop wildfly

chapters/docker-image.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ _Dockerfile_ is usually called _Dockerfile_. The complete list of commands that
3131

3232
[source, text]
3333
----
34-
#From Internet
34+
#From Internet (use only one FROM instruction)
3535
FROM fedora
3636
37-
#From Instructor
37+
#From Instructor (use only one FROM instruction)
3838
FROM classroom.example.com:5000/fedora
3939
4040
CMD ["/bin/echo", "hello world"]
@@ -102,10 +102,10 @@ busybox latest c51f86c28340 8 days ago
102102

103103
[source, text]
104104
----
105-
#From Internet
105+
#From Internet (use only one FROM instruction)
106106
FROM jboss/wildfly
107107
108-
#From Instructor
108+
#From Instructor (use only one FROM instruction)
109109
FROM classroom.example.com:5000/wildfly
110110
----
111111

chapters/docker-kubernetes.adoc

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
## Deploy Application on Kubernetes Cluster
22

3+
[[Kubernetes_Setup]]
4+
### Install Kubernetes
5+
6+
. Download Vagrant and install it.
7+
.. from Internet: https://www.vagrantup.com/downloads.html
8+
.. from Instructor: http://classroom.example.com:8082/downloads/vagrant/
9+
10+
+
11+
Kubernetes requires Vagrant >= 1.6.2. So if you have an older version then make sure you install the latest one.
12+
+
13+
. If you've not installed Docker Toolbox, then you need to additionally download Virtual Box 5.0.8
14+
.. from Internet: https://www.virtualbox.org/wiki/Downloads.
15+
.. from Instructor: http://classroom.example.com:8082/downloads/virtualbox/
16+
17+
. Download Kubernetes (1.0.7)
18+
.. from Internet: https://github.com/kubernetes/kubernetes/releases/download/v1.0.7/kubernetes.tar.gz
19+
.. from Instructor: http://classroom.example.com:8082/downloads/kubernetes.tar.gz.
20+
321
[quote, github.com/GoogleCloudPlatform/kubernetes/]
422
Kubernetes is an open source system for managing containerized applications across multiple hosts, providing basic mechanisms for deployment, maintenance, and scaling of applications.
523

@@ -45,12 +63,15 @@ Kubernetes cluster can be easily started using Vagrant. There are two options to
4563
[source, text]
4664
----
4765
cd kubernetes
66+
export NUM_MINIONS=2
4867
export KUBERNETES_PROVIDER=vagrant
4968
./cluster/kube-up.sh
5069
----
5170

5271
The `KUBERNETES_PROVIDER` environment variable tells all of the various cluster management scripts which variant to use.
5372

73+
The `NUM_MINIONS`environment variable controls the number of nodes that are instantiated
74+
5475
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.
5576

5677
It shows the output as:
@@ -651,7 +672,7 @@ Individual resources (service, replication controller, or pod) can be deleted by
651672

652673
[source, text]
653674
----
654-
kubectl delete -l se,po context=docker-k8s-lab
675+
kubectl delete all -l context=docker-k8s-lab
655676
----
656677

657678
### Stop Kubernetes Cluster

instructor/dockerfiles/lab-httpd-server/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ MAINTAINER Rafael Benevides <benevides@redhat.com>
44

55
#Install wget and Apache HTTPD
66
RUN dnf -y update && dnf -y install httpd && dnf clean all
7-
ADD index.html /var/www/html/
87

98
RUN mkdir -p /var/www/html/downloads
109

@@ -78,6 +77,8 @@ RUN curl -L https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.rpm -o
7877
#Add other files to downloads
7978
ADD downloads/lab-settings.xml /var/www/html/downloads/
8079

80+
ADD index.html /var/www/html/
81+
8182
EXPOSE 80
8283

8384
# Simple startup script to avoid some issues observed with container restart

0 commit comments

Comments
 (0)