Skip to content

Commit

Permalink
Prototype NOS implementation (GSI-588) (#1)
Browse files Browse the repository at this point in the history
* Implement prototype

* Delete openapi workflow

* Remove unused pragmas

* Sync method docstrings for port and adapter orchestrator

* Undo static file change

* Fill in description.md

* Rename test_events to test_orchestrator

* Add convenience method to Notification with error logging

* Consolidate error log extras at top of methods

Update docstrings

Remove _retrieve_user_details

* Grab logot update from mrt

* Apply dispatch pattern to event subscriber

* Eat notification object in .notify

* Rename adapters folder to translators

* Raise custom error from KeyError

* Adapt CDS Email config name

* Remove copy-pasted volume

* Pack down redundant code in the orchestrator

* Fix weird port description

---------

Co-authored-by: TheByronHimes <TheByronHimes@gmail.com>
  • Loading branch information
TheByronHimes and TheByronHimes authored Mar 8, 2024
1 parent 44b92a4 commit 65bb393
Show file tree
Hide file tree
Showing 52 changed files with 2,285 additions and 1,641 deletions.
13 changes: 10 additions & 3 deletions .devcontainer/.dev_config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Please only mention the non-default settings here:

language: Greek
service_instance_id: "1"
central_data_stewardship_email: "test@test.abc"
db_connection_str: mongodb://localhost:27017
db_name: users
kafka_servers: ["kafka:9092"]
access_request_events_topic: "access_request_events"
access_request_created_type: "access_request_created"
access_request_allowed_type: "access_request_allowed"
access_request_denied_type: "access_request_denied"
notification_event_type: "notification"
notification_event_topic: "notification_events"
3 changes: 1 addition & 2 deletions .devcontainer/dev_launcher
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/bash

# adapt to package name
my-microservice
nos
25 changes: 2 additions & 23 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
INSTALL_NODE: "true"
NODE_VERSION: "lts/*"
# Please adapt to package name:
PACKAGE_NAME: "my_microservice"
PACKAGE_NAME: "nos"
# On Linux, you may need to update USER_UID and USER_GID below if not your local UID is not 1000.
USER_UID: 1000
USER_GID: 1000
Expand All @@ -32,39 +32,18 @@ services:
# define environment variables
environment:
# Please adapt to package name:
MY_MICROSERVICE_CONFIG_YAML: /workspace/.devcontainer/.dev_config.yaml
NOS_CONFIG_YAML: /workspace/.devcontainer/.dev_config.yaml
# Used by db migration:
DB_URL: postgresql://postgres:postgres@postgresql/postgres
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)


# Please remove service dependencies that are not needed:
mongodb:
image: mongo:latest
restart: unless-stopped
volumes:
- mongo_fs:/data/db

localstack:
image: localstack/localstack
environment:
SERVICES: s3
DEFAULT_REGION: eu-west-1
AWS_DEFAULT_REGION: eu-west-1
# accessible at localhost
HOSTNAME_EXTERNAL: localhost
USE_SSL: "false"
DATA_DIR: /var/lib/localstack/data
DEBUG: 1
volumes:
- type: volume
source: s3_fs
target: /var/lib/localstack
volume:
nocopy: true
# useful ports: 4566 - AWS API

volumes:
s3_fs: {}
mongo_fs: {}
19 changes: 0 additions & 19 deletions .github/workflows/check_openapi_spec.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ repos:
- id: no-commit-to-branch
args: [--branch, dev, --branch, int, --branch, main]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11
rev: v0.3.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
16 changes: 7 additions & 9 deletions .pyproject_generation/pyproject_custom.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
[project]
# please adapt to package name
name = "my_microservice"
name = "nos"
version = "0.1.0"
description = "My-Microservice - a short description"
description = "The Notification Orchestration Service controls the creation of notification events."
dependencies = [
"typer >= 0.9.0",
"ghga-service-commons[api] >= 1.2.0",
"ghga-event-schemas >= 1.0.0",
"hexkit[akafka,s3,mongodb] >= 1.1.0"
"ghga-service-commons[api] >= 3.0.0",
"ghga-event-schemas >= 3.0.0",
"hexkit[akafka,s3,mongodb] >= 2.1.0"
]

[project.urls]
# please adapt to package name
Repository = "https://github.com/ghga-de/my-microservice"
Repository = "https://github.com/ghga-de/notification-orchestration-service"

[project.scripts]
# please adapt to package name
my-microservice = "my_microservice.__main__:run"
nos = "nos.__main__:run"
4 changes: 3 additions & 1 deletion .readme_generation/description.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Please provide a short overview of the features of this service. -->

Here you should provide a short summary of the purpose of this microservice.
The Notification Orchestration Service (NOS) uses data harvested from events published
by various services to form Notification events, which are subsequently consumed by the
Notification Service (NS) for dissemination.
1 change: 1 addition & 0 deletions .template/mandatory_files_ignore.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Optional list of files which are actually mandatory in the template
# but are allowed to be removed in the current repository
scripts/script_utils/fastapi_app_location.py
2 changes: 2 additions & 0 deletions .template/static_files_ignore.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Optional list of files which are actually static in the template
# but are allowed to have different content in the current repository
scripts/update_openapi_docs.py
.github/workflows/check_openapi_spec.yaml
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ USER appuser
# set environment
ENV PYTHONUNBUFFERED=1
# Please adapt to package name:
ENTRYPOINT ["my-microservice"]
ENTRYPOINT ["nos"]
Loading

0 comments on commit 65bb393

Please sign in to comment.