Skip to content

Commit

Permalink
Merge branch 'master' into feature/listen-to-ports
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Oct 15, 2024
2 parents a26c99b + 2e1f0ec commit 3a3a12a
Show file tree
Hide file tree
Showing 51 changed files with 406 additions and 335 deletions.
26 changes: 15 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -685,9 +685,9 @@ info-registry: ## info on local registry (if any)

## INFO -------------------------------

.PHONY: info info-images info-swarm info-tools
.PHONY: info info-images info-swarm
info: ## displays setup information
# setup info:
@echo setup info --------------------------------
@echo ' Detected OS : $(IS_LINUX)$(IS_OSX)$(IS_WSL)$(IS_WSL2)$(IS_WIN)'
@echo ' SWARM_STACK_NAME : ${SWARM_STACK_NAME}'
@echo ' DOCKER_REGISTRY : $(DOCKER_REGISTRY)'
Expand All @@ -697,19 +697,23 @@ info: ## displays setup information
@echo ' - ULR : ${VCS_URL}'
@echo ' - REF : ${VCS_REF}'
@echo ' - (STATUS)REF_CLIENT : (${VCS_STATUS_CLIENT}) ${VCS_REF_CLIENT}'
@echo ' DIRECTOR_API_VERSION : ${DIRECTOR_API_VERSION}'
@echo ' STORAGE_API_VERSION : ${STORAGE_API_VERSION}'
@echo ' DATCORE_ADAPTER_API_VERSION : ${DATCORE_ADAPTER_API_VERSION}'
@echo ' WEBSERVER_API_VERSION : ${WEBSERVER_API_VERSION}'
# dev tools version
@echo ' make : $(shell make --version 2>&1 | head -n 1)'
@echo ' jq : $(shell jq --version)'
@make --silent info-tools


.PHONY: show-tools
info-tools: ## displays tools versions
@echo dev-tools versions -------------------------
@echo ' awk : $(shell awk -W version 2>&1 | head -n 1)'
@echo ' python : $(shell python3 --version)'
@echo ' node : $(shell node --version 2> /dev/null || echo ERROR nodejs missing)'
@echo ' docker : $(shell docker --version)'
@echo ' docker buildx : $(shell docker buildx version)'
@echo ' docker compose: $(shell docker compose version)'
@echo ' jq : $(shell jq --version)'
@echo ' make : $(shell make --version 2>&1 | head -n 1)'
@echo ' node : $(shell node --version 2> /dev/null || echo ERROR nodejs missing)'
@echo ' python : $(shell python3 --version)'
@echo ' uv : $(shell uv --version 2> /dev/null || echo ERROR uv missing)'
@echo ' ubuntu : $(shell lsb_release --description --short 2> /dev/null | tail || echo ERROR Not an Ubuntu OS )'



define show-meta
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-library/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ pyyaml==6.0.2
# -c requirements/../../../packages/settings-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../requirements/constraints.txt
# -r requirements/../../../packages/service-library/requirements/_base.in
redis==5.0.8
redis==5.0.4
# via
# -c requirements/../../../packages/models-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../packages/service-library/requirements/../../../packages/models-library/requirements/../../../requirements/constraints.txt
Expand Down
6 changes: 3 additions & 3 deletions packages/postgres-database/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM python:3.6-slim as base
FROM python:3.6-slim AS base

LABEL maintainer=sanderegg

Expand All @@ -13,7 +13,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
ENV PATH="${VIRTUAL_ENV}/bin:$PATH"


FROM base as build
FROM base AS build

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand Down Expand Up @@ -41,7 +41,7 @@ ARG GIT_REPOSITORY
RUN git clone --single-branch --branch ${GIT_BRANCH} ${GIT_REPOSITORY} osparc-simcore\
&& uv pip install osparc-simcore/packages/postgres-database[migration]

FROM base as production
FROM base AS production

ENV PYTHONOPTIMIZE=TRUE

