Giter Site home page Giter Site logo

bragov4ik / devops Goto Github PK

View Code? Open in Web Editor NEW

This project forked from innopolis-devops/labs

0.0 0.0 0.0 2.04 MB

Devops labs solutions for F22 course at Innopolis University

Dockerfile 4.68% Python 29.98% Rust 41.77% Jinja 0.80% Smarty 12.71% HCL 10.06%

devops's Introduction

Moscow time zone web application

Lint markdown files Python package Rust Rust audit

This application launches a web server that runs on port 8000 and responds with current time in UTC/GMT +3 timezone.

Endpoints

/

Shows current time according to the server

/status

Tests internal clock with other server, returns observed difference.

/visits

List of recorded visits to / endpoint

/metrics

Metrics formatted for Prometheus scraping

Python implementation

You can find implementation written in Python language in folder app_python. Also there is PYTHON.md file in the directory that lists some best practices used in the project and reasoning behind framework choice.

This application can be set up/run manually or as a docker container

Docker run guide

With docker compose

If you have docker compose installed, you can just write docker compose up inside project folder.

Without docker compose

Without compose you can use docker run -p 8000:8000 --rm bragov4ik/time_web_app:latest. Note that building the image by yourself requires docker buildkit enabled

Manual run

Preparation (set up)

  • Open project folder
  • Create virtual environment with python3 -m venv venv
  • Activate the venv with . venv/bin/activate
  • Install requirements with pip3 install -r requirements.txt

Run

Start the server with gunicorn app:app -b 0.0.0.0:8000

Unit tests

To test you first need to install requirements for test environment pip3 install -r requirements/test.txt

With pytest and other requirements installed you simply need to type pytest inside python project folder.

Docker hub integration

To publish a new version to docker hub create a tag corresponding to the (semver) version of expected image. For example v1.2.3.

When the tag appears in the repo, workflow will build the image and push it to docker hub.

Note that the tag must belong to some branch in GitHub otherwise the job will fail.

Rust ๐Ÿฆ€ memory-safe ๐Ÿ›ก๏ธ blazing fast ๐Ÿš€ implementation

Rust implementation together with corresponding RUST.md is located in app_rust folder.

This application can be set up/run manually or as a docker container.

Configuration

You can update webserver configuration in Rocket.toml file. Documentation on the config can be found here.

Docker run guide

With docker compose

If you have docker compose installed, you can just write docker compose up inside project folder.

Without docker compose

Without compose you can use docker run -p 8000:8000 --rm bragov4ik/time_rust_web_app:latest. Note that building the image by yourself requires docker buildkit enabled

Manual run

To run use cargo run

Usage

When any of the servers is up and running, you can open localhost:8000 and you should see current Moscow time.

Unit tests

To run tests write cargo test inside app_rust folder.

devops's People

Contributors

bragov4ik avatar cre-ed avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.