The simple digital clock is a simple system designed to render the clock on the web. It allows you to use a digital clock display and render it on a web page which can be used as a dashboard. It allows for multiple clock display and setting of timezones to display the clocks of another timezone.
It has three features:
- Actual clock
- Stop watch
- Alarm
As the name above depicts, its actual purpose. A stop watch can start and stop it's timer as well as you can use it to receive triggers of when an event has occurred for another application. For example, you're trying to determine the time it takes for a specific operation to run, using the API, you can send a request to start the stop watch. Then send another API request to stop the watch. Basically what the app is doing is recording the start time for both event and it does a different between both to determine the duration.
"""
├── simple_clock # "simple_clock" is a Python package
│ ├── __init__.py # this file makes "simple_clock" a "Python package"
│ ├── main.py # "main" module, e.g. import simple_clock.main
│ ├── .gitignore # gitignore file
│ ├── .python-version # python version file
│ ├── Dockerfile # The Dockerfile of the app
│ ├── pyproject.toml # The project template file
│ ├── deploy.yaml # The kubernetes deployment file
│ ├── README.md # The read me instruction file
│ ├── requirements.txt # The installation and dependency file
│ └── api
│ │ ├── __init__.py # initial file
│ └── authentication
│ │ ├── __init__.py # initial file
│ │ ├── auth.py # holds the authentication module
│ └── config
│ │ ├── __init__.py # initial file
│ │ ├── settings.py # holds the app configuration settings
│ └── database
│ │ ├── __init__.py # initial file
│ │ ├── models.py # data model for the db
│ │ └── sessions.py # creates the db sessions
│ └── datatypes
│ │ ├── __init__.py # initial file
│ │ ├── classification.py # defines each data structure within the app
│ └── errors
│ │ ├── __init__.py # initial file
│ └── logging
│ │ ├── __init__.py # initial file
│ └── routers # "routers" is a "Python subpackage"
│ │ ├── __init__.py # initial file
│ └── utils # "utils" is a "Python subpackage"
│ │ ├── __init__.py # makes "internal" a "Python subpackage"
│ │ └── helpers.py # "helpers" submodule, e.g. import app.internal.admin
"""
This app shows different ways to install the app locally.
You can run the app by simply forking the repo
cd simple_clock
pip install -r requirements.txt
fastapi dev main.pyThe terminal should render the URL for both the app and the API docs.
Ensure you have docker installed and running on your device
# build the docker image
docker build -f ./simple_clock/Dockerfile -t simple-clock .
# run the docker image
docker run -p 8001:8000 simple-clockThen navigate to this URL http://localhost:8001 to view the app. To view the API
doc visit this URL http://localhost:8001/docs
- Ensure you have installed
kubectland also enable docker-desktop kubernetes - You can enable docker-desktop for kubernetes in your docker settings.
- Settings > Kubernetes
- Once that is done, switch to use docker-desktop as context
-
kubectl config use-context docker-desktop
- Run the deployment by using the below command
cd simple_clock
Kubectl apply -f deploy.yaml Then navigate to this URL http://localhost:9000 to view the app. To view the API
doc visit this URL http://localhost:9000/docs
- This app is a WIP and basically, it is supposed to be linked to a frontend which is Simple Display Clock
- We should also link this app to AWS lambda and API Gateway or typically AWS EKS once the entire app is created.