It's a test task for DevOps Engineer. The task description at dockerhub ReadMe and Notion
Get source code of the both services from github devops-test-questionnaire:
mkdir ./devops_test_workspace && cd ./devops_test_workspace
git clone https://github.com/taptima/devops-test-questionnairemkdir ./config_files
git clone https://github.com/malinat0r/DevOps-Test-Questionnaire ./config_filesYou can build docker images locally and pull them into minikube using instructions below or just use pre-built images from Docker Hub. In case you do not want to build images and want to use pre-built one just skip steps from this chapter ( Build docker images ).
# copy dockerfile into questionnaire-backend service source code folder
cp ./config_files/docker/back/Dockerfile ./devops-test-questionnaire/questionnaire-backend/
# build docker image
docker build --no-cache --progress=plain -t malinovskij/questionnaire-backend:v1 ./devops-test-questionnaire/questionnaire-backend/
# Upload built image from docker to minikube
minikube image load malinovskij/questionnaire-backend:v1
# copy dockerfile into questionnaire-frontend service source code folder
cp ./config_files/docker/front/Dockerfile ./devops-test-questionnaire/questionnaire-frontend/
# copy nginx config file for frontoffice container
cp ./config_files/nginx/conf.d/default.conf ./devops-test-questionnaire/questionnaire-frontend/
# build docker image
docker build --no-cache --progress=plain -t malinovskij/questionnaire-frontend:v2 ./devops-test-questionnaire/questionnaire-frontend/
# Upload built image from docker to minikube
minikube image load malinovskij/questionnaire-frontend:v2You can run the application in order to test built images in Docker compose. If you do not want to do it, just skip this chapter.
docker compose --file ./config_files/docker-compose.yml upUpdate your /etc/hosts file:
sudo echo "127.0.0.1 questionnaire.local" >> /etc/hostsOpen url http://questionnaire.local/ in browser and test the application.
Shut down docker compose:
docker compose --file ./config_files/docker-compose.yml downAssuming you have a minikube already installed. You can follow these instructions to set it up. If you haven't already, install the Nginx Ingress Controller in your Minikube cluster.
# Enable ingress addon:
minikube addons enable ingressApply the application manifests:
kubectl apply -f ./config_files/k8s/Wait for ingress address:
kubectl get -n questionnaire-namespace ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
example-ingress nginx * <your_ip_here> 80 5m45sNote for Docker Desktop Users: To get ingress to work you’ll need to open a new terminal window and run
minikube tunneland in the following step use127.0.0.1in place of<ip_from_above>.
In case you installed minikube using Docker environment ( i.e. NOT Docker Desktop) then you need to adjust you /etc/hosts file with <ip_from_above>
abnet@LabNetVBoxStation:~$ kubectl get -n questionnaire-namespace ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
questionnaire-api-ingress nginx questionnaire.local 192.168.49.2 80 140m
questionnaire-main-ingress nginx questionnaire.local 192.168.49.2 80 140m
labnet@LabNetVBoxStation:~$
# cut from /etc/hosts
192.168.49.2 questionnaire.local
#127.0.0.1 questionnaire.localNow you can start testing of application - open url http://questionnaire.local/ in browser.