Setup and configuration
The setup commands (python sdp.py db setup, python sdp.py source add) ask the questions once and write the answers as config files; inside the containers, each profile loads its base config from config/<profile>/ and lays the source’s override file from config/sources/<name>/ over it, then reads the source’s platform.yaml beside it. This page describes the layers, how they merge and which one wins, and how a run reads them. Every setting and file is listed in Configuration reference.
How it connects
flowchart TD
DBSETUP["db setup"] --> DBYAML["config/db/*.yaml and .env"]
ADD["source add name"] --> Q["Source questions"]
DBYAML --> Q
HF["Hugging Face metadata API"] -->|"--hf only"| Q
TPL["config/templates/reddit.yaml"] -->|"Reddit only"| Q
Q --> PLAT["config/sources/name/platform.yaml"]
Q --> OVR["config/sources/name/profile override files"]
RUN["run profile --source name"] --> GATE["Gate: database configured, override file present"]
GATE --> CONT["Profile container, config/ mounted read-only at /app/config"]
BASE["config/profile folder: base files"] --> MERGE["Base files with the override merged over them"]
OVR --> MERGE
CONT --> MERGE
CONT --> PLAT
ENVV["Container environment from .env"] --> ENVO["Connection settings overridden"]
MERGE --> ENVO
Setup writes the files once; at run time nothing asks again. python sdp.py run checks that the files exist, and the container merges and reads them.
The configuration layers
| Layer | Written by | Tracked or local | Controls |
|---|---|---|---|
config/<folder>/pipeline.yaml, plus cpu_classifiers.yaml, gpu_classifiers.yaml, services.yaml |
The project | Tracked | Defaults for every profile (lowest precedence) |
config/<folder>/user.yaml |
You, by hand from user.yaml.example |
Local | Legacy overrides, read only when the source has no override file for that profile |
config/sources/<name>/<override file>.yaml |
source add, source configure, source add-classifiers |
Local | Per-source overrides of the profile defaults; when present, user.yaml is ignored entirely |
config/sources/<name>/platform.yaml |
source add, source configure, db create-indexes |
Local | The data description: data types, paths, file patterns, fields, types, keys, indexes; read beside the profile config, not merged into it |
config/templates/reddit.yaml |
The project | Tracked | Starting point of Reddit’s platform.yaml; copied at setup, not read at run time |
config/db/*.yaml |
db setup, db setup-mcp |
Local | Global database settings |
.env |
db setup and others |
Local | Ports, data paths, auth flags; passed into the containers |
The run environment |
python sdp.py run |
Not stored | PLATFORM, SOURCE, the data paths from platform.yaml, --filter (FILE_FILTER), --skip-lingua-files |
Because python sdp.py run refuses to start without the source’s override file, user.yaml is reached only when a container reads another profile’s config: lingua, for example, reads the postgres_ingest and sr_ingest settings to decide whether to write lingua_ingest/. config/setup_state.yaml is tracked but read by nothing.
How the layers merge
- Base config. The profile’s base files are loaded from its config folder:
config/<profile>/pipeline.yaml, plus the other profile-level files (cpu_classifiers.yamlforlingua,gpu_classifiers.yamlforml,services.yamlforpostgres_mlandsr_ml). A missing base file is an error. - Source override. The source’s override file for that profile,
config/sources/<name>/<file>.yaml, is deep-merged on top. Without one,config/<folder>/user.yamlis used if it exists. - Scoped by file name. Overrides are scoped by config filename: each top-level key of the override file corresponds to one base file, without the
.yamlextension (pipeline:→pipeline.yaml,gpu_classifiers:→gpu_classifiers.yaml,services:→services.yaml). A top-level key that names no base file of that profile is not applied. - Lists replace. A list value in an override fully replaces the base list; lists are never merged. Mappings are merged key by key, and the override’s value wins.
- Multi-file profiles. The base files of one profile are merged in a fixed order (
pipeline.yamlfirst), and a later file wins on a shared key.
The profile folders and override files do not always share a name:
| Profile | Base folder | Base files | Source override file |
|---|---|---|---|
parse |
config/parse/ |
pipeline.yaml |
parse.yaml |
lingua |
config/lingua/ |
pipeline.yaml, cpu_classifiers.yaml |
lingua.yaml |
ml |
config/ml/ |
pipeline.yaml, gpu_classifiers.yaml |
ml.yaml |
postgres_ingest |
config/postgres/ |
pipeline.yaml |
postgres.yaml |
postgres_ml |
config/postgres_ml/ |
pipeline.yaml, services.yaml |
postgres_ml.yaml |
mongo_ingest |
config/mongo/ |
pipeline.yaml |
mongo.yaml |
sr_ingest |
config/sr/ |
pipeline.yaml |
starrocks.yaml |
sr_ml |
config/sr_ml/ |
pipeline.yaml, services.yaml |
sr_ml.yaml |
config/starrocks/ is not a profile config folder: it holds the StarRocks server’s config templates.
The platform config, config/sources/<name>/platform.yaml, is not merged with anything: it is one self-contained file per source. For Reddit it is a copy of config/templates/reddit.yaml with the paths, file format, row-group size and bucket count filled in; for custom and Hugging Face sources it is generated from the answers.
How a run reads its config
- Gate.
python sdp.py run <profile> --source <name>(the source is auto-selected when only one exists) checks that the profile’s database has aconfig/db/<db>.yamland that the source has the profile’s override file. Either missing stops the run with the command that writes it (db setup --add <db>, orsource configure <name>). - Mount check. For the PostgreSQL and StarRocks profiles it also checks that the running server can see the source’s folders (see Databases and ingestion).
- Container. It starts the profile’s container with
PLATFORM,SOURCEand the data paths set, and the repository’sconfig/mounted read-only at/app/config. - Merge. Inside the container the stage merges its profile’s base files and the override, then applies the environment overrides below.
- Platform. It reads the source’s
platform.yamlseparately for fields, types, patterns, schema and indexes; a missingplatform.yamlstops the run and says to runpython sdp.py source add <name>. - Required keys. A required key that is missing stops the run with an error that names the key path (for example
Required configuration missing: processing.parse_workers).
Environment overrides
After the merge, a few environment variables from .env override database keys:
| Profile | Variable | Overrides |
|---|---|---|
postgres_ingest, postgres_ml |
POSTGRES_PORT, DB_NAME |
database.port, database.name |
postgres_ingest, postgres_ml |
DB_SCHEMA, when set (nothing in sdp or the compose file sets it) |
database.schema |
postgres_ingest, postgres_ml |
POSTGRES_PASSWORD (prompted at start) |
The connection password |
mongo_ingest |
MONGO_PORT |
database.port |
mongo_ingest |
MONGO_ADMIN_USER, MONGO_ADMIN_PASSWORD (prompted at start) |
database.user, the connection password |
sr_ingest, sr_ml |
STARROCKS_PORT, STARROCKS_FE_HTTP_PORT |
database.port, database.fe_http_port |
sr_ingest, sr_ml |
STARROCKS_ROOT_PASSWORD (prompted at start) |
The connection password |
Design decisions
Decisions are taken at setup and stored; runtime only executes config. Anything that depends on your intent (which columns to keep, what to do with a field that has no SQL type, whether to deduplicate) is asked once and written to config/sources/<name>/, and the stages do exactly what it says, with no auto-detection that overrides it. The cost is that a change of mind means a source configure or a hand edit, and a rerun of setup rewrites platform.yaml from the answers (the previous file is kept as .bak).
A missing required value fails loudly. get_required raises an error naming the key, and the run gate names the command that writes a missing file, so a broken setup never runs against the wrong path, port or schema. The cost is two known fallbacks that remain: python sdp.py run uses ./data/<folder>/<source> when platform.yaml has no paths, and docker-compose.yml carries fallback values for unset .env keys.
Override files are scoped by base file name and lists replace. A top-level key per base file keeps each override unambiguous in a multi-file profile, and replacing lists means an override’s list is exactly what runs. The cost is that you cannot add one item to a base list: the override must repeat the whole list.
Each source has its own folder of config, independent of the others. Each source carries its own paths, platform description and profile overrides, so sources with different layouts, databases and classifiers live side by side and can be added or removed without touching each other. The cost is repetition: a setting you want for every source has to be in the base files or in each source’s override.
The configuration is mounted read-only into the containers. A stage can read /app/config but never change it, so only the host-side setup commands write configuration. The cost is that nothing a run discovers (a detected schema, a new index) is saved back; you record it through setup.