Skip to content

Commit

Permalink
🔥 Remove redis, websockets, sse, and webhooks services (#1102)
Browse files Browse the repository at this point in the history
* 👷 🔥 Remove redis from docker-compose and manage

* 🎨 rewrite comments for nats events

* 🔥 delete redis-expire script

* ➖ remove redis dependency from endorser

* 👷 replace use of `codenvy/che-ip` image

* 👷 🎨 Replace redis_events reference with nats_events

* 👷 🔥 🎨 Remove references to webhooks service

* 🔥 delete webhooks module

* 🔥 remove webhooks endpoint, service and tests

* 🔥 remove webhooks dockerfile and mise tasks

* 🔥 remove redis service

* 🔥 delete websocket service and endpoint

* ➖ remove fastapi_websocket_pubsub

* ➖ remove extra packages from uvicorn install

* 🔧 🔥 delete redis/webhooks specific config files

* 🔥 delete webhooks e2e test

* 🎨 update readme docs

* 🎨 redis -> nats

* 🎨 remove webhooks config

* 🎨 remove lifespan check in test

* 🎨 remove webhooks related env vars

* 🔥🎨 remove SseListern's wait_for_state method

* 🔥🎨 remove sse, websocket endpoints from app main, and update doc descriptions

* ⬆️ Update lock files

* 🎨 remove unused `look_back` arg

* 🎨

* 🎨 remove billing service env vars

* 🎨 update project version

* 👷 add Waypoint module to dependabot

* 🚧 replace SSE URL to use Waypoint

* 📝 Update openapi docs

* 🎨 remove unused WEBHOOK_TOPIC_ALL

* 🎨 remove unused import

* 🔥🎨 re-add SSE routes, and only remove endpoints that used Webhooks URL

* ⏪ revert k6 changes

* 📝 Update openapi specs to include the one sse endpoint

* 🎨 add init modules

* 🎨 remove `look_back` references

* 🎨
  • Loading branch information
ff137 authored Oct 10, 2024
1 parent 5bc9c02 commit 80a6c29
Show file tree
Hide file tree
Showing 105 changed files with 963 additions and 14,433 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
!endorser/
!trustregistry/
!waypoint/
!webhooks/
!scripts/
!configuration/

Expand Down
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ export TENANT_ADMIN_FASTAPI_ENDPOINT=http://cloudapi.127.0.0.1.nip.io/tenant-adm
export TENANT_FASTAPI_ENDPOINT=http://cloudapi.127.0.0.1.nip.io/tenant
export TRUST_REGISTRY_FASTAPI_ENDPOINT=http://cloudapi.127.0.0.1.nip.io/public
export TRUST_REGISTRY_URL=http://trust-registry.cloudapi.127.0.0.1.nip.io
export WEBHOOKS_URL=http://webhooks.cloudapi.127.0.0.1.nip.io
export WAYPOINT_URL=http://waypoint.cloudapi.127.0.0.1.nip.io
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ updates:
day: saturday
time: "07:00"

# Maintain dependencies for Webhooks Service submodule
# Maintain dependencies for the Waypoint submodule
- package-ecosystem: pip
directory: /webhooks
directory: /waypoint
schedule:
interval: weekly
day: saturday
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ PROJECTS=(
governance-ga-agent
governance-trust-registry
governance-multitenant-web
governance-webhooks-web
governance-multitenant-agent
governance-endorser
)
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/continuous-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ jobs:
governance-ga-web,
governance-tenant-web,
governance-public-web,
governance-webhooks-web,
governance-multitenant-agent,
governance-endorser,
pytest,
Expand Down Expand Up @@ -99,10 +98,6 @@ jobs:
context: .
file: dockerfiles/fastapi/Dockerfile
platforms: linux/amd64,linux/arm64
- image: governance-webhooks-web
context: .
file: dockerfiles/webhooks/Dockerfile
platforms: linux/amd64,linux/arm64
- image: governance-multitenant-agent
context: .
file: dockerfiles/agents/Dockerfile.author.agent
Expand Down Expand Up @@ -196,7 +191,7 @@ jobs:
run: mise run poetry:install:all
- name: Run Pylint
run: |
poetry run pylint app/ endorser/ shared/ trustregistry/ waypoint/ webhooks/ --rcfile=.pylintrc -r n --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" --exit-zero > pylintreport.txt
poetry run pylint app/ endorser/ shared/ trustregistry/ waypoint/ --rcfile=.pylintrc -r n --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" --exit-zero > pylintreport.txt
test:
if: github.event.pull_request.draft == false
Expand Down
7 changes: 0 additions & 7 deletions .mise/tasks/poetry/install/webhooks

This file was deleted.

7 changes: 0 additions & 7 deletions .mise/tasks/poetry/update/webhooks

This file was deleted.

48 changes: 6 additions & 42 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import io
import os
import traceback
from contextlib import asynccontextmanager

import pydantic
import yaml
Expand All @@ -22,15 +21,12 @@
sse,
trust_registry,
verifier,
webhooks,
websocket_endpoint,
)
from app.routes.admin import tenants
from app.routes.wallet import credentials as wallet_credentials
from app.routes.wallet import dids as wallet_dids
from app.routes.wallet import jws as wallet_jws
from app.routes.wallet import sd_jws as wallet_sd_jws
from app.services.event_handling.websocket_manager import WebsocketManager
from app.util.extract_validation_error import extract_validation_error_msg
from shared.constants import PROJECT_VERSION
from shared.exceptions import CloudApiValueError
Expand All @@ -41,31 +37,10 @@
ROOT_PATH = os.getenv("ROOT_PATH", "")

