Loading .env.example 0 → 100644 +22 −0 Changes for .env.example: 22 added lines, 0 removed lines. Original line number Diff line number Diff line # Copy this file to .env and adjust as needed. Every value below is optional # -- open_exposure_gateway/app/core/config.py already has a working default # for each one, shown here. Uncomment and edit only what you need to change. # APP_NAME="Open Exposure Gateway" # APP_VERSION="1.0.0" # DEBUG=false # HOST="0.0.0.0" # PORT=8080 # SRM_SETTINGS__BASE_URL="http://localhost:8081" # SRM_SETTINGS__TIMEOUT=10.0 # POSTGRESQL_SETTINGS__URL="postgresql+asyncpg://postgres:postgres@localhost:5432/oeg" # POSTGRESQL_SETTINGS__ECHO=false # POSTGRESQL_SETTINGS__CREATE_SCHEMA_ON_STARTUP=false # NATS_SETTINGS__URL="nats://localhost:4222" # NATS_SETTINGS__CONNECT_TIMEOUT=10 # NATS_SETTINGS__MAX_RECONNECT_ATTEMPTS=3 # OBSERVABILITY_SETTINGS__LOG_LEVEL="INFO" .gitignore +5 −0 Changes for .gitignore: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -15,6 +15,10 @@ wheels/ # code editors .vscode/ # AI software tools .claude CLAUDE.md .tox/ htmlcov/ .mypy_cache/ Loading @@ -28,3 +32,4 @@ uv.lock # Runtime scratch files .tmp/ .gitlab-ci.yml +69 −11 Changes for .gitlab-ci.yml: 69 added lines, 11 removed lines. Original line number Diff line number Diff line default: tags: - docker image: python:3.12-slim cache: paths: - .cache/uv before_script: - cd "$CI_PROJECT_DIR/${BACKEND_DIR:-.}" - pip install uv - export UV_SYSTEM_CERTS=1 - uv sync --locked --extra dev - . .venv/bin/activate stages: - type - architecture - lint - format - test - build - push before_script: - docker info variables: UV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/uv" type: stage: type script: - mypy open_exposure_gateway/app/ open_exposure_gateway/test/ architecture: stage: architecture script: - lint-imports lint: stage: lint script: - ruff check open_exposure_gateway/ format: stage: format script: - ruff format --check open_exposure_gateway/ test: stage: test # TODO: add integration tests when we move this to ETSI gitlab # Scoped to test/unit explicitly (not just -m deselection): pytest must still # import every collected module to read its markers, and test/conformance's # module-level schemathesis schema loading is expensive — collecting it here # would cost minutes on every pipeline even though none of its tests run. script: - pytest open_exposure_gateway/test/unit || [ $? -eq 5 ] #bypass no tests found error. conformance: stage: test allow_failure: true script: - pytest open_exposure_gateway/test/conformance build: stage: build tags: - shell before_script: - docker info script: - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG -t $CI_REGISTRY_IMAGE:latest . - export TEST_IMAGE_TAG="ci-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" - docker build --network=host -t "$CI_REGISTRY_IMAGE:$TEST_IMAGE_TAG" . rules: - if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/ - if: '$CI_COMMIT_BRANCH' push: stage: push Loading @@ -22,10 +78,12 @@ push: - shell needs: - build before_script: - docker info script: - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" $CI_REGISTRY --password-stdin - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG - docker push $CI_REGISTRY_IMAGE:latest - docker logout $CI_REGISTRY - export TEST_IMAGE_TAG="ci-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin - docker push "$CI_REGISTRY_IMAGE:$TEST_IMAGE_TAG" - docker logout "$CI_REGISTRY" rules: - if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/ No newline at end of file - if: '$CI_COMMIT_BRANCH' No newline at end of file .pre-commit-config.yaml 0 → 100644 +28 −0 Changes for .pre-commit-config.yaml: 28 added lines, 0 removed lines. Original line number Diff line number Diff line repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: check-yaml - id: check-toml - id: end-of-file-fixer - id: trailing-whitespace args: [--markdown-linebreak-ext=md] - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. rev: v0.15.6 hooks: # Run the linter. - id: ruff-check args: ["--cache-dir", "open_exposure_gateway/.cache/ruff"] # Run the formatter. - id: ruff-format args: ["--cache-dir", "open_exposure_gateway/.cache/ruff"] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.19.1 # Use the sha / tag you want to point at hooks: - id: mypy files: ^open_exposure_gateway/app/|^open_exposure_gateway/test/ args: [--strict, --ignore-missing-imports, --cache-dir, open_exposure_gateway/.cache/mypy] additional_dependencies: ["fastapi[standard]>=0.135.1", "pydantic>=2.0", "pydantic-settings>=2.0", "httpx>=0.27", "pytest>=9.0.2", "sqlalchemy>=2.0.48", "pytest-asyncio>=0.24", "testcontainers>=4.0.0"] #TODO, always add necessary Dockerfile +51 −9 Changes for Dockerfile: 51 added lines, 9 removed lines. Original line number Diff line number Diff line FROM python:3.12-alpine FROM python:3.12-slim AS builder RUN mkdir -p /usr/src/app WORKDIR /usr/src/app WORKDIR /app COPY requirements.txt /usr/src/app/ # DB build arg: base | postgres | mongo ARG DB=base RUN pip install --no-cache-dir --trusted-host pypi.org --trusted-host files.pythonhosted.org -r requirements.txt ENV PIP_DEFAULT_TIMEOUT=120 COPY . /usr/src/app COPY pyproject.toml ./ COPY README.md ./ COPY open_exposure_gateway/ ./open_exposure_gateway/ EXPOSE 8080 RUN python -m venv .venv && \ .venv/bin/pip install \ --no-cache-dir \ --default-timeout=120 \ --trusted-host pypi.org \ --trusted-host files.pythonhosted.org \ --upgrade pip setuptools wheel && \ if [ "$DB" = "postgres" ]; then \ .venv/bin/pip install \ --no-cache-dir \ --default-timeout=120 \ --trusted-host pypi.org \ --trusted-host files.pythonhosted.org \ ".[postgres]"; \ elif [ "$DB" = "mongo" ]; then \ .venv/bin/pip install \ --no-cache-dir \ --default-timeout=120 \ --trusted-host pypi.org \ --trusted-host files.pythonhosted.org \ ".[mongo]"; \ else \ .venv/bin/pip install \ --no-cache-dir \ --default-timeout=120 \ --trusted-host pypi.org \ --trusted-host files.pythonhosted.org \ "."; \ fi FROM python:3.12-slim AS runtime WORKDIR /app ENTRYPOINT ["python"] COPY --from=builder /app/.venv /app/.venv COPY open_exposure_gateway/ ./open_exposure_gateway/ ENV PATH="/app/.venv/bin:$PATH" ENV PYTHONPATH="/app" ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 EXPOSE 8080 CMD ["-m", "edge_cloud_management_api"] CMD ["uvicorn", "open_exposure_gateway.app.main:app", "--host", "0.0.0.0", "--port", "8080"] No newline at end of file Loading
.env.example 0 → 100644 +22 −0 Changes for .env.example: 22 added lines, 0 removed lines. Original line number Diff line number Diff line # Copy this file to .env and adjust as needed. Every value below is optional # -- open_exposure_gateway/app/core/config.py already has a working default # for each one, shown here. Uncomment and edit only what you need to change. # APP_NAME="Open Exposure Gateway" # APP_VERSION="1.0.0" # DEBUG=false # HOST="0.0.0.0" # PORT=8080 # SRM_SETTINGS__BASE_URL="http://localhost:8081" # SRM_SETTINGS__TIMEOUT=10.0 # POSTGRESQL_SETTINGS__URL="postgresql+asyncpg://postgres:postgres@localhost:5432/oeg" # POSTGRESQL_SETTINGS__ECHO=false # POSTGRESQL_SETTINGS__CREATE_SCHEMA_ON_STARTUP=false # NATS_SETTINGS__URL="nats://localhost:4222" # NATS_SETTINGS__CONNECT_TIMEOUT=10 # NATS_SETTINGS__MAX_RECONNECT_ATTEMPTS=3 # OBSERVABILITY_SETTINGS__LOG_LEVEL="INFO"
.gitignore +5 −0 Changes for .gitignore: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -15,6 +15,10 @@ wheels/ # code editors .vscode/ # AI software tools .claude CLAUDE.md .tox/ htmlcov/ .mypy_cache/ Loading @@ -28,3 +32,4 @@ uv.lock # Runtime scratch files .tmp/
.gitlab-ci.yml +69 −11 Changes for .gitlab-ci.yml: 69 added lines, 11 removed lines. Original line number Diff line number Diff line default: tags: - docker image: python:3.12-slim cache: paths: - .cache/uv before_script: - cd "$CI_PROJECT_DIR/${BACKEND_DIR:-.}" - pip install uv - export UV_SYSTEM_CERTS=1 - uv sync --locked --extra dev - . .venv/bin/activate stages: - type - architecture - lint - format - test - build - push before_script: - docker info variables: UV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/uv" type: stage: type script: - mypy open_exposure_gateway/app/ open_exposure_gateway/test/ architecture: stage: architecture script: - lint-imports lint: stage: lint script: - ruff check open_exposure_gateway/ format: stage: format script: - ruff format --check open_exposure_gateway/ test: stage: test # TODO: add integration tests when we move this to ETSI gitlab # Scoped to test/unit explicitly (not just -m deselection): pytest must still # import every collected module to read its markers, and test/conformance's # module-level schemathesis schema loading is expensive — collecting it here # would cost minutes on every pipeline even though none of its tests run. script: - pytest open_exposure_gateway/test/unit || [ $? -eq 5 ] #bypass no tests found error. conformance: stage: test allow_failure: true script: - pytest open_exposure_gateway/test/conformance build: stage: build tags: - shell before_script: - docker info script: - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG -t $CI_REGISTRY_IMAGE:latest . - export TEST_IMAGE_TAG="ci-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" - docker build --network=host -t "$CI_REGISTRY_IMAGE:$TEST_IMAGE_TAG" . rules: - if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/ - if: '$CI_COMMIT_BRANCH' push: stage: push Loading @@ -22,10 +78,12 @@ push: - shell needs: - build before_script: - docker info script: - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" $CI_REGISTRY --password-stdin - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG - docker push $CI_REGISTRY_IMAGE:latest - docker logout $CI_REGISTRY - export TEST_IMAGE_TAG="ci-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin - docker push "$CI_REGISTRY_IMAGE:$TEST_IMAGE_TAG" - docker logout "$CI_REGISTRY" rules: - if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/ No newline at end of file - if: '$CI_COMMIT_BRANCH' No newline at end of file
.pre-commit-config.yaml 0 → 100644 +28 −0 Changes for .pre-commit-config.yaml: 28 added lines, 0 removed lines. Original line number Diff line number Diff line repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: check-yaml - id: check-toml - id: end-of-file-fixer - id: trailing-whitespace args: [--markdown-linebreak-ext=md] - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. rev: v0.15.6 hooks: # Run the linter. - id: ruff-check args: ["--cache-dir", "open_exposure_gateway/.cache/ruff"] # Run the formatter. - id: ruff-format args: ["--cache-dir", "open_exposure_gateway/.cache/ruff"] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.19.1 # Use the sha / tag you want to point at hooks: - id: mypy files: ^open_exposure_gateway/app/|^open_exposure_gateway/test/ args: [--strict, --ignore-missing-imports, --cache-dir, open_exposure_gateway/.cache/mypy] additional_dependencies: ["fastapi[standard]>=0.135.1", "pydantic>=2.0", "pydantic-settings>=2.0", "httpx>=0.27", "pytest>=9.0.2", "sqlalchemy>=2.0.48", "pytest-asyncio>=0.24", "testcontainers>=4.0.0"] #TODO, always add necessary
Dockerfile +51 −9 Changes for Dockerfile: 51 added lines, 9 removed lines. Original line number Diff line number Diff line FROM python:3.12-alpine FROM python:3.12-slim AS builder RUN mkdir -p /usr/src/app WORKDIR /usr/src/app WORKDIR /app COPY requirements.txt /usr/src/app/ # DB build arg: base | postgres | mongo ARG DB=base RUN pip install --no-cache-dir --trusted-host pypi.org --trusted-host files.pythonhosted.org -r requirements.txt ENV PIP_DEFAULT_TIMEOUT=120 COPY . /usr/src/app COPY pyproject.toml ./ COPY README.md ./ COPY open_exposure_gateway/ ./open_exposure_gateway/ EXPOSE 8080 RUN python -m venv .venv && \ .venv/bin/pip install \ --no-cache-dir \ --default-timeout=120 \ --trusted-host pypi.org \ --trusted-host files.pythonhosted.org \ --upgrade pip setuptools wheel && \ if [ "$DB" = "postgres" ]; then \ .venv/bin/pip install \ --no-cache-dir \ --default-timeout=120 \ --trusted-host pypi.org \ --trusted-host files.pythonhosted.org \ ".[postgres]"; \ elif [ "$DB" = "mongo" ]; then \ .venv/bin/pip install \ --no-cache-dir \ --default-timeout=120 \ --trusted-host pypi.org \ --trusted-host files.pythonhosted.org \ ".[mongo]"; \ else \ .venv/bin/pip install \ --no-cache-dir \ --default-timeout=120 \ --trusted-host pypi.org \ --trusted-host files.pythonhosted.org \ "."; \ fi FROM python:3.12-slim AS runtime WORKDIR /app ENTRYPOINT ["python"] COPY --from=builder /app/.venv /app/.venv COPY open_exposure_gateway/ ./open_exposure_gateway/ ENV PATH="/app/.venv/bin:$PATH" ENV PYTHONPATH="/app" ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 EXPOSE 8080 CMD ["-m", "edge_cloud_management_api"] CMD ["uvicorn", "open_exposure_gateway.app.main:app", "--host", "0.0.0.0", "--port", "8080"] No newline at end of file