Skip to content

✨ adds notifications service (⚠️ devops) #7436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 65 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
e8c4c8c
unit tests
Mar 26, 2025
5033ace
rpc namespace
Mar 26, 2025
b08d0a7
added new service
Mar 26, 2025
d192df5
added service in compose files
Mar 26, 2025
b58f9fc
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-not…
Mar 26, 2025
4251212
make CI trigger
Mar 26, 2025
d045e2a
migrate to lifespan from setup
Mar 26, 2025
45f0fa6
trigger ci
Mar 26, 2025
885aadf
remove unused
Mar 26, 2025
e37453c
using CSR pattern
Mar 26, 2025
04cd03b
fixed routing
Mar 26, 2025
2bd819e
added missing env vars
Mar 26, 2025
5a89d0b
added posrtgres to requirements
Mar 28, 2025
9e26f0b
added rest of service
Mar 28, 2025
c5f0604
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-not…
Mar 28, 2025
d0f3e02
removed unused
Mar 28, 2025
441706e
revert
Mar 28, 2025
d9659dd
added spec generation
Mar 28, 2025
e5ea1ea
fixed install
Mar 28, 2025
44560db
module can now be imported
Mar 28, 2025
878dd0a
bumped timeouts
Mar 28, 2025
7647fda
constrained aiopika
Mar 28, 2025
c5a5ffd
revert
Mar 28, 2025
0e40763
alligned files
Mar 28, 2025
b9fac90
added missing
Mar 28, 2025
dfe5af5
removed constraints
Mar 28, 2025
7ba0b46
making test async to try in ci
Mar 28, 2025
1913266
rename
Mar 28, 2025
82f6418
services/notifications version: 0.0.1 → 0.0.2
Mar 28, 2025
22a6c69
revert changes
Mar 28, 2025
852ae92
services/notifications version: 0.0.2 → 0.0.3
Mar 28, 2025
2347d89
rename
Apr 9, 2025
5b22401
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-not…
Apr 9, 2025
2af93ea
fixed broken tests
Apr 9, 2025
e769ee3
renamed and repalce
Apr 10, 2025
7826b06
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-not…
Apr 11, 2025
1b15400
using new style lifespans
Apr 11, 2025
26865a8
remove unused
Apr 11, 2025
f9f9155
updated specs
Apr 11, 2025
38bfa82
using free port to deploy
Apr 11, 2025
fccd907
added health endpoint
Apr 11, 2025
2bf1f34
removing rclone
Apr 11, 2025
6a5ab9b
change log level
Apr 11, 2025
c549b17
rename with better naming
Apr 11, 2025
a07de4e
move /health endpoint to /
Apr 11, 2025
bc3f051
remove unused
Apr 11, 2025
2d6ec3e
removed unused
Apr 11, 2025
fc65e44
added owners
Apr 22, 2025
574934b
health updates
Apr 22, 2025
f11f14a
refactor
Apr 22, 2025
ab870e9
remove integrations folder
Apr 22, 2025
8f3bb33
added tests for health
Apr 22, 2025
4e9ccca
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-not…
Apr 22, 2025
e36bd2b
fixed openapi specs script
Apr 22, 2025
bc7651d
refactor services to clients
Apr 22, 2025
22f69c9
added services as empty
Apr 22, 2025
b6fd7d8
fixed service building
Apr 22, 2025
44ea04c
bumped test coverage
Apr 23, 2025
b5dce44
fixed failing test
Apr 23, 2025
f54c61f
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-not…
Apr 24, 2025
5fae894
sugestions
Apr 24, 2025
d98653c
verison changes
Apr 24, 2025
0fda9c3
feedback
Apr 24, 2025
aadf6d1
Merge remote-tracking branch 'upstream/master' into pr-osparc-add-not…
Apr 24, 2025
e11f9bb
update openapi.json
Apr 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .env-devel
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ DYNAMIC_SIDECAR_API_SAVE_RESTORE_STATE_TIMEOUT=01:00:00
DIRECTOR_V2_TRACING=null

# DYNAMIC_SCHEDULER ----
DYNAMIC_SCHEDULER_LOGLEVEL=DEBUG
DYNAMIC_SCHEDULER_LOGLEVEL=INFO
DYNAMIC_SCHEDULER_PROFILING=1
DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER=0
DYNAMIC_SCHEDULER_STOP_SERVICE_TIMEOUT=01:00:00
Expand Down Expand Up @@ -164,6 +164,9 @@ INVITATIONS_TRACING=null
LOG_FORMAT_LOCAL_DEV_ENABLED=1
LOG_FILTER_MAPPING='{}'

NOTIFICATIONS_LOGLEVEL=INFO
NOTIFICATIONS_TRACING=null

PAYMENTS_ACCESS_TOKEN_EXPIRE_MINUTES=30
PAYMENTS_ACCESS_TOKEN_SECRET_KEY=2c0411810565e063309be1457009fb39ce023946f6a354e6935107b57676
PAYMENTS_AUTORECHARGE_DEFAULT_MONTHLY_LIMIT=10000
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Makefile @pcrespov @sanderegg
/services/efs-guardian/ @matusdrobuliak66
/services/invitations/ @pcrespov
/services/migration/ @pcrespov
/services/notifications/ @GitHK
/services/payments/ @pcrespov @matusdrobuliak66
/services/resource-usage-tracker/ @matusdrobuliak66
/services/static-webserver/ @GitHK
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/ci-testing-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
settings-library: ${{ steps.filter.outputs.settings-library }}
simcore-sdk: ${{ steps.filter.outputs.simcore-sdk }}
agent: ${{ steps.filter.outputs.agent }}
notifications: ${{ steps.filter.outputs.notifications }}
api: ${{ steps.filter.outputs.api }}
api-server: ${{ steps.filter.outputs.api-server }}
autoscaling: ${{ steps.filter.outputs.autoscaling }}
Expand Down Expand Up @@ -150,6 +151,12 @@ jobs:
- 'services/docker-compose*'
- 'scripts/mypy/*'
- 'mypy.ini'
notifications:
- 'packages/**'
- 'services/notifications/**'
- 'services/docker-compose*'
- 'scripts/mypy/*'
- 'mypy.ini'
api:
- 'api/**'
api-server:
Expand Down Expand Up @@ -602,6 +609,49 @@ jobs:
with:
flags: unittests #optional

unit-test-notifications:
needs: changes
if: ${{ needs.changes.outputs.notifications == 'true' || github.event_name == 'push' }}
timeout-minutes: 18 # if this timeout gets too small, then split the tests
name: "[unit] notifications"
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: ["3.11"]
os: [ubuntu-24.04]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
- name: setup python environment
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.5.x"
enable-cache: false
cache-dependency-glob: "**/notifications/requirements/ci.txt"
- name: show system version
run: ./ci/helpers/show_system_versions.bash
- name: install
run: ./ci/github/unit-testing/notifications.bash install
- name: typecheck
run: ./ci/github/unit-testing/notifications.bash typecheck
- name: test
if: ${{ !cancelled() }}
run: ./ci/github/unit-testing/notifications.bash test
- uses: codecov/codecov-action@v5
if: ${{ !cancelled() }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
flags: unittests #optional

unit-test-api:
needs: changes
Expand Down Expand Up @@ -1834,6 +1884,7 @@ jobs:
unit-test-common-library,
unit-test-notifications-library,
unit-test-payments,
unit-test-notifications,
unit-test-dynamic-scheduler,
unit-test-postgres-database,
unit-test-python-linting,
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ SERVICES_NAMES_TO_BUILD := \
efs-guardian \
invitations \
migration \
notifications \
payments \
resource-usage-tracker \
dynamic-scheduler \
Expand Down
43 changes: 43 additions & 0 deletions ci/github/unit-testing/notifications.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -o errexit # abort on nonzero exitstatus
set -o nounset # abort on unbound variable
set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd services/notifications
make install-ci
popd
uv pip list
}

