Docker is a great tool for building your infrastructure. I've been using it for some time and it is really easy to deploy your applications.
Basically there should not be an issue to configure simple infrastructure (on single machine, without
Swarm and so on). In this blog post we will take a look at how to configure several tomcats behind the reverse proxy, nginx.
This is the first post in series. I would like to keep them small and easy to follow!
All discussions will be based and focused on the diagram below.
Because it is pretty widely used in Java world.
The answer could be the same. But it is just really easy to configure it. Up and running :)
We will mainly focus in this part on such things as folder structure for you infrastructure
and overview on how things will be built further.
This scheme is pretty obvious to implement it. Here we will walk through the main steps with source code attached. Each step will be discussed.
From the first view it could seem pretty verbose and some things could be ommited. But let's discuss a bit the folder structure.
The starting point here is
images folder and a bunch of
The main point of this folder is to gather all the required
Doclerfiles to build the complete infrastructure. So here we have
java8 image. This image is straightforward. We are just accepting licence agreement there and that's all.
tomcat8-java8 is based on
java8 image in order to install
tomcat8. There are some additional actions should be done. Some of steps require additional explanation and we will definitely look through every single file and analyze why that was done and how.
nginx is our reverse proxy for our two instances of Tomcats. Some configurations there are focused on the proper usage of
Tomcats. Also we will discuss production ready configurations. This will be a separate post as there will be much to discuss.
webapps this is not a required action but this could be the place where you could store all your applications. This could be ommited or folder could be changed. It is not a big deal here.
*.sh those scripts are the heart of this approach. Here we will discuss this a bit. Because this requires some explanation as this is one of the main ideas of this approach.
Let's take a closer look at
build_deploy_all.sh file is the entry point when this files are delivered to the clean system. The idea of this script is "Run it and you are done". The overview of internals of this file are described on the diagram below:
So the process will first clean all your installed containers with images (this is
clean.sh step). Next it will try to start the main
In the next part we will look throught scripts and files. We will also run all that stuff to see it in action.