Skip to content

feat!: add MageForge bind-mount setup and dependency management#198

Merged
dermatz merged 9 commits into
mainfrom
install-module-deps-local-dev
Jun 11, 2026
Merged

feat!: add MageForge bind-mount setup and dependency management#198
dermatz merged 9 commits into
mainfrom
install-module-deps-local-dev

Conversation

@dermatz

@dermatz dermatz commented Jun 8, 2026

Copy link
Copy Markdown
Member

This pull request improves the reliability and setup of the MageForge module in the Magento development environment, especially when the module is bind-mounted rather than installed via Composer. It adds robust checks to ensure the bind-mount is active, automates the installation of third-party dependencies, and clarifies the setup process to prevent common issues related to Docker mounts.

Key changes include:

Bind-mount reliability and verification:

  • Added a guard in .ddev/commands/web/install-magento to check if the MageForge bind-mount is active, providing clear error messages and instructions if the mount is orphaned due to directory deletion while DDEV is running.
  • Updated .ddev/config.yaml to explicitly create the full bind-mount target directory (magento/app/code/OpenForgeProject/MageForge) during pre-start, ensuring correct permissions and preventing mount issues.

Dependency management for bind-mounted modules:

  • Introduced a new script .ddev/commands/web/install-module-deps that reads the module's composer.json and installs any missing non-Magento, non-PHP dependencies into the Magento vendor directory, addressing the limitation that Composer does not resolve dependencies for bind-mounted modules.
  • Updated .ddev/commands/web/install-magento to run the new dependency installation script after copying files and before running setup:upgrade, ensuring all required dependencies are present.
  • Added a post-start hook in .ddev/config.yaml to automatically run the dependency installation script after the environment starts.

Module registration improvements:

  • Modified .ddev/commands/web/install-magento to enable the MageForge module via bin/magento module:enable, which discovers the module through its component registrar (registration.php), writes the entry to app/etc/config.php, and exits non-zero on any error.

Copilot AI review requested due to automatic review settings June 8, 2026 06:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a DDEV-side mechanism to ensure MageForge’s third-party Composer dependencies are installed into the Magento vendor/ directory when MageForge is bind-mounted into app/code (i.e., not Composer-installed in the Magento project).

Changes:

  • Added a new DDEV web command to install missing MageForge composer.json dependencies into the Magento project.
  • Updated the Magento install script to run the dependency installer after installing Hyvä and before enabling the MageForge module.
  • Updated DDEV post-start hook to run the dependency installer automatically on environment start (only when Magento is already installed).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
.ddev/config.yaml Runs the new dependency installer on post-start to keep Magento vendor/ in sync when MageForge is bind-mounted.
.ddev/commands/web/install-module-deps New script that reads MageForge’s composer.json and installs missing non-Magento dependencies into the Magento project.
.ddev/commands/web/install-magento Calls the dependency installer during Magento setup, before enabling MageForge.

Comment thread .ddev/commands/web/install-module-deps Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 8, 2026 08:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comment thread .ddev/commands/web/install-module-deps
Comment thread .ddev/commands/web/install-module-deps Outdated
Comment thread .ddev/commands/web/install-module-deps
@dermatz dermatz changed the title feat!: add script to install MageForge module dependencies and update… feat!: add MageForge bind-mount setup and dependency management Jun 9, 2026
Copilot AI review requested due to automatic review settings June 9, 2026 07:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

.ddev/commands/web/install-magento:34

  • The bind-mount guard runs before the "Magento already installed" short-circuit. This makes ddev install-magento fail on already-installed setups if the mount isn't active, even though the command would otherwise exit early. Consider checking for an existing install first, then validating the bind-mount only when an install is actually needed.
# Guard: verify the MageForge bind-mount is active.
# The Docker bind-mount (../src → .../MageForge) is a kernel-level mount established
# when the containers start. If magento/ was deleted while DDEV was running, the mount
# becomes orphaned: its inode is gone, and recreating the directory produces a new inode
# not covered by the old mount. The module source would then be invisible to Magento.
# The only fix is a container restart, which re-establishes the mount on the new inode.
if [[ ! -f "${MAGENTO_FOLDER}/app/code/OpenForgeProject/MageForge/registration.php" ]]; then
	echo "ERROR: The MageForge bind-mount is not active."
	echo ""
	echo "This happens when magento/ was deleted while DDEV was still running."
	echo ""
	echo "Fix: run 'ddev restart', then re-run 'ddev install-magento'."
	exit 1
fi

# check if Magento is already installed
if [[ -f "${MAGENTO_FOLDER}/bin/magento" ]]; then
	echo "Magento is already installed. Skipping install-magento."
	exit 0
fi

Comment thread .ddev/commands/web/install-module-deps
Comment thread .ddev/commands/web/install-magento Outdated
Copilot AI review requested due to automatic review settings June 9, 2026 08:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comment thread .ddev/commands/web/install-module-deps Outdated
Comment thread .ddev/commands/web/install-module-deps Outdated
Comment thread .ddev/commands/web/install-magento
Copilot AI review requested due to automatic review settings June 11, 2026 11:35
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jun 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread .ddev/commands/web/install-module-deps Outdated
Comment thread .ddev/commands/web/install-magento Outdated
Comment thread .ddev/commands/web/install-magento
@dermatz dermatz merged commit 2e0e168 into main Jun 11, 2026
12 checks passed
@dermatz dermatz deleted the install-module-deps-local-dev branch June 11, 2026 13:28
@github-actions github-actions Bot mentioned this pull request Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants