# ezv-eets/eets-test-container architecture

> Architecture diagram of the GitHub repository ezv-eets/eets-test-container, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ezv-eets/eets-test-container
- Repository: https://github.com/ezv-eets/eets-test-container

## Overview

##### Project Type and Purpose
- This is a container-based testing environment (“EETS-Test-Container (CH)”) for the Swiss FCA’s EETS system.
- It provides a ready-to-use Docker Compose setup that spins up:
- An NGINX reverse-proxy (mTLS termination)
- One or more FCA-supplied EETS service containers (pulled from ghcr.io)
- A Test-Support Service (REST API for managing test cases)
- A PostgreSQL database backing the services
- It also bundles certificate assets, ASN.1 message definitions, example ADUs, and integration-test scripts.

##### File Structure Analysis
- Top-level orchestration:
- docker-compose.yml – defines all service containers, networks, volumes, published ports.
- nginx.conf – reverse-proxy configuration for ports 80/443.
- provider.properties – user-supplied config for provider identity and mTLS CN.
- cert/ – volume of TLS and signing certificates (client CA, fullchain.pem, privkey.pem, provider signing certs, FCA signing cert).
- asn/ – ASN.1 definitions for EFC messages (static assets mounted into containers).
- docs/ – OpenAPI spec for the Test-Support Service and example ADU XMLs.
- .github/workflows/docker-compose-startup.yml – CI that spins up the Docker Compose stack.
- .integration-test/docker-compose.test.yml + run-tc-integration-test.sh – separate compose setup for automated end-to-end tests.

- Host Environment: Docker Engine & Docker-Compose
- Container: NGINX Reverse Proxy
- Container: EETS Interface Service(s) (mTLS + message signature)
- Container: Test-Support Service (REST API, port 8096)
- Container: PostgreSQL Database (port 5432)
- Configuration Volume: cert/, provider.properties, asn/ definitions
- External Registry: ghcr.io (source of FCA service images)
- Client/System Under Test (the provider’s system connecting via mTLS)
- Integration-Test Runner (optional, separate compose)

1. Provider System →(mTLS over 443)→ NGINX →(proxy→) EETS Interface Service
2. Test-Support Client/Tool ↔(HTTP REST over 8096)↔ Test-Support Service
3. Both EETS Service & Test-Support Service →(JDBC)→ PostgreSQL
4. Docker-Compose pulls images from ghcr.io; mounts cert/, provider.properties, asn/, docs into the containers
5. Integration-Test Runner triggers Test-Support API and/or direct calls to EETS Interface

c. Architectural Patterns & Principles
- Containerized micro‐services with clear separation of concerns
- Reverse-proxy for TLS termination and routing (NGINX)
- Externalized configuration via volumes (certificates, properties)
- Persistent data store in a dedicated DB container
- CI/CD integration via GitHub Actions and separate integration-test composition

d. Key Technologies & Libraries
- Docker & Docker-Compose
- NGINX
- PostgreSQL
- mTLS for authentication
- ASN.1 message definitions (ISO12855, ISO14906, etc.)
- OpenAPI (docs/openapi.yml) for the Test-Support Service
- Shell scripts for orchestration (clean-start-container.sh, run-tc-integration-test.sh)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Systems
    Provider["Provider System"]:::external
    IntegrationTester["Integration-Test Runner"]:::external
    Registry["ghcr.io Registry"]:::external

    %% CI/CD Pipeline
    CI["GitHub Actions CI"]:::ci

    %% Volumes & Configs
    CertVol[/"cert/ Volume"/]:::volume
    Props["provider.properties"]:::volume
    AsnVol[/"asn/ Volume"/]:::volume
    OpenAPI["docs/openapi.yml"]:::volume
    ExampleADUs[/"docs/example/adu/"/]:::volume

    %% Host Environment
    subgraph "Docker Host Environment"
        direction TB
        DockerEngine["Docker Engine"]:::infra
        DockerCompose["Docker-Compose"]:::infra
    end

    %% Container Network
    subgraph "Docker Network" 
        direction TB
        NGINX["NGINX-Proxy (80/443)"]:::container
        EETS["EETS Interface Service"]:::container
        TestSupport["Test-Support Service (8096)"]:::container
        Postgres["PostgreSQL DB (5432)"]:::container
    end

    %% Relationships
    Provider -->|"mTLS over 443"| NGINX
    NGINX -->|"proxy to EETS"| EETS
    TestSupport <-->|"REST API 8096"| IntegrationTester
    EETS -->|"JDBC"| Postgres
    TestSupport -->|"JDBC"| Postgres
    DockerCompose -->|"pull images"| Registry
    DockerCompose -->|"mounts cert/, provider.properties, asn/"| NGINX
    DockerCompose -->|"mounts cert/, provider.properties, asn/"| EETS
    DockerCompose -->|"mounts cert/, provider.properties, asn/"| TestSupport
    CI -->|"runs docker-compose up"| DockerCompose
    IntegrationTester -->|"uses compose setup"| TestSupport

    %% Volume Mounts to Host
    CertVol --- DockerCompose
    Props --- DockerCompose
    AsnVol --- DockerCompose
    OpenAPI --- TestSupport
    ExampleADUs --- TestSupport

    %% Integration Test Compose
    ITCompose["Integration-Test Compose"]:::infra
    CI -->|"runs integration tests with"| ITCompose
    ITCompose --> IntegrationTester

    %% Click Events
    click DockerCompose "https://github.com/ezv-eets/eets-test-container/blob/master/docker-compose.yml"
    click NGINX "https://github.com/ezv-eets/eets-test-container/blob/master/nginx.conf"
    click Props "https://github.com/ezv-eets/eets-test-container/blob/master/provider.properties"
    click CertVol "https://github.com/ezv-eets/eets-test-container/tree/master/cert/"
    click AsnVol "https://github.com/ezv-eets/eets-test-container/tree/master/asn/"
    click OpenAPI "https://github.com/ezv-eets/eets-test-container/blob/master/docs/openapi.yml"
    click ExampleADUs "https://github.com/ezv-eets/eets-test-container/tree/master/docs/example/adu/"
    click CI "https://github.com/ezv-eets/eets-test-container/blob/master/.github/workflows/docker-compose-startup.yml"
    click ITCompose "https://github.com/ezv-eets/eets-test-container/blob/master/.integration-test/docker-compose.test.yml"
    click IntegrationTester "https://github.com/ezv-eets/eets-test-container/blob/master/run-tc-integration-test.sh"
    click DockerEngine "https://github.com/ezv-eets/eets-test-container/blob/master/clean-start-container.sh"

    %% Styles
    classDef container fill:#cce5ff,stroke:#004085,color:#004085
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#383d41
    classDef volume fill:#d4edda,stroke:#155724,color:#155724
    classDef infra fill:#f8d7da,stroke:#721c24,color:#721c24
    classDef ci fill:#fff3cd,stroke:#856404,color:#856404
```