Expand Down
2 changes: 1 addition & 1 deletion packages/postgres-database/scripts/erd/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
ARG PYTHON_VERSION="3.11.9"
FROM python:${PYTHON_VERSION}-slim-bookworm as base
FROM python:${PYTHON_VERSION}-slim-bookworm AS base

RUN apt-get update \
&& apt-get -y install --no-install-recommends\
Expand Down
8 changes: 4 additions & 4 deletions packages/service-integration/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
ARG PYTHON_VERSION="3.11.9"
FROM python:${PYTHON_VERSION}-slim-bookworm as base
FROM python:${PYTHON_VERSION}-slim-bookworm AS base

LABEL maintainer=pcrespov

Expand Down Expand Up @@ -46,7 +46,7 @@ ENV PATH="${VIRTUAL_ENV}/bin:$PATH"

# -------------------------- Build stage -------------------

FROM base as build
FROM base AS build

RUN --mount=type=cache,target=/var/cache/apt,mode=0755,sharing=private \
--mount=type=cache,target=/var/lib/apt,mode=0755,sharing=private \
Expand Down Expand Up @@ -82,9 +82,9 @@ RUN \

# -------------------------- Build stage -------------------

FROM base as development
FROM base AS development
# NOTE: this is necessary to allow to build development images but is the same as production here
FROM base as production
FROM base AS production

ENV PYTHONOPTIMIZE=TRUE

