This application launches a web server that runs on port 8000 and responds with current time in UTC/GMT +3 timezone.
Shows current time according to the server
Tests internal clock with other server, returns observed difference.
List of recorded visits to /
endpoint
Metrics formatted for Prometheus scraping
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
If you have docker compose installed, you can just write docker compose up
inside project folder.
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
- 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
Start the server with gunicorn app:app -b 0.0.0.0:8000
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.
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 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.
You can update webserver configuration in Rocket.toml
file. Documentation on the config can be found here.
If you have docker compose installed, you can just write docker compose up
inside project folder.
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
To run use cargo run
When any of the servers is up and running, you can open localhost:8000 and you should see current Moscow time.
To run tests write cargo test
inside app_rust
folder.