Skip to content

Commit f689b0f

Browse files
committed
Added compose files and wildfly+ticketmonster images
1 parent 1be6e67 commit f689b0f

7 files changed

Lines changed: 128 additions & 38 deletions

File tree

instructor/docker-compose.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
dockerregistry:
2+
image: registry:2.0
3+
volumes:
4+
- /registry:/tmp/registry-dev
5+
ports:
6+
- "5000:5000"
7+
httpserver:
8+
build: lab-httpd-server/
9+
ports:
10+
- "8082:80"
11+
nexusdata:
12+
image: sonatype/nexus:oss
13+
command: echo "data-only container for Nexus"
14+
nexus:
15+
image: sonatype/nexus:oss
16+
ports:
17+
- "8081:8081"
18+
volumes_from:
19+
- nexusdata
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
index.html

instructor/readme.adoc

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ https://get.docker.com/builds/Windows/i386/docker-latest.exe
3535
And save to c:/Users/<username>/docker/docker.exe
3636
----
3737

38+
## Install Docker compose
39+
40+
[source, text]
41+
----
42+
# Linux / MacOS
43+
curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
44+
chmod +x /usr/local/bin/docker-compose
45+
----
46+
3847
## Install Docker-machine
3948

4049
Install the Docker machine client for your environment: https://github.com/docker/machine/releases/[latest releases]
@@ -94,17 +103,7 @@ $ # to /var/lib/boot2docker/profile
94103
$ sudo /etc/init.d/docker restart
95104
----
96105

97-
98-
## Run local-registry
99-
100-
Instructors should run a local registry to make all images locally available to attendees
101-
102-
[source, text]
103-
----
104-
docker run -d --name="docker-registry" -p 5000:5000 -v /registry:/tmp/registry-dev registry:2.0
105-
----
106-
107-
##Convert the Attendees instructions to HTML.
106+
## Convert the Attendees instructions to HTML.
108107

109108
This instructions will be placed inside the Lab HTTPD Server during the image build
110109

@@ -113,47 +112,37 @@ This instructions will be placed inside the Lab HTTPD Server during the image bu
113112
asciidoctor ../attendees/readme.adoc -o lab-httpd-server/index.html
114113
----
115114

116-
## Build the Lab HTTPD Server image
117-
118-
Make sure to change to the cloned repository/instructor first.
115+
## Start the Instructor environment
119116

120117
[source, text]
121118
----
122-
docker build -t lab-httpd-server:latest lab-httpd-server/.
119+
docker-compose up -d
123120
----
124121

125-
## Run Http server with downloadables
126-
127-
Run the Apache HTTPD server for attendees to download boot2docker iso image and Virtuabox binaries.
122+
Test if the servers are running:
128123

