diff --git a/project5_fastapi.txt b/project5_fastapi.txt new file mode 100644 index 0000000..00ea72a --- /dev/null +++ b/project5_fastapi.txt @@ -0,0 +1 @@ +{"message":"Welcome to my DevOps API!"} \ No newline at end of file diff --git a/project5_grafana_screenshot.png b/project5_grafana_screenshot.png new file mode 100644 index 0000000..8e4ab23 Binary files /dev/null and b/project5_grafana_screenshot.png differ diff --git a/project5_healthcheck.txt b/project5_healthcheck.txt new file mode 100644 index 0000000..66e9d6d --- /dev/null +++ b/project5_healthcheck.txt @@ -0,0 +1 @@ +{"status":"healthy","env":"production"} \ No newline at end of file diff --git a/project5_metrics.txt b/project5_metrics.txt new file mode 100644 index 0000000..909275e --- /dev/null +++ b/project5_metrics.txt @@ -0,0 +1 @@ +{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"custom_requests_total","endpoint":"health","instance":"fastapi:80","job":"fastapi"},"value":[1756879591.164,"98"]}]}} \ No newline at end of file diff --git a/project5_metrics_rate.txt b/project5_metrics_rate.txt new file mode 100644 index 0000000..5566de0 --- /dev/null +++ b/project5_metrics_rate.txt @@ -0,0 +1,35 @@ +{ + "status": "success", + "data": { + "resultType": "vector", + "result": [ + { + "metric": { + "endpoint": "health", + "instance": "fastapi:80", + "job": "fastapi" + }, + "value": [1756897364.474, "19.51929824561403" + ] + }, + { + "metric": { + "endpoint": "root", + "instance": "fastapi:80", + "job": "fastapi" + }, + "value": [1756897364.474, "0.01568627450980392" + ] + }, + { + "metric": { + "endpoint": "info", + "instance": "fastapi:80", + "job": "fastapi" + }, + "value": [1756897364.474, "0" + ] + } + ] + } +} diff --git a/project5_pods.txt b/project5_pods.txt new file mode 100644 index 0000000..a12a755 --- /dev/null +++ b/project5_pods.txt @@ -0,0 +1,7 @@ +NAME READY STATUS RESTARTS AGE +fastapi-6f9f9488d6-6cjh5 1/1 Running 0 2m5s +fastapi-6f9f9488d6-f4rr8 1/1 Running 0 84s +fastapi-6f9f9488d6-gprdd 1/1 Running 0 105s +grafana-8d59bb64b-f7rtj 1/1 Running 1 (10h ago) 11h +nginx-596fb74657-5jscb 1/1 Running 4 (2m11s ago) 35h +prometheus-7ff48ccd8-zv27g 1/1 Running 1 (10h ago) 11h diff --git a/project5_services.txt b/project5_services.txt new file mode 100644 index 0000000..e72b88b --- /dev/null +++ b/project5_services.txt @@ -0,0 +1,6 @@ +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +fastapi ClusterIP 10.99.233.181 80/TCP 36h +grafana LoadBalancer 10.101.198.72 3000:32193/TCP 11h +kubernetes ClusterIP 10.96.0.1 443/TCP 39h +nginx LoadBalancer 10.108.198.49 80:30391/TCP 36h +prometheus LoadBalancer 10.100.196.39 9090:30197/TCP 11h diff --git a/project5_test.txt b/project5_test.txt new file mode 100644 index 0000000..45082fb --- /dev/null +++ b/project5_test.txt @@ -0,0 +1,13 @@ +============================= test session starts ============================== +platform linux -- Python 3.12.3, pytest-8.4.1, pluggy-1.6.0 -- /home/ubuntu/server-setup/venv/bin/python3 +cachedir: .pytest_cache +rootdir: /home/ubuntu/server-setup +plugins: anyio-4.10.0, httpx-0.35.0 +collecting ... collected 4 items + +test_main.py::test_root PASSED [ 25%] +test_main.py::test_health PASSED [ 50%] +test_main.py::test_info PASSED [ 75%] +test_main.py::test_metrics PASSED [100%] + +============================== 4 passed in 0.39s =============================== diff --git a/requirements.txt b/requirements.txt index ce7258a..19d1245 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ fastapi>=0.116.1 uvicorn>=0.35.0 prometheus-fastapi-instrumentator>=7.1.0 +httpx>=0.28.1