How houssemkhoildi/docker-django works
Project Type and Purpose
• This is a Dockerized Django web application (“pfe_routier”) managed via Docker Compose, backed by a PostgreSQL database, and integrated with Jenkins for CI/CD.
File-Structure Analysis
• Top-level files:
• Dockerfile – builds the Django application image
• docker-compose.yml – orchestrates services (web + db)
• Jenkinsfile + jenkins.sh – defines CI/CD pipeline
• manage.py, requirements.txt – standard Django entrypoints
• db.sqlite3 – local/dev fallback DB (likely unused in Compose)
• commandes.txt – project‐specific commands or scripts
• Django project directory (pfe_routier/):
• settings.py, urls.py, wsgi.py, asgi.py – Django configuration and entrypoints
• postgresql/ directory:
• Full PG data directory (volumed into the container) and configuration files (pg_hba.conf, postgresql.conf, pg_ident.conf)
README Insights
• Title “docker-django” confirms the primary goal: run Django inside Docker.
• No additional sections, so architecture isn’t documented here.
a. Main Components
• Developer (Git) → Jenkins (CI/CD)
• Docker Registry (optional)
• Docker Compose Stack:
– Django Web Service (Gunicorn or runserver)
– PostgreSQL Database Service
• Host machine (ports & volumes)
b. Relationships & Data Flow
• Developer pushes code to Git → triggers Jenkins pipeline → builds Docker image → (optionally) pushes to Registry → deploys/updates Docker Compose on target host.
• Docker Compose creates an internal network:
– Django container connects to db container on port 5432
– Exposes Django port (e.g. 8000 or 80) to the host
– Mounts postgresql/ directory as a persistent volume for PG data
c. Architectural Patterns & Principles
• Separation of concerns:
– CI/CD layer (Jenkins) vs. runtime layer (Docker Compose) vs. data layer (PostgreSQL)
• Infrastructure as code: Dockerfile + docker-compose.yml + Jenkinsfile
• Immutable container images for repeatability
d. Key Technologies
• Python/Django framework
• Gunicorn or Django dev server inside Docker
• PostgreSQL as a service container (configurable via pg_*.conf)
• Jenkins for automated build/test/deploy
• Docker Compose for service orchestration