129-
[source, text]
130-
----
131-
docker run -d --name="lab-httpd-server" -p 8082:80 lab-httpd-server
132-
----
124+
Access the docker registry [http://localhost:5000/v2/]
125+
Access the nexus console [http://localhost:8081/].
126+
Access the webserver [http://localhost:8082]
133127

134-
If you run into errors on Windows (eg, no such file or exec format error, check the line ending in the run-apache.sh).
135128

136-
Check if the server is running: http://localhost:8082/
137-
138-
NOTE: Make sure to check your firewall settings. Attendees should be able to access this machine with your local IP.
139-
140-
## Run Nexus On the instructor machine
141-
142-
Default credentials are: admin / admin123
143-
144-
Use a data volume container. Since data volumes are persistent until no containers use them, a container can created specifically for this purpose.
129+
## Build ticketmonster-pgsql-widlfly image
145130

146131
[source, text]
147132
----
148-
docker run -d --name nexus-data sonatype/nexus:oss echo "data-only container for Nexus"
149-
docker run -d -p 8081:8081 --name nexus --volumes-from nexus-data sonatype/nexus:oss
133+
docker build -t "instructor/ticketmonster-pgsql-wildfly" ticketmonster-pgsql-wildfly/
150134
----
151135

152-
Test if nexus is running:
136+
## Put the ticketmonster-pgsql-wildfly and postgres images on the local registry
153137

154138
[source, text]
155139
----
156-
curl http://localhost:8081/service/local/status
157-
----
140+
# Ticket-monster+PGSQ+WildFly
141+
docker tag instructor/ticketmonster-pgsql-wildfly localhost:5000/ticketmonster-pgsql-wildfly
142+
docker push localhost:5000/ticketmonster-pgsql-wildfly
158143
159-
Access the nexus console [http://localhost:8081/].
144+
#Postgres
145+
docker pull postgres
146+
docker tag postgres localhost:5000/postgres
147+
docker push localhost:5000/postgres
148+
-----
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Use latest jboss/wildfly
2+
FROM jboss/wildfly
3+
4+
MAINTAINER "Rafael Benevides" <benevides@redhat.com>
5+
6+
#Create admin user
7+
RUN /opt/jboss/wildfly/bin/add-user.sh -u admin -p docker#admin --silent
8+
9+
# Add customization folder
10+
COPY customization /opt/jboss/wildfly/customization/
11+
12+
USER root
13+
14+
# Run customization scripts as root
15+
RUN chmod +x /opt/jboss/wildfly/customization/execute.sh
16+
RUN /opt/jboss/wildfly/customization/execute.sh standalone
17+
18+
ADD ticket-monster.war /opt/jboss/wildfly/standalone/deployments/
19+
20+
# Fix for Error: Could not rename /opt/jboss/wildfly/standalone/configuration/standalone_xml_history/current
21+
RUN rm -rf /opt/jboss/wildfly/standalone/configuration/standalone_xml_history
22+
23+
RUN chown -R jboss:jboss /opt/jboss/wildfly/
24+
25+
USER jboss
26+
27+
# Expose the ports we're interested in
28+
EXPOSE 8080 9990
29+
30+
# Set the default command to run on boot
31+
# This will boot WildFly in the standalone mode and bind to external interface and enable HA
32+
CMD /opt/jboss/wildfly/bin/standalone.sh -b `hostname -i` -bmanagement `hostname -i`
33+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Mark the commands below to be run as a batch
2+
batch
3+
4+
# Add Postgres JDBC Driver as a module
5+
module add --name=org.postgresql --resources=/opt/jboss/wildfly/customization/postgresql-9.4-1201.jdbc41.jar --dependencies=javax.api,javax.transaction.api
6+
7+
#Add PostgreSQL JDBC Driver
8+
/subsystem=datasources/jdbc-driver=postgres:add(driver-name=postgres, driver-module-name=org.postgresql, driver-class-name=org.postgresql.Driver)
9+
10+
#Add Datasource
11+
data-source add --name=TicketMonsterPostgreSQLDS --jndi-name=java:jboss/datasources/TicketMonsterPostgreSQLDS --driver-name=postgres --connection-url=jdbc:postgresql://${postgres.host:db}:5432/ticketmonster --user-name=ticketmonster --password=ticketmonster-docker --valid-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker --exception-sorter-class-name=org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter --validate-on-match=true --background-validation=true
12+
13+
#Execute the batch
14+
run-batch
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# Usage: execute.sh [WildFly mode] [configuration file]
4+
#
5+
# The default mode is 'standalone' and default configuration is based on the
6+
# mode. It can be 'standalone.xml' or 'domain.xml'.
7+
8+
JBOSS_HOME=/opt/jboss/wildfly
9+
JBOSS_CLI=$JBOSS_HOME/bin/jboss-cli.sh
10+
JBOSS_MODE=${1:-"standalone"}
11+
JBOSS_CONFIG=${2:-"$JBOSS_MODE.xml"}
12+
13+
function wait_for_server() {
14+
until `$JBOSS_CLI -c "ls /deployment" &> /dev/null`; do
15+
sleep 1
16+
done
17+
}
18+
19+
echo "=> Starting WildFly server"
20+
$JBOSS_HOME/bin/$JBOSS_MODE.sh -c $JBOSS_CONFIG -Dmodcluster.host=127.0.0.1 > /dev/null &
21+
22+
echo "=> Waiting for the server to boot"
23+
wait_for_server
24+
25+
echo "=> Executing the commands"
26+
$JBOSS_CLI -c --file=`dirname "$0"`/commands.cli
27+
28+
echo "=> Shutting down WildFly"
29+
if [ "$JBOSS_MODE" = "standalone" ]; then
30+
$JBOSS_CLI -c ":shutdown"
31+
else
32+
$JBOSS_CLI -c "/host=*:shutdown"
33+
fi
34+
7.97 MB
Binary file not shown.

0 commit comments

Comments
 (0)