The developer team of atVenu left for their long-awaited Christmas break. You have been given the responsibility to figure out how to run the webserver for production correctly. You should fix the things which are breaking, and find an easy way to deploy the application. To gain bonus points you should introduce some monitoring.
Though you may be working with shell scripts, docker and Prometheus, you don't need to have any prior experience with these technologies. Understanding the basic getting-started guide of these technologies will be more than enough to complete the challenge.
- Getting started with Docker
- Build your own apps and images
- Getting started with Docker Compose
- Read Prometheus getting started
- Read Prometheus installation with Docker
- Install docker and docker-compose on your machine and run the following commands
docker pull atvenu/assignment-webserver
docker pull prom/prometheus:v2.45.2
- Clone this repository to your machine.
bash
shell was used to test this assignment, you can use other shells but they might cause unknown issues.- Create a new private repository in your GitHub account.
cd
into thesolution
directory and save all your notes/fixes/files in there.
In case you have a Windows machine, or don't want to install the software on your machine, you can use https://labs.play-with-docker.com.
- The assignment does not require you to modify the container image or build your own container image. Hence don't build your custom Image.
- Make sure all the files you create have the exact names as given.
- Don't commit all of your work in a single commit, commit it as you finish each part, so we can see the work as you build it up.
- The solution should work on a different machine, which has docker and docker-compose, without any modifications.
- Reading this document carefully is the key to solving this assignment.
- If you need more time or are stuck at some point, don't hesitate to reach out to us.
- Run the container image
atvenu/assignment-webserver:latest
in the background and check if it is running. - If it is failing try to find the reason, and move to the next step.
- Write a bash script
csv.sh
to create a file nameddata.csv
whose content looks like this:
0, 2929
1, 67
2, 99
These are comma separated values with an index followed by a random number.
- running the script
csv.sh
should generate 10 such entries.
- Run the container again in the background with the file generated in (3) available inside the container (remember the reason you found in (2)).
- If you are able to run the image now, map the container port 8080 to your host port at 9090.
- You might want to change the border color of the application, so set the
BORDER_COLOR
toblue
and re-run your container.
If all steps are done correctly, your application should be accessible at http://localhost:9090 . it should show the values generated by your csv.sh
.
Congratulations, you fixed the Issue of the app. Add a README.md
file inside the solution directory and write the command that you used to run the image successfully. Save all your work in a commit and push it to your repository.
- Delete any container still running from the previous steps.
- Create a
docker-compose.yaml
file for the setup from part 1. - Run the previous container using
docker-compose up
.
- copy your
docker-compose.yaml
file to the solution directory. - Commit your changes to your git repository.
This is bonus points
- Delete any containers running from the last part.
- Add the Prometheus container (prom/prometheus:v2.45.2) to the docker-compose.yaml form part 2.
- Configure Prometheus to collect data from our application at :/metrics endpoint (which is the port from part 1).
- Make sure that Prometheus is accessible at http://localhost:9091 on the host. The default port of Prometheus is 9090, which you used already for your other container.
To confirm metrics are being fetched from the 1st container into Prometheus. Go to the http://localhost:9090 multiple times. And then go to http://localhost:9091 and search for the csv_requests_total
metric. You should see how many times the container one is accessed.
Save the Solution
- Update your changes to be shown in your git repository.
- Add any other files you have created in the solution directory.
- Commit and push the changes to your GitHub repository.
Once you are done with the assignment and pushed all your changes:
- Add the GitHub ID of the user provided to you as a collaborator to the repository.
- Reply to HR with your progress and the link to your repository.