Metadata-Version: 2.2
Name: ddeutil-observe
Version: 0.0.6
Summary: Lightweight observation web application
Author-email: ddeutils <korawich.anu@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/ddeutils/ddeutil-observe/
Project-URL: Source Code, https://github.com/ddeutils/ddeutil-observe/
Keywords: data,observe,utility,webserver,fastapi
Classifier: Topic :: Utilities
Classifier: Natural Language :: English
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ddeutil[all]<0.5.0,>=0.4.3
Requires-Dist: ddeutil-workflow==0.0.35
Requires-Dist: python-dotenv==1.0.1
Requires-Dist: fastapi==0.115.8
Requires-Dist: uvicorn==0.34.0
Requires-Dist: jinja2==3.1.5
Requires-Dist: sqlalchemy==2.0.38
Requires-Dist: python-multipart==0.0.20
Requires-Dist: email-validator==2.2.0
Requires-Dist: pyjwt==2.10.1
Requires-Dist: bcrypt==4.2.1
Provides-Extra: perf
Requires-Dist: httptools; extra == "perf"
Requires-Dist: uvloop; extra == "perf"
Provides-Extra: test
Requires-Dist: httpx==0.28.1; extra == "test"
Requires-Dist: aiosqlite==0.20.0; extra == "test"

# Observe Application

[![test](https://github.com/ddeutils/ddeutil-observe/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/ddeutils/ddeutil-observe/actions/workflows/tests.yml)
[![pypi version](https://img.shields.io/pypi/v/ddeutil-observe)](https://pypi.org/project/ddeutil-observe/)
[![python support version](https://img.shields.io/pypi/pyversions/ddeutil-observe)](https://pypi.org/project/ddeutil-observe/)
[![size](https://img.shields.io/github/languages/code-size/ddeutils/ddeutil-observe)](https://github.com/ddeutils/ddeutil-observe)
[![gh license](https://img.shields.io/github/license/ddeutils/ddeutil-observe)](https://github.com/ddeutils/ddeutil-observe/blob/main/LICENSE)
[![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

The **Lightweight Observe Application** project was created for easy to
make an observe application that getting logs, audits, or trigger status
from any data framework storage and endpoint APIs.
This project focuses on the `ddeutil-workflow` tool first :dart:.

> [!WARNING]
> This project is the best fit integration with `ddeutil-workflow` package.
> The first propose is monitor and observe from worker nodes that deploy the
> workflow application on a target self-hosted.

## :round_pushpin: Installation

```shell
pip install -U ddeutil-observe
```

> :egg: **Docker Images** supported:
>
> | Docker Image               | Python Version | Support |
> |----------------------------|----------------|:-------:|
> | ddeutil-observe:latest     | `3.9`          |   :x:   |
> | ddeutil-observe:python3.10 | `3.10`         |   :x:   |
> | ddeutil-observe:python3.11 | `3.11`         |   :x:   |
> | ddeutil-observe:python3.12 | `3.12`         |   :x:   |
> | ddeutil-observe:python3.12 | `3.13`         |   :x:   |

> [!NOTE]
> If you want to increase this application performance, you can install the
> performance option, `pip install ddeutil-observe[perf]` (It does not edit
> code, it's just routing other faster packages).

## :beers: Getting Started

This project implement the best scalable FastAPI web application structure.
For the first phase, I will use the SQLite be a backend database that keep
authentication and workflows data.

### Main Page

```text

```

### Workflow Release Page

```text

```

## :cookie: Configuration

> [!IMPORTANT]
> The config value that you will set on the environment should combine with
> prefix, component, and name which is `OBSERVE_{component}_{name}` (Upper case).

| Environment                      | Component | Default                            | Description                                                                                    |
|:---------------------------------|:---------:|:-----------------------------------|:-----------------------------------------------------------------------------------------------|
| **TIMEZONE**                     |   Core    | `UTC`                              | A timezone that use on all components of this application                                      |
| **SQLALCHEMY_DB_ASYNC_URL**      |   Core    | `sqlite+aiosqlite:///./observe.db` | A database url of the application backend side                                                 |
| **ACCESS_SECRET_KEY**            |   Core    | `secrets.token_urlsafe(32)`        | A secret key that use to hash the access token with jwt package                                |
| **ACCESS_TOKEN_EXPIRE_MINUTES**  |   Core    | `30`                               | Expire period of the access token in minute unit                                               |
| **REFRESH_SECRET_KEY**           |   Core    | `secrets.token_urlsafe(32)`        | A secret key that use to hash the refresh token with jwt package                               |
| **REFRESH_TOKEN_EXPIRE_MINUTES** |   Core    | `60 * 24 * 8`                      | Expire period of the refresh token in minute unit                                              |
| **ADMIN_USER**                   |    Web    | `observe`                          | An username of superuser                                                                       |
| **ADMIN_PASS**                   |    Web    | `observe`                          | A password of superuser                                                                        |
| **ADMIN_EMAIL**                  |    Web    | `observe@mail.com`                 | An email of superuser                                                                          |
| **DEBUG_MODE**                   |    Log    | `true`                             | Logging mode                                                                                   |
| **SQLALCHEMY_DEBUG_MODE**        |    Log    | `true`                             | Database Logging mode that will logging every execution statement before and after connection  |

## :rocket: Deployment

```shell
(env) $ uvicorn src.ddeutil.observe.app:app \
  --host 127.0.0.1 \
  --port 88 \
  --no-access-log
```

> [!NOTE]
> If this package already deploy, it is able to use
> ```shell
> (env) $ uvicorn ddeutil.workflow.api:app \
>   --host 127.0.0.1 \
>   --port 88 \
>   --workers 4 \
>   --no-access-log
> ```

## :speech_balloon: Contribute

I do not think this project will go around the world because it has specific propose,
and you can create by your coding without this project dependency for long term
solution. So, on this time, you can open [the GitHub issue on this project :raised_hands:](https://github.com/ddeutils/ddeutil-observe/issues)
for fix bug or request new feature if you want it.