Expand Down
2 changes: 1 addition & 1 deletion packages/service-library/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ pyyaml==6.0.2
# -c requirements/../../../packages/settings-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../requirements/constraints.txt
# -r requirements/_base.in
redis==5.0.8
redis==5.0.4
# via
# -c requirements/../../../packages/models-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../packages/settings-library/requirements/../../../requirements/constraints.txt
Expand Down
24 changes: 20 additions & 4 deletions packages/service-library/src/servicelib/aiohttp/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from opentelemetry.instrumentation.aiohttp_client import ( # pylint:disable=no-name-in-module
AioHttpClientInstrumentor,
)
from opentelemetry.instrumentation.aiohttp_server import ( # pylint:disable=no-name-in-module
AioHttpServerInstrumentor,
from opentelemetry.instrumentation.aiohttp_server import (
middleware as aiohttp_server_opentelemetry_middleware, # pylint:disable=no-name-in-module
)
from opentelemetry.instrumentation.aiopg import ( # pylint:disable=no-name-in-module
AiopgInstrumentor,
Expand Down Expand Up @@ -72,8 +72,24 @@ def setup_tracing(

# Add the span processor to the tracer provider
tracer_provider.add_span_processor(BatchSpanProcessor(otlp_exporter)) # type: ignore[attr-defined] # https://github.com/open-telemetry/opentelemetry-python/issues/3713
# Instrument aiohttp server and client
AioHttpServerInstrumentor().instrument()
# Instrument aiohttp server
# Explanation for custom middleware call DK 10/2024:
# OpenTelemetry Aiohttp autoinstrumentation is meant to be used by only calling `AioHttpServerInstrumentor().instrument()`
# The call `AioHttpServerInstrumentor().instrument()` monkeypatches the __init__() of aiohttp's web.application() to inject the tracing middleware, in it's `__init__()`.
# In simcore, we want to switch tracing on or off using the simcore-settings-library.
# The simcore-settings library in turn depends on the instance of web.application(), i.e. the aiohttp webserver, to exist. So here we face a hen-and-egg problem.
# At the time when the instrumentation should be configured, the instance of web.application already exists and the overwrite to the __init__() is never called
#
# Since the code that is provided (monkeypatched) in the __init__ that the opentelemetry-autoinstrumentation-library provides is only 4 lines,
# just adding a middleware, we are free to simply execute this "missed call" [since we can't call the monkeypatch'ed __init__()] in this following line:
app.middlewares.insert(0, aiohttp_server_opentelemetry_middleware)
# Code of the aiohttp server instrumentation: github.com/open-telemetry/opentelemetry-python-contrib/blob/eccb05c808a7d797ef5b6ecefed3590664426fbf/instrumentation/opentelemetry-instrumentation-aiohttp-server/src/opentelemetry/instrumentation/aiohttp_server/__init__.py#L246
# For reference, the above statement was written for:
# - osparc-simcore 1.77.x
# - opentelemetry-api==1.27.0
# - opentelemetry-instrumentation==0.48b0

# Instrument aiohttp client
AioHttpClientInstrumentor().instrument()
if instrument_aiopg:
AiopgInstrumentor().instrument()
Expand Down
2 changes: 1 addition & 1 deletion packages/simcore-sdk/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ pyyaml==6.0.2
# -c requirements/../../../packages/settings-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../requirements/constraints.txt
# -r requirements/../../../packages/service-library/requirements/_base.in
redis==5.0.8
redis==5.0.4
# via
# -c requirements/../../../packages/models-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../packages/postgres-database/requirements/../../../requirements/constraints.txt
Expand Down
2 changes: 1 addition & 1 deletion requirements/tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
#
ARG PYTHON_VERSION="3.11.9"
FROM python:${PYTHON_VERSION}-slim-bookworm as base
FROM python:${PYTHON_VERSION}-slim-bookworm AS base

ENV VIRTUAL_ENV=/home/scu/.venv

Expand Down
2 changes: 1 addition & 1 deletion scripts/apt-packages-versions/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
ARG PYTHON_VERSION="3.11.9"
FROM python:${PYTHON_VERSION}-slim-bookworm as base
FROM python:${PYTHON_VERSION}-slim-bookworm AS base

RUN \
apt-get update && \
Expand Down
8 changes: 2 additions & 6 deletions scripts/common.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ clean: ## cleans all unversioned files in project and temp files create by this
@git clean $(_GIT_CLEAN_ARGS)




.PHONY: info
inf%: ## displays basic info
# system
Expand All @@ -106,12 +108,6 @@ inf%: ## displays basic info
@echo ' NOW_TIMESTAMP : ${NOW_TIMESTAMP}'
@echo ' VCS_URL : ${VCS_URL}'
@echo ' VCS_REF : ${VCS_REF}'
# dev tools version
@echo ' make : $(shell make --version 2>&1 | head -n 1)'
@echo ' jq : $(shell jq --version)'
@echo ' awk : $(shell awk -W version 2>&1 | head -n 1)'
@echo ' node : $(shell node --version 2> /dev/null || echo ERROR nodejs missing)'
@echo ' python : $(shell python3 --version)'
# installed in .venv
@uv pip list
# package setup
Expand Down
2 changes: 1 addition & 1 deletion scripts/erd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#

ARG PYTHON_VERSION="3.11.9"
FROM python:${PYTHON_VERSION}-slim-bookworm as base
FROM python:${PYTHON_VERSION}-slim-bookworm AS base

RUN apt-get update \
&& apt-get -y install --no-install-recommends\
Expand Down
2 changes: 1 addition & 1 deletion scripts/pydeps-docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
#
ARG PYTHON_VERSION="3.11.9"
FROM python:${PYTHON_VERSION}-slim-bookworm as base
FROM python:${PYTHON_VERSION}-slim-bookworm AS base


RUN apt-get update \
Expand Down
10 changes: 5 additions & 5 deletions services/agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
ARG PYTHON_VERSION="3.11.9"
FROM python:${PYTHON_VERSION}-slim-bookworm as base
FROM python:${PYTHON_VERSION}-slim-bookworm AS base

#
# USAGE:
Expand Down Expand Up @@ -62,7 +62,7 @@ RUN \
#
# + /build WORKDIR
#
FROM base as build
FROM base AS build

ENV SC_BUILD_TARGET=build

Expand Down Expand Up @@ -104,7 +104,7 @@ RUN \
# + /build
# + services/agent [scu:scu] WORKDIR
#
FROM build as prod-only-deps
FROM build AS prod-only-deps

ENV SC_BUILD_TARGET prod-only-deps

Expand All @@ -126,7 +126,7 @@ RUN \
# + /home/scu $HOME = WORKDIR
# + services/agent [scu:scu]
#
FROM base as production
FROM base AS production

ENV SC_BUILD_TARGET=production \
SC_BOOT_MODE=production
Expand Down Expand Up @@ -166,7 +166,7 @@ CMD ["/bin/sh", "services/agent/docker/boot.sh"]
# + /devel WORKDIR
# + services (mounted volume)
#
FROM build as development
FROM build AS development

ENV SC_BUILD_TARGET=development \
SC_DEVEL_MOUNT=/devel/services/agent
Expand Down
2 changes: 1 addition & 1 deletion services/agent/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ pyyaml==6.0.2
# -c requirements/../../../packages/settings-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../requirements/constraints.txt
# -r requirements/../../../packages/service-library/requirements/_base.in
redis==5.0.8
redis==5.0.4
# via
# -c requirements/../../../packages/models-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../packages/service-library/requirements/../../../packages/models-library/requirements/../../../requirements/constraints.txt
Expand Down
10 changes: 5 additions & 5 deletions services/api-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
ARG PYTHON_VERSION="3.11.9"
FROM python:${PYTHON_VERSION}-slim-bookworm as base
FROM python:${PYTHON_VERSION}-slim-bookworm AS base
#
# USAGE:
# cd sercices/api-server
Expand Down Expand Up @@ -58,7 +58,7 @@ EXPOSE 3000
#
# + /build WORKDIR
#
FROM base as build
FROM base AS build

ENV SC_BUILD_TARGET=build

Expand Down Expand Up @@ -100,7 +100,7 @@ RUN \
# + /build
# + services/api-server [scu:scu] WORKDIR
#
FROM build as prod-only-deps
FROM build AS prod-only-deps

ENV SC_BUILD_TARGET prod-only-deps

Expand All @@ -123,7 +123,7 @@ RUN \
# + /home/scu $HOME = WORKDIR
# + services/api-server [scu:scu]
#
FROM base as production
FROM base AS production

ENV SC_BUILD_TARGET=production \
SC_BOOT_MODE=production
Expand Down Expand Up @@ -160,7 +160,7 @@ CMD ["/bin/sh", "services/api-server/docker/boot.sh"]
# + /devel WORKDIR
# + services (mounted volume)
#
FROM build as development
FROM build AS development

ENV SC_BUILD_TARGET=development

Expand Down
10 changes: 9 additions & 1 deletion services/api-server/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ anyio==4.3.0
# httpx
# starlette
# watchfiles
appdirs==1.4.4
# via pint
arrow==1.3.0
# via
# -r requirements/../../../packages/models-library/requirements/_base.in
Expand Down Expand Up @@ -164,6 +166,10 @@ faststream==0.5.10
# via
# -r requirements/../../../packages/service-library/requirements/_base.in
# -r requirements/../../../packages/simcore-sdk/requirements/../../../packages/service-library/requirements/_base.in
flexcache==0.3
# via pint
flexparser==0.3.1
# via pint
frozenlist==1.4.1
# via
# aiohttp
Expand Down Expand Up @@ -356,7 +362,7 @@ pamqp==3.3.0
# via aiormq
parse==1.20.2
# via -r requirements/_base.in
pint==0.23
pint==0.24.3
# via -r requirements/../../../packages/simcore-sdk/requirements/_base.in
prometheus-client==0.20.0
# via
Expand Down Expand Up @@ -564,6 +570,8 @@ typing-extensions==4.10.0
# fastapi
# fastapi-pagination
# faststream
# flexcache
# flexparser
# opentelemetry-sdk
# pint
# pydantic
Expand Down
Loading

0 comments on commit 3a3a12a

Please sign in to comment.