Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Add "install extension" script #3

Closed
punkstar opened this issue Feb 17, 2016 · 7 comments
Closed

Add "install extension" script #3

punkstar opened this issue Feb 17, 2016 · 7 comments

Comments

@punkstar
Copy link
Contributor

We use a script like the following quite a lot. Would be good to have it bundled into the image:

#!/bin/bash

MAGENTO_ROOT="/magento"
PHP="/usr/local/bin/php"
COMPOSER="$PHP /usr/local/bin/composer"

MODULE_NAME="Meanbee_Extension"
COMPOSER_NAME="meanbee/extension"

MAGENTO_TOOL="magento-command"

cd $MAGENTO_ROOT

# This is required because Magento doesn't support the path type in composer
# this is a hack.
ln -s /src/ src

$COMPOSER config repositories.extension path /src
$COMPOSER require $COMPOSER_NAME "*"

# Required due to us using the "path" type for the repository
$COMPOSER require "composer/composer" "1.0.0-alpha11 as 1.0.0-alpha10"

$MAGENTO_TOOL module:enable $MODULE_NAME
$MAGENTO_TOOL setup:upgrade
$MAGENTO_TOOL setup:static-content:deploy
$MAGENTO_TOOL cache:flush
$MAGENTO_TOOL deploy:mode:set developer

@punkstar punkstar added this to the 1.1.0 milestone Feb 19, 2016
@brideo
Copy link
Contributor

brideo commented Feb 29, 2016

I was thinking about this, could we have an extensions.env file, which would be in the .gitingore, then the user could define extensions in there and they could be installed on build rather than in an install script afterwards.

I'm happy to implement this if you think it's a good idea?

@brideo
Copy link
Contributor

brideo commented Mar 9, 2016

Also, I believe if we rethink how we are handling our symlink we don't have to hack composer to use a later version.

If we had a modules in the root of our repo, we could then symlink the modules being worked on into this directory from $MAGENTO_ROOT/vendor, this way we can still easily access our dev code.

IE:

ln -s ./$MAGENTO_ROOT/vendor/Meanbee/Example ./modules/Meanbee/Example

Pros:

  • No Composer hack
  • No ln -s /src/ src hack
  • No remapping of server paths in xDebug
  • Magento modules would be isolated from a specific dev environment making them pluggable should we need to test in another environment

Cons:

  • We would need to handle two git repositories. One for the environment and one for the module.

@punkstar
Copy link
Contributor Author

Related: magento/magento2#3623, magento/magento2#3612. Adding so that we can track if there is a move from the Magento team on this.

@tgerulaitis
Copy link
Member

I've done some research into this and I don't think we can improve this by much.

The above linked Magento issues are both closed because of formatting issues 🤦‍♂️ and while the Stack Exchange post linked in one of them claims that the internal team is looking into this, it's been two years and the situation is unchanged.

Nowadays we don't use Magento root folder as the root folder of our projects anymore. Magento is installed into the web folder directly in the container to prevent having to change the ownership of the files or slow read/write access to mounted folders. The code is then synced to the project root for IDE access. This means that we can't just put our source folder inside Magento.

Although maybe if we mount the src into /var/www/magento/src/ (assuming we can force composer to install Magento into a non-empty directory), and exclude it from syncing itself, it would solve all of our problems?

@tgerulaitis
Copy link
Member

Scratch that, composer doesn't support it: composer/composer#1135

Looks like symlinks are the only way to go. Going to try to make the script take care of as much of it as it can though.

@brideo
Copy link
Contributor

brideo commented Jun 30, 2017

Could you just mount in a composer file?

@tgerulaitis
Copy link
Member

Not sure I follow completely, but I don't think so. The magento-installer script runs composer create-project which requires the target directory to be completely empty.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants