Skip to content

Commit 2155efe

Browse files
GitHKAndrei Neagu
andauthored
✨ adds notifications service (⚠️ devops) (#7436)
Co-authored-by: Andrei Neagu <[email protected]>
1 parent bb45023 commit 2155efe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2251
-5
lines changed

.env-devel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ DYNAMIC_SIDECAR_API_SAVE_RESTORE_STATE_TIMEOUT=01:00:00
132132
DIRECTOR_V2_TRACING=null
133133

134134
# DYNAMIC_SCHEDULER ----
135-
DYNAMIC_SCHEDULER_LOGLEVEL=DEBUG
135+
DYNAMIC_SCHEDULER_LOGLEVEL=INFO
136136
DYNAMIC_SCHEDULER_PROFILING=1
137137
DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER=0
138138
DYNAMIC_SCHEDULER_STOP_SERVICE_TIMEOUT=01:00:00
@@ -164,6 +164,9 @@ INVITATIONS_TRACING=null
164164
LOG_FORMAT_LOCAL_DEV_ENABLED=1
165165
LOG_FILTER_MAPPING='{}'
166166

167+
NOTIFICATIONS_LOGLEVEL=INFO
168+
NOTIFICATIONS_TRACING=null
169+
167170
PAYMENTS_ACCESS_TOKEN_EXPIRE_MINUTES=30
168171
PAYMENTS_ACCESS_TOKEN_SECRET_KEY=2c0411810565e063309be1457009fb39ce023946f6a354e6935107b57676
169172
PAYMENTS_AUTORECHARGE_DEFAULT_MONTHLY_LIMIT=10000

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Makefile @pcrespov @sanderegg
3535
/services/efs-guardian/ @matusdrobuliak66
3636
/services/invitations/ @pcrespov
3737
/services/migration/ @pcrespov
38+
/services/notifications/ @GitHK
3839
/services/payments/ @pcrespov @matusdrobuliak66
3940
/services/resource-usage-tracker/ @matusdrobuliak66
4041
/services/static-webserver/ @GitHK

.github/workflows/ci-testing-deploy.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
settings-library: ${{ steps.filter.outputs.settings-library }}
6363
simcore-sdk: ${{ steps.filter.outputs.simcore-sdk }}
6464
agent: ${{ steps.filter.outputs.agent }}
65+
notifications: ${{ steps.filter.outputs.notifications }}
6566
api: ${{ steps.filter.outputs.api }}
6667
api-server: ${{ steps.filter.outputs.api-server }}
6768
autoscaling: ${{ steps.filter.outputs.autoscaling }}
@@ -150,6 +151,12 @@ jobs:
150151
- 'services/docker-compose*'
151152
- 'scripts/mypy/*'
152153
- 'mypy.ini'
154+
notifications:
155+
- 'packages/**'
156+
- 'services/notifications/**'
157+
- 'services/docker-compose*'
158+
- 'scripts/mypy/*'
159+
- 'mypy.ini'
153160
api:
154161
- 'api/**'
155162
api-server:
@@ -602,6 +609,49 @@ jobs:
602609
with:
603610
flags: unittests #optional
604611

612+
unit-test-notifications:
613+
needs: changes
614+
if: ${{ needs.changes.outputs.notifications == 'true' || github.event_name == 'push' }}
615+
timeout-minutes: 18 # if this timeout gets too small, then split the tests
616+
name: "[unit] notifications"
617+
runs-on: ${{ matrix.os }}
618+
strategy:
619+
matrix:
620+
python: ["3.11"]
621+
os: [ubuntu-24.04]
622+
fail-fast: false
623+
steps:
624+
- uses: actions/checkout@v4
625+
- name: setup docker buildx
626+
id: buildx
627+
uses: docker/setup-buildx-action@v3
628+
with:
629+
driver: docker-container
630+
- name: setup python environment
631+
uses: actions/setup-python@v5
632+
with:
633+
python-version: ${{ matrix.python }}
634+
- name: install uv
635+
uses: astral-sh/setup-uv@v5
636+
with:
637+
version: "0.5.x"
638+
enable-cache: false
639+
cache-dependency-glob: "**/notifications/requirements/ci.txt"
640+
- name: show system version
641+
run: ./ci/helpers/show_system_versions.bash
642+
- name: install
643+
run: ./ci/github/unit-testing/notifications.bash install
644+
- name: typecheck
645+
run: ./ci/github/unit-testing/notifications.bash typecheck
646+
- name: test
647+
if: ${{ !cancelled() }}
648+
run: ./ci/github/unit-testing/notifications.bash test
649+
- uses: codecov/codecov-action@v5
650+
if: ${{ !cancelled() }}
651+
env:
652+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
653+
with:
654+
flags: unittests #optional
605655

606656
unit-test-api:
607657
needs: changes
@@ -1834,6 +1884,7 @@ jobs:
18341884
unit-test-common-library,
18351885
unit-test-notifications-library,
18361886
unit-test-payments,
1887+
unit-test-notifications,
18371888
unit-test-dynamic-scheduler,
18381889
unit-test-postgres-database,
18391890
unit-test-python-linting,

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ SERVICES_NAMES_TO_BUILD := \
4444
efs-guardian \
4545
invitations \
4646
migration \
47+
notifications \
4748
payments \
4849
resource-usage-tracker \
4950
dynamic-scheduler \
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
3+
set -o errexit # abort on nonzero exitstatus
4+
set -o nounset # abort on unbound variable
5+
set -o pipefail # don't hide errors within pipes
6+
IFS=$'\n\t'
7+
8+
install() {
9+
make devenv
10+
# shellcheck source=/dev/null
11+
source .venv/bin/activate
12+
pushd services/notifications
13+
make install-ci
14+
popd
15+
uv pip list
16+
}
17+
18+
test() {
19+
# shellcheck source=/dev/null
20+
source .venv/bin/activate
21+
pushd services/notifications
22+
make test-ci-unit
23+
popd
24+
}
25+
26+
typecheck() {
27+
# shellcheck source=/dev/null
28+
source .venv/bin/activate
29+
uv pip install mypy
30+
pushd services/notifications
31+
make mypy
32+
popd
33+
}
34+
35+
# Check if the function exists (bash specific)
36+
if declare -f "$1" >/dev/null; then
37+
# call arguments verbatim
38+
"$@"
39+
else
40+
# Show a helpful error
41+
echo "'$1' is not a known function name" >&2
42+
exit 1
43+
fi
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from typing import Final
2+
3+
from pydantic import TypeAdapter
4+
5+
from ..rabbitmq_basic_types import RPCNamespace
6+
7+
NOTIFICATIONS_RPC_NAMESPACE: Final[RPCNamespace] = TypeAdapter(
8+
RPCNamespace
9+
).validate_python("notifications")

packages/models-library/src/models_library/errors.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ class ErrorDict(_ErrorDictRequired, total=False):
3434
ctx: dict[str, Any]
3535

3636

37-
RABBITMQ_CLIENT_UNHEALTHY_MSG = "RabbitMQ client is in a bad state!"
37+
RABBITMQ_CLIENT_UNHEALTHY_MSG = "RabbitMQ cannot be reached!"
38+
POSRGRES_DATABASE_UNHEALTHY_MSG = "Postgres cannot be reached!"
3839
REDIS_CLIENT_UNHEALTHY_MSG = "Redis cannot be reached!"
39-
DOCKER_API_PROXY_UNHEALTHY_MSG = "docker-api-proxy service is not reachable!"
40+
DOCKER_API_PROXY_UNHEALTHY_MSG = "docker-api-proxy cannot be reached!"
4041

4142

4243
# NOTE: Here we do not just import as 'from pydantic.error_wrappers import ErrorDict'

packages/pytest-simcore/src/pytest_simcore/simcore_services.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"autoscaling": "/",
4848
"clusters-keeper": "/",
4949
"dask-scheduler": "/health",
50+
"notifications": "/",
5051
"datcore-adapter": "/v0/live",
5152
"director-v2": "/",
5253
"dynamic-schdlr": "/",

services/docker-compose-build.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,23 @@ services:
169169
org.opencontainers.image.source: "${VCS_URL}"
170170
org.opencontainers.image.revision: "${VCS_REF}"
171171

172+
notifications:
173+
image: local/notifications:${BUILD_TARGET:?build_target_required}
174+
build:
175+
context: ../
176+
dockerfile: services/notifications/Dockerfile
177+
cache_from:
178+
- local/notifications:${BUILD_TARGET:?build_target_required}
179+
- ${DOCKER_REGISTRY:-itisfoundation}/notifications:master-github-latest
180+
- ${DOCKER_REGISTRY:-itisfoundation}/notifications:staging-github-latest
181+
- ${DOCKER_REGISTRY:-itisfoundation}/notifications:release-github-latest
182+
target: production
183+
labels:
184+
org.label-schema.schema-version: "1.0"
185+
org.opencontainers.image.created: "${BUILD_DATE}"
186+
org.opencontainers.image.source: "${VCS_URL}"
187+
org.opencontainers.image.revision: "${VCS_REF}"
188+
172189
resource-usage-tracker:
173190
image: local/resource-usage-tracker:${BUILD_TARGET:?build_target_required}
174191
build:

services/docker-compose-deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ services:
2525
image: ${DOCKER_REGISTRY:-itisfoundation}/invitations:${DOCKER_IMAGE_TAG:-latest}
2626
migration:
2727
image: ${DOCKER_REGISTRY:-itisfoundation}/migration:${DOCKER_IMAGE_TAG:-latest}
28+
notifications:
29+
image: ${DOCKER_REGISTRY:-itisfoundation}/notifications:${DOCKER_IMAGE_TAG:-latest}
2830
payments:
2931
image: ${DOCKER_REGISTRY:-itisfoundation}/payments:${DOCKER_IMAGE_TAG:-latest}
3032
dynamic-scheduler:

0 commit comments

Comments
 (0)