Skip to content
This repository has been archived by the owner on Dec 20, 2021. It is now read-only.
/ devops Public archive

DevOps Engineering course in Innopolis University

Notifications You must be signed in to change notification settings

kezzyhko/devops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django CI CI to Docker Hub

DevOps

This is repository for the DevOps Engineering course in Innopolis University

Table of contents:

What is in this repo?

  • app_python folder contains python web app and necessary files for Docker
  • app_python/app_files folder contains the app itself, which shows current datetime in Europe/Moscow timezone. This app uses Django framework. It keeps datetimes of all requests to / in logs/access.txt file, accessable via /visits endpoint.
  • .github/workflows folder contains workflows for testing the app and publishing it to the docker hub
  • vagrant folder contains Vagrantfile for managing VM, which works on both VirtualBox and Google Cloud Platform
  • ansible folder contains playbooks and roles for provisioning the VM (installing docker and running image from dockerhub)
  • monitoring folder contains stuff necessary for grafana/promtail/loki/prometheus stack
  • k8s folder contains configs for kubernetes & helm, which also demonstrates work with charts, secrets, resource management, config maps, stateful sets, kube prometheus stack, and init containers

Python app

The simplest way is to use docker:
docker run -p 5000:5000 kezzyhko/devops

If you do not want to use docker for some reason, then clone the repo, install requirements.txt and run main.py:
git clone https://github.com/kezzyhko/devops.git
pip3 install -r ./devops/app_python/requirements.txt
python3 ./devops/app_python/app_files/main.py

By default, app is accessible on port 5000

Unit tests

The unit tests for this app are located at app_files/tests.py.
There are three tests, which test the datetime_view view, located in the app_files/views.py.

Vagrant

If you want to use it locally using VirtualBox, the following command will be enough:
vagrant up --provider=virtualbox

If you want to use it with Google Cloud, then you need to change constants in Vagrantfile, add necessary key files and then use the following command:
vagrant up --provider=google

Ansible

Ansible provisioning is automatically executed when using vagrant up <...>.
If you want to run it manually, use vagrant provision or configure ansible hosts and execute the playbook