Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project description

It's a test task for DevOps Engineer. The task description at dockerhub ReadMe and Notion

Services dockerization

Get source code of the both services

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-questionnaire

Get source of Dockerfiles and k8s manifests

mkdir ./config_files
git clone https://github.com/malinat0r/DevOps-Test-Questionnaire ./config_files

Build docker images

You 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:v2

Run Docker Compose

You 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 up

Update your /etc/hosts file:

sudo echo "127.0.0.1 questionnaire.local" >> /etc/hosts

Open url http://questionnaire.local/ in browser and test the application.

Shut down docker compose:

docker compose --file ./config_files/docker-compose.yml down

Deploy to minikube

Assuming 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 ingress

Apply 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      5m45s

Note for Docker Desktop Users: To get ingress to work you’ll need to open a new terminal window and run minikube tunnel and in the following step use 127.0.0.1 in 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.local

Now you can start testing of application - open url http://questionnaire.local/ in browser.

About

DevOps Test Task

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages