Skip to content

rufusnufus/devops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevOps course at Innopolis University

FastAPI Docker GitHub license

ci workflow

Overview

This is Python web application written using FastAPI framework and WorldTimeAPI showing current Moscow time.

Getting Started

Local installation

Before running the application, please install its prerequisites:

To run from the master branch, follow the instructions below:

  1. Clone web application repository locally.
    git clone https://github.com/rufusnufus/devops
    cd devops/app_python/
  2. Create virtual environment.
    python3 -m virtualenv venv 
    source venv/bin/activate
  3. Install packages.
    pip install -r requirements.txt
  4. Run the application. Web app will open at http://localhost:8000/.
    uvicorn moscow_time.main:app --reload

Docker installation

Before running the application, please install its prerequisites:

To run from the master branch, follow the instructions below:

  1. Clone web application repository locally.
    git clone https://github.com/rufusnufus/devops
    cd devops/app_python/
  2. [Optional] Build the image.
    docker build -t nufusrufus/devops .
  3. Run the container. Web app will open at http://localhost:8000/.
    docker run -p 8000:8000 -v data:/home/app/data nufusrufus/devops
    

Unit Testing

  1. Make sure that you are in the application directory:
    cd devops/app_python
  2. Run the tests:
    pytest tests

Endpoints

  • / - shows moscow current time
  • /metrics - shows metrics of the app
  • /visits - times when the root path / was accessed by the client

Contacts

If you have any questions or ideas, write me in Telegram: @rufusnufus