Skip to content

Commit 7ea3b05

Browse files
GitHKAndrei Neagumergify[bot]
authored
🐛 fixed issue where notifications service would not start in development mode (#7580)
Co-authored-by: Andrei Neagu <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 396202b commit 7ea3b05

File tree

6 files changed

+20
-17
lines changed

6 files changed

+20
-17
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export STORAGE_API_VERSION := $(shell cat $(CURDIR)/services/storage/VERSION)
7474
export INVITATIONS_API_VERSION := $(shell cat $(CURDIR)/services/invitations/VERSION)
7575
export PAYMENTS_API_VERSION := $(shell cat $(CURDIR)/services/payments/VERSION)
7676
export DYNAMIC_SCHEDULER_API_VERSION := $(shell cat $(CURDIR)/services/dynamic-scheduler/VERSION)
77+
export NOTIFICATIONS_API_VERSION := $(shell cat $(CURDIR)/services/notifications/VERSION)
7778
export DATCORE_ADAPTER_API_VERSION := $(shell cat $(CURDIR)/services/datcore-adapter/VERSION)
7879
export WEBSERVER_API_VERSION := $(shell cat $(CURDIR)/services/web/server/VERSION)
7980

@@ -611,6 +612,7 @@ settings-schema.json: ## [container] dumps json-schema settings of all services
611612
@$(MAKE_C) services/invitations $@
612613
@$(MAKE_C) services/payments $@
613614
@$(MAKE_C) services/dynamic-scheduler $@
615+
@$(MAKE_C) services/notifications $@
614616
@$(MAKE_C) services/storage $@
615617
@$(MAKE_C) services/web/server $@
616618

services/docker-compose-build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,13 @@ services:
179179
- ${DOCKER_REGISTRY:-itisfoundation}/notifications:master-github-latest
180180
- ${DOCKER_REGISTRY:-itisfoundation}/notifications:staging-github-latest
181181
- ${DOCKER_REGISTRY:-itisfoundation}/notifications:release-github-latest
182-
target: production
182+
target: ${BUILD_TARGET:?build_target_required}
183183
labels:
184184
org.label-schema.schema-version: "1.0"
185185
org.opencontainers.image.created: "${BUILD_DATE}"
186186
org.opencontainers.image.source: "${VCS_URL}"
187187
org.opencontainers.image.revision: "${VCS_REF}"
188+
io.osparc.api-version: "${NOTIFICATIONS_API_VERSION}"
188189

189190
resource-usage-tracker:
190191
image: local/resource-usage-tracker:${BUILD_TARGET:?build_target_required}

services/docker-compose.local.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ services:
9191
notifications:
9292
environment:
9393
<<: *common_environment
94-
INVITATIONS_REMOTE_DEBUGGING_PORT : 3000
94+
NOTIFICATIONS_REMOTE_DEBUGGING_PORT : 3000
9595
ports:
9696
- "8015:8000"
9797
- "3023:3000"

services/dynamic-scheduler/Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
5656
# those from our virtualenv.
5757
ENV PATH="${VIRTUAL_ENV}/bin:$PATH"
5858

59-
EXPOSE 8000
60-
6159
# -------------------------- Build stage -------------------
6260
# Installs build/package management tools and third party dependencies
6361
#
@@ -91,7 +89,6 @@ WORKDIR /build
9189

9290

9391

94-
9592
# --------------------------Prod-depends-only stage -------------------
9693
# This stage is for production only dependencies that get partially wiped out afterwards (final docker image concerns)
9794
#
@@ -100,7 +97,7 @@ WORKDIR /build
10097
#
10198
FROM build AS prod-only-deps
10299

103-
ENV SC_BUILD_TARGET prod-only-deps
100+
ENV SC_BUILD_TARGET=prod-only-deps
104101

105102
WORKDIR /build/services/dynamic-scheduler
106103

@@ -153,6 +150,7 @@ HEALTHCHECK \
153150
ENTRYPOINT [ "/bin/sh", "services/dynamic-scheduler/docker/entrypoint.sh" ]
154151
CMD ["/bin/sh", "services/dynamic-scheduler/docker/boot.sh"]
155152

153+
EXPOSE 8000
156154

157155
# --------------------------Development stage -------------------
158156
# Source code accessible in host but runs in container
@@ -171,5 +169,8 @@ WORKDIR /devel
171169

172170
RUN chown -R scu:scu "${VIRTUAL_ENV}"
173171

172+
EXPOSE 8000
173+
EXPOSE 3000
174+
174175
ENTRYPOINT ["/bin/sh", "services/dynamic-scheduler/docker/entrypoint.sh"]
175176
CMD ["/bin/sh", "services/dynamic-scheduler/docker/boot.sh"]

services/notifications/Dockerfile

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
# Define arguments in the global scope
44
ARG PYTHON_VERSION="3.11.9"
55
ARG UV_VERSION="0.6"
6-
76
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv_build
87
# we docker image is built based on debian
98
FROM python:${PYTHON_VERSION}-slim-bookworm AS base
109

11-
1210
#
1311
# USAGE:
1412
# cd services/notifications
@@ -131,7 +129,6 @@ WORKDIR /home/scu
131129

132130
# ensure home folder is read/writable for user scu
133131
RUN chown -R scu /home/scu
134-
135132
# Starting from clean base image, copies pre-installed virtualenv from prod-only-deps
136133
COPY --chown=scu:scu --from=prod-only-deps ${VIRTUAL_ENV} ${VIRTUAL_ENV}
137134

@@ -140,17 +137,19 @@ COPY --chown=scu:scu services/notifications/docker services/notifications/docker
140137
RUN chmod +x services/notifications/docker/*.sh
141138

142139

143-
HEALTHCHECK --interval=30s \
144-
--timeout=20s \
145-
--start-period=30s \
146-
--retries=3 \
140+
# https://docs.docker.com/reference/dockerfile/#healthcheck
141+
HEALTHCHECK \
142+
--interval=10s \
143+
--timeout=5s \
144+
--start-period=20s \
145+
--start-interval=1s \
146+
--retries=5 \
147147
CMD ["python3", "services/notifications/docker/healthcheck.py", "http://localhost:8000/"]
148148

149-
EXPOSE 8000
150-
151149
ENTRYPOINT [ "/bin/sh", "services/notifications/docker/entrypoint.sh" ]
152150
CMD ["/bin/sh", "services/notifications/docker/boot.sh"]
153151

152+
EXPOSE 8000
154153

155154
# --------------------------Development stage -------------------
156155
# Source code accessible in host but runs in container

services/notifications/docker/boot.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ fi
3838
#
3939
# RUNNING application
4040
#
41+
4142
APP_LOG_LEVEL=${LOGLEVEL:-${LOG_LEVEL:-${LOGLEVEL:-INFO}}}
42-
NOTIFICATIONS_SERVER_REMOTE_DEBUG_PORT=3000
4343
SERVER_LOG_LEVEL=$(echo "${APP_LOG_LEVEL}" | tr '[:upper:]' '[:lower:]')
4444
echo "$INFO" "Log-level app/server: $APP_LOG_LEVEL/$SERVER_LOG_LEVEL"
4545

@@ -48,7 +48,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then
4848

4949
exec sh -c "
5050
cd services/notifications/src/simcore_service_notifications && \
51-
python -m debugpy --listen 0.0.0.0:${NOTIFICATIONS_SERVER_REMOTE_DEBUG_PORT} -m uvicorn main:the_app \
51+
python -m debugpy --listen 0.0.0.0:${NOTIFICATIONS_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \
5252
--host 0.0.0.0 \
5353
--port 8000 \
5454
--reload \

0 commit comments

Comments
 (0)