Lullabot / drupal9ci

Command Line Interface for implementing Continuous Integration in Drupal 9
GNU General Public License v3.0
161 stars 55 forks source link

DocumentRoot directory doesn't exist #74

Closed safetypins closed 3 years ago

safetypins commented 3 years ago

I'm getting this error inside of CircleCI:

 [1G  8/26 [========>-------------------]  30%[Exec] Running service apache2 start
Starting Apache httpd web server: apache2AH00112: Warning: DocumentRoot [/var/www/html] does not exist

Do I need to configure Apache to look at /opt/drupal/docroot?

juampynr commented 3 years ago

Hi @safetypins, I think that there is a symlink that should take care of that already. Did this happen on an update or on a fresh installation of drupal9ci?

cc @m4olivei and @fjgarlin in case it rings a bell.

fjgarlin commented 3 years ago

Yeah Drupal should be in the right Apache folder. Did you change anything from the default files? Which of the tasks fail? Perhaps a link to the task or further output might help.

safetypins commented 3 years ago

it's a fresh installation of drupal9ci in an established drupal installation. I've changed a few things in the default d9ci config files, but only to get rid of errors that I've encountered before this, like figuring out how to get drush running, giving drush the correct web root, pulling over a database dump. Mostly I've replaced /web/ with /docroot/.

Not everything is broken, the coding standards tests were running properly before I turned them off. I've disabled everything but the behat testing, because that's the sort of testing I'm primarily interested in. As far as I know, I've not made any changes related to apache configuration; I can't even find any references to apache configuration. When I searched google for this, most of the suggestions involved an circleci.conf file that needed to be updated, but this project doesn't include that, does it?

safetypins commented 3 years ago

Ok, I'm just realizing you were asking for a link to the circleci task, so here you go: https://app.circleci.com/pipelines/github/RhodesCollege/rhodes_edu/191/workflows/ad9c9fb6-74db-41e2-b7cf-a6a86aa72d2e/jobs/240

fjgarlin commented 3 years ago

Ok, it’s definitely the web to docroot change then. The easiest would be to symlink one to the other in the robofile, like here: https://github.com/Lullabot/drupal9ci/blob/master/dist/bitbucket/RoboFile.php#L187 (you’ll need to adapt paths).

Otherwise if you change docroot to web at Drupal level things should just work.

safetypins commented 3 years ago

Thanks so much, that worked! On to the next error.

fjgarlin commented 3 years ago

Great! Any sort of feedback at the end would be appreciated and perhaps we can update docs.

juampynr commented 3 years ago

thanks for the help @fjgarlin !

safetypins commented 3 years ago

Sure. I have found this whole process pretty confusing, although it's less confusing than my first attempt a few months ago. I don't know how common it is for people to change the web directory to something else, but it definitely would have helped to have a list of the places where this change impacts the configuration. Let me see if I can compile a list of changes I made.

safetypins commented 3 years ago

So, thinking back on the process so far, I felt like there were a bunch of different places where I had to change web to docroot. I'm not sure why, but for some reason when I was first searching for where to change this, I searched for "web/" instead of just "web". This missed several references, which I have found now when I tried to go through the process. I think this was really just an error on my part. But here's a list of files & lines that I've changed:

RoboFile.php

Lines 118-119

$tasks[] = $this->taskFilesystemStack()
    ->copy('.circleci/config/settings.local.php', 'web/sites/default/settings.local.php', $force);

Lines 227-228

$tasks[] = $this->taskFilesystemStack()
    ->copy('.circleci/config/phpunit.xml', 'web/core/phpunit.xml', $force)

Line 231

->exec('../vendor/bin/phpunit -c core --debug --verbose --log-junit ../artifacts/phpunit/phpunit.xml modules/custom');

Lines 269-272

$tasks[] = $this->taskExecStack()
    ->exec('vendor/bin/phpcs --standard=Drupal --report=junit --report-junit=artifacts/phpcs/phpcs.xml web/modules/custom')
    ->exec('vendor/bin/phpcs --standard=DrupalPractice --report=junit --report-junit=artifacts/phpcs/phpcs.xml web/modules/custom');

Line 284

$docroot = $this->getDocroot() . '/web';

config/phpunit.xml

Line 30

<env name="BROWSERTEST_OUTPUT_DIRECTORY" value="/opt/drupal/web/sites/simpletest"/>

config/behat.yml

Line 19

drupal_root: '/opt/drupal/docroot'

In addition to these changes, I found that the Drush executable was not found. So I had to add a command to run composer install.

In circleci.yml, line 37 I inserted:

- run:
    name: Install dependencies
    command: composer install

I'm not sure if I did this preemptively or in response to an error, but after I got the dump.sql file downloaded into the container, I added the full path to the db dump.sql file (/opt/drupal/dump.sql) to the drush sql-cli command.

safetypins commented 3 years ago

I hope this is helpful, and thanks for all the work you've done to put this together.

fjgarlin commented 3 years ago

I updated the readme file linking to your comment above @safetypins and the symlink trick. Thanks for reporting the issue and for following up with the affected files.