HUB
Sign inSign up

dartfx/worldbank-metadata-editor

By dartfx

•Updated 22 days ago

Image
0

318

dartfx/worldbank-metadata-editor repository overview

⁠dartfx/worldbank-metadata-editor

Docker Image Docker Pulls License: MIT

Production-ready, multi-architecture (linux/amd64 and linux/arm64) Docker distribution for the World Bank Metadata Editor⁠ and its companion FastAPI Data Processing Service⁠, published by Data Artifex for the NADA (National Data Archive) ecosystem.


⁠Published Docker Images

ImageDescriptionBase Platform
dartfx/worldbank-metadata-editor⁠Web Application UI, REST API, and async background queue workerPHP 8.2-FPM + Nginx + Supervisor (Debian Bookworm)
dartfx/worldbank-metadata-editor-fastapi⁠Microdata conversion, summary statistics, and DuckDB timeseries servicePython 3.12-slim (Pyreadstat, Pandas, DuckDB, R haven)

⁠Key Features

  • Multi-Architecture: Native builds for both linux/amd64 (Intel/AMD) and linux/arm64 (Apple Silicon M-series, AWS Graviton).
  • Zero-Touch Database Bootstrap & Auto-Migrations:
    • Automatically imports initial schema (install/schema.mysql.sql) and sets up the administrator account and REST API key on first launch.
    • Automatically checks and applies CodeIgniter database migrations (cli/migrate latest) on every startup (AUTO_MIGRATE=true).
  • Full REST API & OpenAPI Documentation:
    • CodeIgniter 3 REST API endpoints with X-API-KEY header authentication.
    • Integrated interactive Swagger / Redocly API documentation at /index.php/api-documentation/editor.
  • Integrated Background Queue Worker:
    • Background worker container executes async jobs (php index.php cli/worker/run), job heartbeats, data imports, and direct publishing to NADA catalogs.
  • FastAPI Microdata Companion:
    • Native parsing of SPSS (.sav), Stata (.dta), and CSV files with weighted variable summaries, categorical frequencies, and DuckDB indicator time-series aggregations.

