Docker Infrastructure & Compose
Relevant source files
The following files were used as context for generating this wiki page:
The FLEXT Docker Infrastructure is a centralized system designed to manage containerized environments across the entire ecosystem. It enforces a "zero duplication" policy, ensuring all Docker-related artifacts—including Compose files and Dockerfiles—reside in a single docker/ directory. This infrastructure supports various workloads, including infrastructure services, integration testing, and specialized enterprise data environments like Oracle WMS and Meltano.
Sources: docker/README.md:1-20, docker/README.md:195-200, scripts/cmd/check/docker_standardization.py:10-15
Centralized Architecture
The project follows a strict standardization pattern where all Docker configurations are managed centrally to provide consistency across different packages (flext-core, flext-auth, etc.).
Component Organization
The infrastructure is organized into two primary sub-directories:
docker/: Contains 17 centralized Docker Compose files following thedocker-compose.{project}-{purpose}.ymlnaming convention.docker/images/: Houses 21 consolidated Dockerfiles for various service types (API, gRPC, Auth, Quality, etc.).
Sources: docker/README.md:40-45, docker/README.md:180-190, scripts/cmd/check/docker_standardization.py:87-105
Service Categories
The infrastructure classifies containers into three primary types to ensure proper port management and service isolation:
| Container Type | Primary Port | Compose File | Purpose |
|---|---|---|---|
| Oracle Database | 1522 | docker-compose.db-oracle.yml | Standard database for Oracle-specific packages. |
| FLEXT OUD | 3389 | docker-compose.flext-oud.yml | Simulated Oracle Unified Directory for migration. |
| Generic OpenLDAP | 3390 | docker-compose.openldap.yml | Generic LDAP/LDIF testing. |
Sources: docker/README.md:95-120
Lifecycle Management with tk
Lifecycle management is handled through a specialized internal tool/fixture named tk. It automates the starting, stopping, and cleanup of containers to ensure test isolation.
The diagram above illustrates the automated lifecycle and "dirty state" management provided by the tk manager.
Dirty State Management
If a container state becomes compromised during a test (e.g., a failed data migration), tk marks the container as "dirty." This state is tracked in ~/.flext/docker_state.json. On the subsequent run, dirty containers are automatically removed along with their volumes and recreated from scratch.
Sources: docker/README.md:155-175, scripts/cmd/check/docker_standardization.py:110-120
Infrastructure Services
Authentication and Identity
The identity stack is defined in docker-compose.flext-auth.yml, which orchestrates a PostgreSQL database for persistence, Redis for sessions/caching, and the Auth API.
Flow showing the internal dependencies of the authentication infrastructure.
Database Initialization
Enterprise services, particularly Oracle-based ones, require specific initialization. The infrastructure provides docker/oracle-db/init.sql to set up pluggable databases (FLEXTDB) and test schemas (e.g., employees, departments) upon container startup.
Sources: docker/oracle-db/init.sql:1-40
Integration and Testing Services
Oracle WMS Testing
The docker-compose.oracle-wms.yml configuration supports real Oracle WMS connectivity validation. It includes three specific service definitions:
- flext-oracle-wms: The main service with rate limiting and logging enabled.
- flext-oracle-wms-test: A continuous validation service running the full
pytestsuite. - flext-oracle-wms-examples: A demonstration service for running basic usage scripts.
Sources: docker/docker-compose.oracle-wms.yml:10-100
Meltano & Data Integration
For data integration testing, docker-compose.meltano-test.yml sets up a multi-database environment involving PostgreSQL, Redis, and Oracle XE. This environment supports "Docker-in-Docker" (via /var/run/docker.sock) to allow Meltano to manage its own internal containerized taps and targets.
| Service | Image | Ports | Role |
|---|---|---|---|
postgres-test | postgres:17 | 5433:5432 | Source/Target DB |
redis-test | redis:7-alpine | 6380:6379 | Caching |
oracle-test | gvenzl/oracle-xe:21-slim | 1522:1521 | Enterprise Source |
Sources: docker/docker-compose.meltano-test.yml:1-85
Quality and Standardization Enforcement
The project includes automated validation scripts to prevent the proliferation of ad-hoc Docker files. The docker_standardization.py script performs several checks:
- Centralization Check: Verifies no
docker-compose.ymlorDockerfileexists outside thedocker/directory. - Fixture Check: Ensures no local
docker_fixtures.pyfiles exist in project sub-directories. - Resource Count: Validates that at least 15 compose files and 20 Dockerfiles are present in the central repository.
- Import Check: Confirms that the
tkmanagement API and centralized fixtures (e.g.,oracle_container,postgres_container) are correctly importable fromflext_tests.
Sources: scripts/cmd/check/docker_standardization.py:40-150, tests/unit/docker_quality_mock_tests.py:10-30
Summary
The FLEXT Docker Infrastructure provides a robust, centralized foundation for the entire ecosystem. By strictly enforcing standardization and using the tk manager for lifecycle orchestration, the project ensures that testing environments for complex enterprise systems—such as Oracle WMS and OUD—are reproducible, isolated, and automatically maintained.