wodby / docker4drupal

Docker-based Drupal stack
https://wodby.com/docker4drupal
MIT License
1.24k stars 534 forks source link

How to allow 2 networks to communicate for a D7 to D8 migration? #414

Open MXTcomunica opened 4 years ago

MXTcomunica commented 4 years ago

Codebase

  1. Old D7 site (source): Mounted codebase
  2. New D8 site: Mounted codebase

Describe your issue

  1. I have a (old) working D7 website running in docker4drupal local environment (eg: D7site_network, mounted codebase).
  2. Now I have to do a D7 -> D8 migration, so I've created a new docker4drupal environment (eg: D8site_network) where I'm creating the new D8 website.
  3. To do the migration, I need to point to the D7site_network database (the data source) from my D8site_network, and I want to do this adding the D7site_network database credentials as second database directly in my D8site_network settings.php, as described: here:
// The default Drupal 8 database connection details:
$databases['default']['default'] = array (
  'database'  => 'drupal',
  'username'  => 'drupal',
  'password'  => 'drupal',
  'host'      => 'mariadb',
  'port'      => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver'    => 'mysql',
);

// The Drupal 7 database connection details:
$databases['drupal7']['default'] = array (
  'database'  => 'drupal',
  'username'  => 'drupal',
  'password'  => 'drupal',
  'host'      => 'mariadb',
  'port'      => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver'    => 'mysql',
);

How to setup docker4drupal stuff to allow above communication between the 2 projects?

Thank you very much for any help

csandanov commented 4 years ago

You can define an additional docker network and add it to your services. We have a docker-compose example in traefik.yml but you should be able to do it via CLI.

MXTcomunica commented 4 years ago

You can define an additional docker network and add it to your services.

@csandanov I'm not sure I understand what do you mean with this (sorry I'm really a newbye on this kind of stuff). The result I've reached so far is to have the two websites (the old D7 and the new D8) able to run in the same time running a stand-alone traefik as suggested in your d4d documentation (Running multiple Projects - Single port paragraph).

Then, I tried to enable the migrate migrate_drupal and migrate_drupal_ui modules in the new D8 just to see if it can connect to the old D7 using the migrate drupal ui. The newD8.docker.localhost:8000/upgrade/credentials asks to insert the old D7 db credentials but I'm not sure what value add in the database host input field. I tried putting the full url oldD7.docker.localhost:8000 but it doesn't work:

Screenshot_from_newD8_website

Please help me: a more detailed explanation on what to do or an example would be very helpful.

Thank you.

walkero-gr commented 4 years ago

The way I solved that matter was to create a second mariadb service in different folder, where I imported the D7 site DB. also I added a volume where the D7 site files where available, so that could be imported on import process. I think those are enough for you to work on. And you can do that on the same stack.