Task: Add restoration of MODX project from dumps and files
Add restoration of MODX project from dumps and files
Support MODX deployment not only via clean installation, but also from a DB dump, project files, or a full snapshot.
Related to task /tasks/cmqtqmj0m004wp50uccwvo4zh.
Objective
Extend modx-docker so that it can reproduce real legacy MODX projects, rather than just performing a clean installation of a specific MODX version from Git.
Scenarios
Support at least four modes:
- Clean installation — current scenario: checkout the required MODX ref, empty DB, unattended setup.
- Database only — import the provided SQL dump, while preparing files/core separately.
- Files only — use the provided set of project files, but create a new/clean DB.
- Full snapshot — restore both project files and the DB for the most accurate reproduction of the site.
Requirements
- File and DB sources must be set declaratively via configuration/environment variables.
- Do not modify source dumps/archives; perform any environment-specific changes on the working copy.
- After restoration, normalize the environment: DB connection parameters, hostname/domain, absolute paths, and other settings that hinder running inside Docker.
- If there is no DB dump, perform a standard MODX setup.
- If the core is missing from the provided files, provide the ability to retrieve the required MODX ref from Git.
- After restoration, clear the cache and perform environment readiness checks.
- Do not tie the implementation only to modern versions of MODX/PHP/MySQL: the primary motivation is the ability to reproduce legacy combinations.
Context
For MODX, a significant portion of the project state lives in the DB (resources, templates, chunks, snippets, TVs, settings, package information), while another portion lives in the file system (assets, components, custom code, Extras files). Therefore, for a full reproduction of a real project, one must be able to independently or jointly restore both parts.
In the future, this mechanism should allow an agent to take an old MODX site, reproduce its original environment, investigate incompatibilities, and gradually migrate the project to newer runtime versions.