⁠Architecture Overview

                   ┌──────────────────────────────────────────────┐
                   │       dartfx/worldbank-metadata-editor       │
                   │        Nginx + PHP 8.2-FPM (Bookworm)        │
  HTTP / REST API  │  • Web UI (/index.php/editor, /auth)         │
 ─────────────────►│  • REST API (/index.php/api/*, X-API-KEY)    │
                   │  • Swagger OpenAPI UI (/api-documentation)   │
                   └──────┬────────────────┬───────────────┬──────┘
                          │                │               │
                          │ MySQL 3306     │ HTTP 8000     │ Shared Volume
                          ▼                ▼               ▼
                   ┌──────────────┐ ┌──────────────┐ ┌─────────────────────────┐
                   │   db (:3306) │ │   fastapi    │ │  editor_datafiles       │
                   │  MySQL 8.0   │ │ Python 3.12  │ │  /var/www/metadata-     │
                   │  (or MariaDB)│ │ Uvicorn/R/Py │ │  editor/editor/datafiles│
                   └──────▲───────┘ └──────▲───────┘ └────────────▲────────────┘
                          │                │                      │
                          │ MySQL 3306     │ HTTP 8000            │ Shared Volume
                          ┌──────┴────────────────┴──────────────────────┴──────┐
                          │         Background Queue Worker Container           │
                          │        PHP 8.2 CLI (`php index.php cli/worker/run`) │
                          │  • Async job queue processor & heartbeat monitor    │
                          └─────────────────────────────────────────────────────┘

⁠Quick Start (Docker Compose)

Create a docker-compose.yml file:

services:
  db:
    image: mysql:8.0
    container_name: metadata-editor-db
    restart: unless-stopped
    command:
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
      - --default-authentication-plugin=mysql_native_password
      - --max-allowed-packet=256M
    environment:
      MYSQL_ROOT_PASSWORD: root_password_here
      MYSQL_DATABASE: metadata_editor
      MYSQL_USER: editor_user
      MYSQL_PASSWORD: editor_password_here
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - metadata_net
    healthcheck:
      test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 -u$$MYSQL_USER -p$$MYSQL_PASSWORD --silent"]
      interval: 10s
      timeout: 5s
      retries: 10
      start_period: 30s

  fastapi:
    image: dartfx/worldbank-metadata-editor-fastapi:latest
    container_name: metadata-editor-fastapi
    restart: unless-stopped
    environment:
      STORAGE_PATH: /var/www/metadata-editor/editor/datafiles
      HOST: 0.0.0.0
      PORT: 8000
    volumes:
      - editor_datafiles:/var/www/metadata-editor/editor/datafiles
    networks:
      - metadata_net
    healthcheck:
      test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:8000/status >/dev/null || exit 1"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 20s

  editor:
    image: dartfx/worldbank-metadata-editor:latest
    container_name: metadata-editor-web
    restart: unless-stopped
    depends_on:
      db:
        condition: service_healthy
      fastapi:
        condition: service_healthy
    ports:
      - "8080:80"
    environment:
      DB_HOST: db
      DB_PORT: 3306
      DB_NAME: metadata_editor
      DB_USER: editor_user
      DB_PASSWORD: editor_password_here
      EDITOR_STORAGE_PATH: /var/www/metadata-editor/editor/datafiles/editor
      EDITOR_DATA_API_URL: http://fastapi:8000/
      CLEAN_URLS: "true"
      AUTO_INSTALL: "true"
      AUTO_MIGRATE: "true"
      ADMIN_EMAIL: [email protected]
      ADMIN_PASSWORD: AdminPassword123!
      ADMIN_API_KEY: your-secret-admin-api-key
      APP_ENCRYPTION_KEY: ReplaceWithRandom32CharacterString!
    volumes:
      - editor_datafiles:/var/www/metadata-editor/editor/datafiles
      - editor_files:/var/www/metadata-editor/editor/files
      - editor_logs:/var/www/metadata-editor/editor/logs
    networks:
      - metadata_net

  worker:
    image: dartfx/worldbank-metadata-editor:latest
    container_name: metadata-editor-worker
    restart: unless-stopped
    depends_on:
      db:
        condition: service_healthy
      fastapi:
        condition: service_healthy
    command: ["php", "index.php", "cli/worker/run"]
    environment:
      DB_HOST: db
      DB_PORT: 3306
      DB_NAME: metadata_editor
      DB_USER: editor_user
      DB_PASSWORD: editor_password_here
      EDITOR_STORAGE_PATH: /var/www/metadata-editor/editor/datafiles/editor
      EDITOR_DATA_API_URL: http://fastapi:8000/
      AUTO_INSTALL: "false"
      AUTO_MIGRATE: "false"
    volumes:
      - editor_datafiles:/var/www/metadata-editor/editor/datafiles
      - editor_files:/var/www/metadata-editor/editor/files
      - editor_logs:/var/www/metadata-editor/editor/logs
    networks:
      - metadata_net

volumes:
  mysql_data:
  editor_datafiles:
  editor_files:
  editor_logs:

networks:
  metadata_net:
    driver: bridge

Start the stack:

docker compose up -d
⁠Access Points
ServiceURL / PortDescription
Metadata Editor Web UIhttp://localhost:8080/Default login: [email protected] / AdminPassword123!
OpenAPI / Swagger Docshttp://localhost:8080/index.php/api-documentation/editorInteractive API documentation
REST API Endpointhttp://localhost:8080/index.php/apiAuthenticate using X-API-KEY header
FastAPI Healthhttp://localhost:8000/status (internal)JSON health status

⁠Environment Configuration Reference

⁠Application & Security
VariableDefaultDescription
APP_BASE_URL(empty)Fully qualified public URL (e.g. https://metadata.example.org/).
APP_ENCRYPTION_KEY(required)32+ character key for CodeIgniter cookie and session encryption.
CLEAN_URLStrueRemoves /index.php/ from internal routing and generated URLs.
COOKIE_SECUREfalseSet to true when terminating TLS/HTTPS in production.
TRUSTED_PROXY_IPS(empty)Comma-separated reverse proxy IPs (Nginx, Traefik, ALB, Cloudflare).
LOG_THRESHOLD1CodeIgniter log verbosity: 0=Off, 1=Error, 2=Debug, 3=Info.
⁠Database Connection
VariableDefaultDescription
DB_HOSTdbDatabase hostname or IP. Compatible with MySQL 8.0+ and MariaDB 10.11+.
DB_PORT3306MySQL port.
DB_NAMEmetadata_editorDatabase schema name.
DB_USEReditor_userDatabase user.
DB_PASSWORD(required)Database password.
AUTO_INSTALLtrueAutomatically imports schema and creates admin on first boot.
AUTO_MIGRATEtrueAutomatically executes pending migrations on startup.
⁠Initial Administrator Account
VariableDefaultDescription
ADMIN_EMAIL[email protected]Initial administrator login email.
ADMIN_PASSWORDAdmin@123456Initial administrator password.
ADMIN_FIRST_NAMESiteAdmin first name.
ADMIN_LAST_NAMEAdministratorAdmin last name.
ADMIN_API_KEY(empty)Optional initial X-API-KEY registered for the admin user.
⁠Companion Microservice & Storage
VariableDefaultDescription
EDITOR_DATA_API_URLhttp://fastapi:8000/URL where PHP connects to the FastAPI service.
EDITOR_STORAGE_PATH/var/www/metadata-editor/editor/datafiles/editorShared storage directory path.
PHP_MEMORY_LIMIT512MPHP memory limit (increase for massive survey projects).
PHP_UPLOAD_MAX_FILESIZE2000MMaximum single file upload size (default 2 GB).
PHP_POST_MAX_SIZE2000MMaximum total POST request payload size (default 2 GB).

⁠Persistent Storage Volumes

To avoid data loss across container recreations, persist the following container paths to Docker volumes or host mounts:

Container PathPurposeRecommended Volume / Mount
/var/lib/mysqlMySQL tables and InnoDB database transactionsmysql_data
/var/www/metadata-editor/editor/datafilesUploaded survey microdata, schemas, and worker heartbeatseditor_datafiles (shared across editor, worker, fastapi)
/var/www/metadata-editor/editor/filesSession data, user thumbnails, public assets, and captchaeditor_files
/var/www/metadata-editor/editor/logsCodeIgniter audit and application error logseditor_logs

⁠Multi-Architecture Tags

Images are compiled and pushed for both architectures:

  • linux/amd64 (x86_64, standard cloud servers)
  • linux/arm64 (aarch64, Apple Silicon M1-M4, AWS Graviton)

Tags available:

  • latest: Tracks the newest stable release.
  • v1.4.0 (and specific release tags): Pinned reproducible releases.
  • staging: Automated staging builds for testing upcoming releases.

⁠Contact & Maintenance

Maintained by Data Artifex
Repository: https://github.com/DataArtifex/worldbank-metadata-editor-docker⁠
Upstream World Bank Project: https://github.com/worldbank/metadata-editor⁠
Support: [email protected]⁠
License: MIT License⁠ (with World Bank IGO Rider)

Tag summary
Recent tags
Content type
Image
Digest
sha256:572ea88c2…
Size
274.2 MB
Last updated
22 days ago
docker pull dartfx/worldbank-metadata-editor:latest