0

I have created a new Drupal 8 site with docker. I created it with composer and installed the drupal/deploy and relaxedws/replicator modules. The drupal/deploy module and all of its dependencies seem to be installed correctly, they show up in the Extend area of Drupal, and they seem to work properly. The relaxedws/replicator does not show up as expected. I expect to see it in the Web Services section of the Extend page in Drupal.

The relaxedws/replicator module shows up on the file system in the vendor folder in the Drupal root.

It seems like I'm missing something.

Dockerfile:

    FROM drupal:latest

    RUN apt-get update && apt-get install -y \
        curl \
        git \
        mysql-client \
        vim \
        wget

    RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
        php composer-setup.php && \
        mv composer.phar /usr/local/bin/composer && \
        php -r "unlink('composer-setup.php');"

    RUN wget -O drush.phar https://github.com/drush-ops/drush-launcher/releases/download/0.4.2/drush.phar && \
        chmod +x drush.phar && \
        mv drush.phar /usr/local/bin/drush

    RUN rm -rf /var/www/html/*

    COPY apache-drupal.conf /etc/apache2/sites-enabled/000-default.conf

    WORKDIR /app

    RUN composer create-project drupal-composer/drupal-project:8.x-dev /app --stability dev --no-interaction

    RUN mkdir -p /app/config/sync

    RUN chown -R www-data:www-data /app/web

    RUN composer require relaxedws/replicator:dev-master

    RUN composer require drupal/deploy

Resulting composer.json

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "composer/installers": "^1.2",
        "cweagans/composer-patches": "^1.6",
        "drupal-composer/drupal-scaffold": "^2.2",
        "drupal/console": "^1.0.2",
        "drupal/core": "~8.5.3",
        "drupal/deploy": "^1.0@beta",
        "drush/drush": "^9.0.0",
        "relaxedws/replicator": "dev-master",
        "vlucas/phpdotenv": "^2.4",
        "webflo/drupal-finder": "^1.0.0",
        "webmozart/path-util": "^2.3"
    },
    "require-dev": {
        "webflo/drupal-core-require-dev": "~8.5.3"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    },
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ],
        "files": ["load.environment.php"]
    },
    "scripts": {
        "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/libraries/{$name}": ["type:drupal-library"],
            "web/modules/contrib/{$name}": ["type:drupal-module"],
            "web/profiles/contrib/{$name}": ["type:drupal-profile"],
            "web/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"]
        }
    }
}

** EDIT 1 I attempted the fix mentioned by @sonfd (and say thanks for the answer). I changed my extra.installer-paths to the following but the path for the installed package didn't change.

    "extra": {
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/libraries/{$name}": ["type:drupal-library"],
            "web/modules/contrib/{$name}": ["type:drupal-module"],
            "web/profiles/contrib/{$name}": ["type:drupal-profile"],
            "web/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"],
            "web/modules/{$name}": ["relaxedws/replicator"]
        }
    }

2 Answers 2

1

Composer installs things based on the informations in extras.installer-paths in your composer.json, or to the vendor directory by default. You can place the package anywhere you want by following the steps at How do I install a package to a custom path for my framework?. Basically you need to update your extra.installer-paths area to look something like:

"extra": {
    "installer-paths": {
        "web/core": ["type:drupal-core"],
        "web/libraries/{$name}": ["type:drupal-library"],
        "web/modules/contrib/{$name}": ["type:drupal-module"],
        "web/profiles/contrib/{$name}": ["type:drupal-profile"],
        "web/themes/contrib/{$name}": ["type:drupal-theme"],
        "drush/contrib/{$name}": ["type:drupal-drush"],
        "path/to/desirable/package/location": ["relaxedws/replicator"]
    }
}

Note the additional line for relaxedws/replicator at the bottom.

Note: I would composer remove relaxedws/replicator before updating the installer paths and then reinstall with composer require relaxedws/replicator. I don't think composer will move the package to the new location otherwise, but maybe it would with some form of a composer update command.

4
  • this change does not work. Adding the additional installer-paths entry didn't change the location for this package.
    – James R
    May 3, 2018 at 17:23
  • 1
    Did you remove the package and reinstall?
    – sonfd
    May 3, 2018 at 17:30
  • I did remove and reinstall. I also installed from scratch (rebuilt the Docker container, installed composer, modified the extra.installer-paths before installing anything, then installed relaxedws/replicator).
    – James R
    May 3, 2018 at 17:50
  • I'm going to close this question and ask it in a different way. I'm trying to use the Deploy functionality in order to deploy between different sites. The instructions make it seem simple, but what they show (in videos and the instructions is not what I end up with). Packages and relaxedws/replicator is the final piece in this setup.
    – James R
    May 3, 2018 at 18:02
0

I found the answer to my problem. It didn't have to do with package placement, but package selection. I was not adding the correct package. As I stumbled and grumbled, the packagist website did not show the package I was looking for. https://packagist.org/packages/?q=drupal%2Frelax&p=0

What helped me find it was getting a few packages incorrect when adding them with composer require <some_non_existent_package_name>. When you do this composer will offer suggestions as to what you might be looking for. I then used this to search for packages.

In the end, the package I was actually looking for was called drupal/relaxed. The package I mentioned above in the question relaxedws/replicator is a prerequisite and not the actual Drupal package.

composer require drupal/relaxed

Back story: This was all in an effort to get Drupal 8 Deploy working. The documentation never points to installing this package. Hopefully this helps.

https://www.drupal.org/docs/8/modules/deploy/drupal-to-drupal-deployment-between-two-or-more-sites

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.