1

I'm trying to use DDEV to locally test an upgrade of my running clubs's Drubal 7 website.

I've got one container with a copy of the website, result below is from the DDEV describe command:

    URLs
    ----
    https://drupalTest.ddev.site:8003
    https://127.0.0.1:32773
    http://drupalTest.ddev.site:8002
    http://127.0.0.1:32774

    MySQL/MariaDB Credentials
    -------------------------
    Username: "db", Password: "db", Default database: "db"

    or use root credentials when needed: Username: "root", Password: "root"

    Database hostname and port INSIDE container: db:3306
    To connect to db server inside container or in project settings files:
    mysql --host=db --user=db --password=db --database=db
    Database hostname and port from HOST: 127.0.0.1:32771
    To connect to mysql from your host machine,
    mysql --host=127.0.0.1 --port=32771 --user=db --password=db --database=db

    Other Services
    --------------
    MailHog (https):        https://drupalTest.ddev.site:8026
    MailHog:                http://drupalTest.ddev.site:8025
    phpMyAdmin (https):     https://drupalTest.ddev.site:8037
    phpMyAdmin:             http://drupalTest.ddev.site:8036

I also have a container with Drupal 8 (fresh install).

    URLs
    ----
    https://drupal8migration.ddev.site:8017
    https://127.0.0.1:32769
    http://drupal8migration.ddev.site:8016
    http://127.0.0.1:32770

    MySQL/MariaDB Credentials
    -------------------------
    Username: "db", Password: "db", Default database: "db"

    or use root credentials when needed: Username: "root", Password: "root"

    Database hostname and port INSIDE container: db:3306
    To connect to db server inside container or in project settings files:
    mysql --host=db --user=db --password=db --database=db
    Database hostname and port from HOST: 127.0.0.1:32797
    To connect to mysql from your host machine,
    mysql --host=127.0.0.1 --port=32797 --user=db --password=db --database=db

    Other Services
    --------------
    MailHog (https):        https://drupal8migration.ddev.site:8026
    MailHog:                http://drupal8migration.ddev.site:8025
    phpMyAdmin (https):     https://drupal8migration.ddev.site:8037
    phpMyAdmin:             http://drupal8migration.ddev.site:8036

I'm having problems getting the drush migrate-upgrade command to work, this is the

ddev exec drush migrate-upgrade --legacy-db-url=mysql://db:db@127.0.0.1:32771/db --legacy-root=https://drupalTest.ddev.site:8003 --configure-only

Just getting this error:

SQLSTATE[HY000] [2002] Connection refused                            [error]

Any help appreciatd

Mark
  • 75
  • 1
  • 7

1 Answers1

3

Welcome to ddev, Mark!

Your problem is thtat you're using the wrong --legacy-db-url there. The credentials of the database are going to be:

host: container name of the legacy install (like ddev--db) (NOT 127.0.0.1) Port: does not need to be specified, because it's the default 3306 (inside the docker container space)

So it looks like you want something like this: ddev exec drush migrate-upgrade --legacy-db-url=mysql://db:db@ddev-drupaltest-db/db --legacy-root=https://drupalTest.ddev.site:8003 --configure-only

See the faq under "Can different projects communicate with each other"

Also, you'll absolutely want to read Migrating from Drupal 6 to Drupal 8 Like a Boss, which helps to understand all these things in the context of migration.

I note that you seem to be using different http ports for different projects - you don't need to do that at all. The normal way to use ddev is for everything to be on ports 80 and 443 (or some other port set if you have conflicts). You do not need to set router_http_port or router_https_port just to run multiple projects on the same host.

rfay
  • 9,963
  • 1
  • 47
  • 89
  • Very useful and I'm sure this next problem is something new but when I run the command I get about 20 warnings messages all with the same message: htmlspecialchars() expects parameter 1 to be string, array given [warning] Html.php:424 I've had a quick google and it's not very obvious but perharps something to do with special charcaters. I'll keep googling! – Mark Jul 09 '20 at 18:34
  • Older Drupal often has those kind of messages, I've seen that plenty. You may not want to work around it. But make sure you're using current drush - have you site-installed current drush in your target project? `ddev composer require drush/drush`. Otherwise, with the command you offered, you'd be just using drush8, which is bundled in the web container. If you site-install, then the drush launcher finds the site-installed drush. – rfay Jul 09 '20 at 21:59
  • 1
    Thanks @rfay it seems so obvious now, I was using the old version of drush. – Mark Jul 11 '20 at 14:00
  • Another question (sorry) when I run the next command: ddev exec drush config-export --destination=tmp I get a message saying the configruaiton has been sucessfully exported however when I look in the tmp folder it's blank. I've tried searching for the .yaml files and do not see them. (I'll create a new post if this needs more attention!) – Mark Jul 11 '20 at 14:23
  • --destination=tmp wouldn't likely work. You'll want to use something like `--destination=/tmp` so it's not in a relative path. – rfay Jul 13 '20 at 01:58
  • 1
    With --destination=somedir they go to web/somedir. Without --destination they go to sites/default/files/sync as defined in settings.ddev.php. – Kari Kääriäinen Jul 13 '20 at 15:37
  • 1
    I had a look today and all the .yml fies are in the /tmp folder, (I did run it a few times) maybe I was just having a moment, thanks anyway :) – Mark Jul 14 '20 at 18:17