-
Notifications
You must be signed in to change notification settings - Fork 1
Dockerizing Microservices
The first step for this project was Dockerizing all the microservices into separate Dockerfiles. All the Dockefiles which have been built have used a predefined operating system image as the base image on which all the dependencies have been installed. We used Linux based images that are easy to install dependencies on and are easy to host on the server which is itself usually Linux based and is thus compatible.
The first step we did was use to build a Docker-compose image that performed cross-communication among microservices. The image name mentioned in the docker-compose helped for cross-communication among images and could replace the IP or the address fed among microservices among communication. Besides, RabbitMQ was running locally on the system and there was some conflict with the message broker running on through the Dockerfile. It took us a fair amount of time to make all these deductions and eventually we were able to run all the microservices using the following set of commands you can run the Dockerfiles locally and the test them as well.
git clone -b develop https://github.com/airavata-courses/IU-Witcher-2020.git
cd IU-Witcher-2020
docker-compose up --build
To check all running process:
docker ps
To access the project:
Search http://localhost:3000/ on your browser
RabbitMQ the message-broker we used had a predefined image already uploaded on Dockerhub but we needed to add the ports which had to be exposed within the file so that they could be used by the services using it. So we built a separate Dockerfile which pulled the predefined Rabbitmq image within the alpine operating system image.
The dependencies for the data-retrieval microservice were usually difficult to install on Alpine image which is a relatively lighter Linux Image. So we used a Debian image on which all the dependencies were easily installed.
The model execution microservice was installed just like data retrieval.
The post-processing microservice was installed just like data retrieval.
Api Gateway is build using Python Flask and for that we had used Debian Image in docker. TO access Flask app in docker add a parameter to your app.run(). By default it runs on localhost, change it to app.run(host= '0.0.0.0') to run on your machines IP address.
We have used PHP and MySQl for user management For php and mysql we have used their standard docker images and established connection between them using docker compose and links
Used Debian Image and formed connection to API gateway using docker compose