test() {
# shellcheck source=/dev/null
source .venv/bin/activate
pushd services/notifications
make test-ci-unit
popd
}

typecheck() {
# shellcheck source=/dev/null
source .venv/bin/activate
uv pip install mypy
pushd services/notifications
make mypy
popd
}

# Check if the function exists (bash specific)
if declare -f "$1" >/dev/null; then
# call arguments verbatim
"$@"
else
# Show a helpful error
echo "'$1' is not a known function name" >&2
exit 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from typing import Final

from pydantic import TypeAdapter

from ..rabbitmq_basic_types import RPCNamespace

NOTIFICATIONS_RPC_NAMESPACE: Final[RPCNamespace] = TypeAdapter(
RPCNamespace
).validate_python("notifications")
5 changes: 3 additions & 2 deletions packages/models-library/src/models_library/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ class ErrorDict(_ErrorDictRequired, total=False):
ctx: dict[str, Any]


RABBITMQ_CLIENT_UNHEALTHY_MSG = "RabbitMQ client is in a bad state!"
RABBITMQ_CLIENT_UNHEALTHY_MSG = "RabbitMQ cannot be reached!"
POSRGRES_DATABASE_UNHEALTHY_MSG = "Postgres cannot be reached!"
REDIS_CLIENT_UNHEALTHY_MSG = "Redis cannot be reached!"
DOCKER_API_PROXY_UNHEALTHY_MSG = "docker-api-proxy service is not reachable!"
DOCKER_API_PROXY_UNHEALTHY_MSG = "docker-api-proxy cannot be reached!"


# NOTE: Here we do not just import as 'from pydantic.error_wrappers import ErrorDict'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"autoscaling": "/",
"clusters-keeper": "/",
"dask-scheduler": "/health",
"notifications": "/",
"datcore-adapter": "/v0/live",
"director-v2": "/",
"dynamic-schdlr": "/",
Expand Down
17 changes: 17 additions & 0 deletions services/docker-compose-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,23 @@ services:
org.opencontainers.image.source: "${VCS_URL}"
org.opencontainers.image.revision: "${VCS_REF}"

notifications:
image: local/notifications:${BUILD_TARGET:?build_target_required}
build:
context: ../
dockerfile: services/notifications/Dockerfile
cache_from:
- local/notifications:${BUILD_TARGET:?build_target_required}
- ${DOCKER_REGISTRY:-itisfoundation}/notifications:master-github-latest
- ${DOCKER_REGISTRY:-itisfoundation}/notifications:staging-github-latest
- ${DOCKER_REGISTRY:-itisfoundation}/notifications:release-github-latest
target: production
labels:
org.label-schema.schema-version: "1.0"
org.opencontainers.image.created: "${BUILD_DATE}"
org.opencontainers.image.source: "${VCS_URL}"
org.opencontainers.image.revision: "${VCS_REF}"

resource-usage-tracker:
image: local/resource-usage-tracker:${BUILD_TARGET:?build_target_required}
build:
Expand Down
2 changes: 2 additions & 0 deletions services/docker-compose-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ services:
image: ${DOCKER_REGISTRY:-itisfoundation}/invitations:${DOCKER_IMAGE_TAG:-latest}
migration:
image: ${DOCKER_REGISTRY:-itisfoundation}/migration:${DOCKER_IMAGE_TAG:-latest}
notifications:
image: ${DOCKER_REGISTRY:-itisfoundation}/notifications:${DOCKER_IMAGE_TAG:-latest}
payments:
image: ${DOCKER_REGISTRY:-itisfoundation}/payments:${DOCKER_IMAGE_TAG:-latest}
dynamic-scheduler:
Expand Down
10 changes: 10 additions & 0 deletions services/docker-compose.devel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ services:
- ../packages:/devel/packages
- ${HOST_UV_CACHE_DIR}:/home/scu/.cache/uv

notifications:
environment:
<<: *common-environment
NOTIFICATIONS_PROFILING : ${NOTIFICATIONS_PROFILING}
NOTIFICATIONS_LOGLEVEL: DEBUG
volumes:
- ./notifications:/devel/services/notifications
- ../packages:/devel/packages
- ${HOST_UV_CACHE_DIR}:/home/scu/.cache/uv

clusters-keeper:
environment:
<<: *common-environment
Expand Down
8 changes: 8 additions & 0 deletions services/docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ services:
- "8008:8000"
- "3017:3000"

notifications:
environment:
<<: *common_environment
INVITATIONS_REMOTE_DEBUGGING_PORT : 3000
ports:
- "8015:8000"
- "3023:3000"

payments:
environment:
<<: *common_environment
Expand Down
29 changes: 29 additions & 0 deletions services/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,35 @@ services:
TRACING_OPENTELEMETRY_COLLECTOR_ENDPOINT: ${TRACING_OPENTELEMETRY_COLLECTOR_ENDPOINT}
TRACING_OPENTELEMETRY_COLLECTOR_PORT: ${TRACING_OPENTELEMETRY_COLLECTOR_PORT}

notifications:
image: ${DOCKER_REGISTRY:-itisfoundation}/notifications:${DOCKER_IMAGE_TAG:-latest}
init: true
hostname: "{{.Node.Hostname}}-{{.Task.Slot}}"

environment:
LOG_FILTER_MAPPING : ${LOG_FILTER_MAPPING}
LOG_FORMAT_LOCAL_DEV_ENABLED: ${LOG_FORMAT_LOCAL_DEV_ENABLED}

NOTIFICATIONS_LOGLEVEL: ${NOTIFICATIONS_LOGLEVEL}
NOTIFICATIONS_TRACING: ${NOTIFICATIONS_TRACING}

POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_ENDPOINT: ${POSTGRES_ENDPOINT}
POSTGRES_HOST: ${POSTGRES_HOST}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_USER: ${POSTGRES_USER}

RABBIT_HOST: ${RABBIT_HOST}
RABBIT_PASSWORD: ${RABBIT_PASSWORD}
RABBIT_PORT: ${RABBIT_PORT}
RABBIT_SECURE: ${RABBIT_SECURE}
RABBIT_USER: ${RABBIT_USER}

TRACING_OPENTELEMETRY_COLLECTOR_ENDPOINT: ${TRACING_OPENTELEMETRY_COLLECTOR_ENDPOINT}
TRACING_OPENTELEMETRY_COLLECTOR_PORT: ${TRACING_OPENTELEMETRY_COLLECTOR_PORT}


dask-sidecar:
image: ${DOCKER_REGISTRY:-itisfoundation}/dask-sidecar:${DOCKER_IMAGE_TAG:-latest}
init: true
Expand Down
2 changes: 1 addition & 1 deletion services/dynamic-scheduler/tests/unit/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_echo_dotenv(cli_runner: CliRunner, monkeypatch: pytest.MonkeyPatch):

with monkeypatch.context() as patch:
setenvs_from_dict(patch, environs)
ApplicationSettings.create_from_envs()
assert ApplicationSettings.create_from_envs()


def test_list_settings(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ async def test_is_unhealthy_via_rabbitmq(test_client: TestClient) -> None:
test_client.application.state.rabbitmq_client._healthy_state = False # noqa: SLF001
response = await test_client.get("/health")
assert response.status_code == status.HTTP_503_SERVICE_UNAVAILABLE, response
assert response.json() == {"detail": "RabbitMQ client is in a bad state!"}
assert response.json() == {"detail": "RabbitMQ cannot be reached!"}
Loading
Loading