This process:
- Lists
JSON/andPDF/entries in the Hugging Face dataset. - Detects pending samples (JSON files without a PDF).
- Downloads JSON files in batches, generates PDFs, and uploads them to Hugging Face.
- Attempts to hydrate metadata in MariaDB (if DB credentials are provided).
Minimum requirements to run end-to-end:
- Docker installed on the server.
- Outbound Internet access from the container (OpenAI, VirusTotal, and Hugging Face).
- Required environment variables configured (
OPENAI_API_KEY,HF_TOKEN,VT_API_KEY_1). - If you want DB writes: connectivity to MariaDB host + valid credentials.
Run from the repository root.
cp batch_upload/.env.example batch_upload/.envEdit batch_upload/.env and fill in at least:
OPENAI_API_KEYHF_TOKEN(orHUGGINGFACE_TOKEN)VT_API_KEY_1
If you also want DB hydration, fill in:
DB_HOSTDB_PORTDATABASEMARIADB_CIBERLAB_USERMARIADB_CIBERLAB_PASSWORD
docker build -t ciberlab-report-generator-batch -f batch_upload/Dockerfile .docker run --rm --env-file batch_upload/.env ciberlab-report-generator-batchdocker run --rm \
--env-file batch_upload/.env \
-v "$PWD/json:/data/input" \
-v "$PWD/pdf:/data/output" \
-v "$PWD/tmp:/app/tmp" \
-e INPUT_PATH_DEFAULT=/data/input \
-e OUTPUT_PATH_DEFAULT=/data/output \
ciberlab-report-generator-batchYou can also use:
batch_upload/batch-upload.sh build
batch_upload/batch-upload.sh runWith volumes:
batch_upload/batch-upload.sh run-mountIf the DB is on a different Docker network, define DOCKER_NETWORK:
DOCKER_NETWORK=app_default batch_upload/batch-upload.sh runBATCH_SIZE: batch size (download/processing/upload).AI_MODEL: OpenAI model to use.MODE: execution mode (PRO, etc.).LOG_LEVEL:DEBUG,INFO,WARNING,ERROR.TMP_PATH: directory for logs andreportGeneratorResults_*.json.
batch_upload/.envdoes not contain test secrets.HF_TOKENhas write permissions for the target dataset.- OpenAI and VirusTotal limits/quotas reviewed for expected volume.
- Docker networking validated toward MariaDB (if applicable).
- Output directories (
json/,pdf/,tmp/) have correct permissions.
- If DB credentials are missing, the process still runs (generates/uploads PDFs) but logs DB hydration errors.
- If PDF upload to Hugging Face fails,
upload_errors_*.jsonis generated and the process stops. - Default profile for this entrypoint is
batch_uploader.
- OpenAI error on startup: check
OPENAI_API_KEY. - Upload to Hugging Face fails: check
HF_TOKENand dataset permissions. - DB hydration fails: check
DB_HOST, credentials, and Docker network. - No pending JSON files found: matching PDFs may already exist in the dataset.