Challenge Overview

Dockerizing Microservices and Cloud Deployment

This is the MEDIUM 500 Points Competition

We now have an application with a new microservice called **auth **that handles user authentication that we built in the Easy challenge.

Your tasks for this level is to continue the previous solution. In this challenge, we will dockerize all the microservices such that they run in their own container and deploy them on a cloud of your preference.

Solving this problem you will learn:

  • How to Dockerize an application
  • How docker containers communicate with each other using networks and ports.
  • How easy it becomes to launch an application without worrying much about environment setup on a host machine.
  • How to deploy applications on cloud

Learning Material: https://dzone.com/articles/microservices-with-docker

https://nodejs.org/en/docs/guides/nodejs-docker-webapp/

**Important: Please make sure you have Docker and Docker-compose installed in your environment. **

What do you need to do next?

You have to create docker images using Dockerfile and Docker compose for the following apps, and deploy them on the cloud. Please note that you will need to share the URL of the application deployed on your cloud as a part of the final submission. Here are the detailed requirements:

Backend Dockerfile:

  • In every backend microservice folder create a new file called “Dockerfile”, and
  • Configure the Dockerfile to use the node alpine image as a base image
  • Copy the source code to /app inside the container
  • Expose the relevant port of the microservice
  • Run npm install
  • Finally, give the npm start command so that the app starts whenever a container is created.

Frontend Dockerfile

In the end, we will have 1 Dockerfile for each microservice. Make sure you test that the application is running when all containers are up. For the frontend, which is react static files, you will create a Dockerfile that:

  • Uses a prebuilt nginx docker image from docker hub as the base image,
  • Copy everything from the dist folder to the root directory of nginx inside the container.
  • Expose port 80 of the container

Database

For MongoDB, we will use the default image from docker hub, no dockerfile is required for this, you will configure it directly inside the Docker Compose file.

Docker Compose

In the root folder, create a docker-compose.yml file that:

  • Instantiates all these services by calling their Dockerfiles
  • Pulls and run the latest MongoDB from Docker hub
  • Make sure you map and expose the correct ports for each service so that they can communicate with each other over the network.
  • The server.log file inside the event-bus microservice should be mounted on the host for persistence. (We do not want to lose the logs incase the containers are destroyed)
  • Make sure you name the services appropriately

Cloud Deployment

The final step for this exercise is to deploy the application on the cloud.

Once you have completed writing the Dockerfiles and the docker compose file, please use the _docker-compose up _command to bring the application up on your cloud instance.

You should be able to access the application via the browser with your cloud instance’s domain/ip address (make sure you check out your existing firewall or iptables settings if the site remains inaccessible).

Cloud Monitoring

The final step is to deploy the open source tool DockProm to monitor the containers and the host. Deployment steps are mentioned in the repo: https://github.com/stefanprodan/dockprom

Submission Deliverables

You must follow this submission folder structure so our automated test process can process your scoring:

  • Create a folder with “code” as the folder name then zip.
  • All the microservices that reside in their own folders should be placed inside this “code” folder. Please remove the _node_modules _folder from each microservices folder before submission.
  • Please make sure that the Dockerfile is present in every microservice folder
  • Please make sure that the docker-compose.yml is present at the root of the “code” folder.
  • Please create a url.txt file inside the “code” folder and place your application’s url in that file.
  • Zip that “code” folder and submit to the challenge.

Topcoder Skill Builder Competition | Cloud Native | Problems

Host Challenge: https://www.topcoder.com/challenges/c1baa6a2-272f-4ae8-8c1f-2f53831deb2d

Easy: 250 Points. Challenge Link: https://www.topcoder.com/challenges/c4a13de5-3564-4a7e-817d-a1c07954ef84

Medium: 500 Points. Challenge Link: https://www.topcoder.com/challenges/51aaeea8-186b-403d-a7fe-ab39e4968fdd

Hard: 1000 Points. Challenge Link: https://www.topcoder.com/challenges/1fa67d57-e2f9-4e0f-ba13-7a0ffc453946

ELIGIBLE EVENTS:

2021 Topcoder(R) Open

Review style

Final Review

Community Review Board

Approval

User Sign-Off

ID: 30189805