This project contains several images that allows you to run Ticket Monster on a WildFly server.
The pieces of this demo are:
- Wildfly 10.x Application Server (Standalone mode) + Ticket Monster application - Dockerfile
- Postgres 9.x Database Server - Docker image
- Apache HTTPD + mod_cluster (Without Server advertisement) - Docker image
This is an alternative path for running a "docker only" example using docker-swarm.
- Create the Swarm nodes - This script creates a Swarm Cluster with Multi hosting network enabled.
Execute:
./swarm-create.sh
- Connect on cluster.
Execute:
eval "$(docker-machine env --swarm swarm-master)"
- Verify if the cluster is up.
Execute:
docker info
The following output will be shown:
Containers: 4
Images: 3
Role: primary
Strategy: spread
Filters: affinity, health, constraint, port, dependency
Nodes: 3
swarm-master: 192.168.99.103:2376
└ Containers: 2
└ Reserved CPUs: 0 / 1
└ Reserved Memory: 0 B / 1.022 GiB
└ Labels: executiondriver=native-0.2, kernelversion=4.0.5-boot2docker, operatingsystem=Boot2Docker 1.7.0 (TCL 6.3); master : 7960f90 - Thu Jun 18 18:31:45 UTC 2015, provider=virtualbox, storagedriver=aufs
swarm-node-01: 192.168.99.104:2376
└ Containers: 1
└ Reserved CPUs: 0 / 1
└ Reserved Memory: 0 B / 1.022 GiB
└ Labels: executiondriver=native-0.2, kernelversion=4.0.5-boot2docker, operatingsystem=Boot2Docker 1.7.0 (TCL 6.3); master : 7960f90 - Thu Jun 18 18:31:45 UTC 2015, provider=virtualbox, storagedriver=aufs
swarm-node-02: 192.168.99.105:2376
└ Containers: 1
└ Reserved CPUs: 0 / 1
└ Reserved Memory: 0 B / 1.022 GiB
└ Labels: executiondriver=native-0.2, kernelversion=4.0.5-boot2docker, operatingsystem=Boot2Docker 1.7.0 (TCL 6.3); master : 7960f90 - Thu Jun 18 18:31:45 UTC 2015, provider=virtualbox, storagedriver=aufs
CPUs: 3
Total Memory: 3.065 GiB
- Create an Overlay network.
Execute
docker network create --driver overlay mynet
- Start the containers.
Execute
cd ../compose
docker-compose pull
docker-compose up -d
- Verify how the cluster was deployed.
Execute
docker ps
- Check /mcm (mod_cluster manager).
Execute
open http://`docker-compose port modcluster 80`/mcm
- Scale the Wildfly server.
Execute:
docker-compose scale wildfly=3
- Check the logs.
Execute:
docker-compose logs
- Access the application.
Execute:
open http://`docker-compose port modcluster 80`/ticket-monster/
- Reduce the quantity of servers.
Execute:
docker-compose scale wildfly=2
- Stop the cluster.
Execute:
docker-compose stop
docker-compose rm
- Destroy de cluster.
Execute:
cd ../swarm
./swarm-destroy.sh
- Create a IAM user.
- Log in https://console.aws.amazon.com/iam/ and create a user and group.
- Take notes of
Access Key ID
andSecret Access Key
. - Give the group the
AmazonEC2FullAccess
permission. - Assign the group to the newly created user.
- Create a VPC.
- Log in https://console.aws.amazon.com/vpc/
- Click on
VPC Wizard
. - Select
VPC with a Single Public Subnet
and clickSelect
. - Give it a name and create the VPC with the default options.
- Take notes of the VPC id
- Setup the environment variables
Execute:
export AWS_ACCESS_KEY_ID=<Access Key ID>
export AWS_SECRET_ACCESS_KEY=<Secret Access Key>
export AWS_VPC_ID=<VPC id>
- Create the cluster in AWS
Execute:
./swarm-create-aws.sh
- When asked to setup the 'docker-machine' group inbound rules, go to https://console.aws.amazon.com/ec2/ and open ALL TCP, UDP and ICMP ports.
- Connect on cluster.
Execute:
eval "$(docker-machine env --swarm aws-swarm-master)"
- Continue at Step 3. at the main instructions.