cloud_api_docs_description = """
Welcome to the Aries CloudAPI Python project.
In addition to the traditional HTTP-based endpoints described below, we also offer WebSocket endpoints for
real-time interfacing with webhook events.
WebSocket endpoints are authenticated. This means that only users with valid authentication tokens can establish
a WebSocket connection, and they can only subscribe to their own wallet's events. However, Admin users have the
ability to subscribe by topic, or to any wallet in their group.
Our WebSocket endpoints are as follows:
1. `/v1/ws/`: This endpoint allows admins to receive all webhook events for their group.
2. `/v1/ws/{wallet_id}`: This endpoint allows admins (or authenticated users holding this wallet) to receive webhook
events for a specific wallet ID.
3. `/v1/ws/{wallet_id}/{topic}`: Similar to above, but subscribing to a specific topic.
Welcome to the Aries CloudAPI Python project!
4. `/v1/ws/topic/{topic}`: This endpoint allows admins to receive all webhook events on a specific topic (e.g.
`connections`, `credentials`, `proofs`, `endorsements`).
For authentication, the WebSocket headers should include `x-api-key`: `<your key>`.
Please refer to our API documentation for more details about our authentication mechanism, as well as for information
about the available topics.
For detailed guidance on using the API, please visit our official documentation:
https://www.didx.co.za/ssi-dev-portal/docs/Welcome.
"""

default_docs_description = """
Expand All @@ -77,19 +52,8 @@
debug = not prod


@asynccontextmanager
async def lifespan(_: FastAPI):
# Startup logic occurs before yield
yield
# Shutdown logic occurs after yield
logger.info("Calling WebsocketManager shutdown")
await WebsocketManager.disconnect_all()


webhook_routes = [webhooks, sse, websocket_endpoint]

trust_registry_routes = [trust_registry]
tenant_admin_routes = [tenants] + webhook_routes
tenant_admin_routes = [tenants, sse]
tenant_routes = [
connections,
definitions,
Expand All @@ -102,7 +66,8 @@ async def lifespan(_: FastAPI):
wallet_dids,
wallet_jws,
wallet_sd_jws,
] + webhook_routes
sse,
]


def routes_for_role(role: str) -> list:
Expand Down Expand Up @@ -131,7 +96,6 @@ def create_app() -> FastAPI:
title=OPENAPI_NAME,
version=PROJECT_VERSION,
description=cloud_api_description(ROLE),
lifespan=lifespan,
debug=debug,
redoc_url=None,
docs_url=None,
Expand Down
Loading

0 comments on commit 80a6c29

Please sign in to comment.