Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with building and deploying custom container #190

Closed
joshdentremont opened this issue Feb 23, 2022 · 8 comments
Closed

Issues with building and deploying custom container #190

joshdentremont opened this issue Feb 23, 2022 · 8 comments
Assignees

Comments

@joshdentremont
Copy link
Collaborator

When following the steps at https://islandora.github.io/documentation/installation/docker-custom/#building-and-deploying-your-custom-container I am getting an error at the make build step:

In Filesystem.php line 63:

  Failed to copy "/var/www/drupal/web/sites/default/default.settings.php" to
  "/var/www/drupal/web/sites/default/settings.php" because target file could
  not be opened for writing.

This causes the Drupal container to continuously restart.

@joshdentremont
Copy link
Collaborator Author

I think this might
actually be a buildkit issue. I would say that the failing command is here: https://github.com/Islandora-Devops/isle-buildkit/blame/d5e177dc50acf964925f59684b6988f25a2620e2/drupal/rootfs/usr/share/drush/Commands/UpdateSettingsCommands.php#L37

@nigelgbanks it looks like you did a lot of the work on buildkit. Any ideas how to fix this? I would say it's a permissions issue, but I don't know how to remedy it

@nigelgbanks
Copy link
Contributor

Can you provide full steps to reproduce, from a clean state? I'm assuming this might be happening in a bind mounted folder and the folder on your host wherever sites/default is, is not writable by the nginx user. Steps to reproduce will allow me to fix it.

@nigelgbanks nigelgbanks self-assigned this Feb 24, 2022
@joshdentremont
Copy link
Collaborator Author

joshdentremont commented Feb 24, 2022

I just followed the instructions in the docs to make local and then change to custom. It's happening on Mac and Linux
Here are the steps I just did to reproduce it:

make clean
cp sample.env .env

Change environment to local in the .env
make local and enter password when prompted
make down
Change environment to custom

make -B docker-compose.yml
make build
make up

make up gives the following errors:

In Filesystem.php line 63:

  Failed to copy "/var/www/drupal/web/sites/default/default.settings.php" to
  "/var/www/drupal/web/sites/default/settings.php" because target file could
  not be opened for writing.



In Filesystem.php line 203:

  Failed to chmod file "/var/www/drupal/web/sites/default/settings.php".

after make up is finished the drupal container keeps restarting

@nigelgbanks
Copy link
Contributor

Surprisingly drush site-install marks the directory /var/www/drupal/web/sites/default/ as non-writable by anyone. Which under normal circumstances would be fine as the settings.php file is already generated, but the the custom image build step removes the settings.php so a new one cannot be copied. I think the correct way to handle this as you pointed to is in the Drush script to account for this behavoir.

@nigelgbanks nigelgbanks transferred this issue from Islandora-Devops/isle-dc Feb 24, 2022
@nigelgbanks
Copy link
Contributor

@joshdentremont I've raised a pull request #191 that fixes the issue, if you happy with those changes I'll merge it. You can test by setting TAG=bd666b27b78e441a10f29534173d4524513c9c0e in your .env file. After the CI job builds and pushes the images to Docker hub.

@joshdentremont
Copy link
Collaborator Author

@nigelgbanks this seems to fix the errors I was getting, but my Drupal container is still restarting, so maybe this was not the cause. Here is the contents of my log when I run make up. I stopped it shortly after it restarted, but if I leave it going it keeps looping through this:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.

[s6-init] ensuring user provided files have correct perms...exited 0.

[fix-attrs.d] applying ownership & permissions fixes...

[fix-attrs.d] done.

[cont-init.d] executing container initialization scripts...

[cont-init.d] 00-container-environment-00-init.sh: executing... 

[cont-init.d] 00-container-environment-00-init.sh: exited 0.

[cont-init.d] 00-container-environment-01-override-nginx.sh: executing... 

[cont-init.d] 00-container-environment-01-override-nginx.sh: exited 0.

[cont-init.d] 00-container-environment-01-override-php.sh: executing... 

[cont-init.d] 00-container-environment-01-override-php.sh: exited 0.

[cont-init.d] 00-container-environment-02-database-defaults.sh: executing... 

[cont-init.d] 00-container-environment-02-database-defaults.sh: exited 0.

[cont-init.d] 00-container-environment-03-set-subsite-defaults.sh: executing... 

[cont-init.d] 00-container-environment-03-set-subsite-defaults.sh: exited 0.

[cont-init.d] 00-container-environment-04-set-revese-proxy.sh: executing... 

[cont-init.d] 00-container-environment-04-set-revese-proxy.sh: exited 0.

[cont-init.d] 01-confd-render-templates.sh: executing... 

[cont-init.d] 01-confd-render-templates.sh: exited 0.

[cont-init.d] 02-fpm-install.sh: executing... 

[cont-init.d] 02-fpm-install.sh: exited 0.

[cont-init.d] 02-ngnix-install.sh: executing... 

[cont-init.d] 02-ngnix-install.sh: exited 0.

[cont-init.d] 04-custom-setup.sh: executing... 

Site already is installed.


 // Do you want to update remove_jsonld_format key in jsonld.settings config?:  

 // yes.                                                                        


Waiting for up to 300 seconds to connect to Database mariadb:3306

Waiting for 3306 on mariadb to open.

Database found

Validating Database credentials

mysqld is alive

Credentials are valid

 [notice] Already enabled: islandora_core_feature

 [success] Added fedoraadmin role to admin

Waiting for 8983 on solr to open.

Waiting for 8081 on islandora.traefik.me to open.

Waiting for 61613 on activemq to open.

Waiting for 80 on blazegraph to open.

Waiting for 80 on blazegraph to open.

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100   735    0    17  100   718      2    120  0:00:05  0:00:05 --:--:--     4

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100   283  100    61  100   222     10     38  0:00:06  0:00:05  0:00:01    16

 [notice] Now acting as user ID 1

 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'islandora_tags'

 [notice] Switching back from user 1.

 [error]  Error: Call to a member function set() on null in include() (line 5 of /tmp/fix.php) #0 /var/www/drupal/vendor/drush/drush/src/Commands/core/PhpCommands.php(111): include()

#1 [internal function]: Drush\Commands\core\PhpCommands->script()

#2 /var/www/drupal/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array()

#3 /var/www/drupal/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()

#4 /var/www/drupal/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()

#5 /var/www/drupal/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(350): Consolidation\AnnotatedCommand\CommandProcessor->process()

#6 /var/www/drupal/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()

#7 /var/www/drupal/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run()

#8 /var/www/drupal/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()

#9 /var/www/drupal/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()

#10 /var/www/drupal/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run()

#11 /var/www/drupal/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun()

#12 /var/www/drupal/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run()

#13 /var/www/drupal/vendor/drush/drush/includes/preflight.inc(18): require('/var/www/drupal...')

#14 phar:///usr/bin/drush/bin/drush.php(141): drush_main()

#15 /usr/bin/drush(10): require('phar:///usr/bin...')

#16 {main}. 

[24-Feb-2022 20:05:40 UTC] Error: Call to a member function set() on null in /tmp/fix.php on line 5 #0 /var/www/drupal/vendor/drush/drush/src/Commands/core/PhpCommands.php(111): include()

#1 [internal function]: Drush\Commands\core\PhpCommands->script()

#2 /var/www/drupal/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array()

#3 /var/www/drupal/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()

#4 /var/www/drupal/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()

#5 /var/www/drupal/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(350): Consolidation\AnnotatedCommand\CommandProcessor->process()

#6 /var/www/drupal/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()

#7 /var/www/drupal/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run()

#8 /var/www/drupal/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()

#9 /var/www/drupal/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()

#10 /var/www/drupal/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run()

#11 /var/www/drupal/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun()

#12 /var/www/drupal/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run()

#13 /var/www/drupal/vendor/drush/drush/includes/preflight.inc(18): require('/var/www/drupal...')

#14 phar:///usr/bin/drush/bin/drush.php(141): drush_main()

#15 /usr/bin/drush(10): require('phar:///usr/bin...')

#16 {main}

 [warning] Drush command terminated abnormally.


 // Do you want to update broker_url key in islandora.settings config?: yes.    


Fedora Admin role already exists.  No need to create it.

matomo is not installed.  Skipping configuration

openseadragon is not installed.  Skipping configuration

islandora_defaults is not installed.  Skipping configuration

Solr Found at solr:8983

Fcrepo Found at islandora.traefik.me:8081

Broker Found at activemq:61613

Triplestore Found at blazegraph:80

search_api_solr is not installed.  Skipping core setup.

Triplestore Found at blazegraph:80

EXISTS: islandora<?xml version="1.0"?><data modified="2" milliseconds="5620"/>Error: Call to a member function set() on null in include() (line 5 of /tmp/fix.php).

[cont-init.d] 04-custom-setup.sh: exited 1.

[cont-finish.d] executing container finish scripts...

[cont-finish.d] done.

[s6-finish] waiting for services.

[s6-finish] sending all processes the TERM signal.

[s6-finish] sending all processes the KILL signal and exiting.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.

[s6-init] ensuring user provided files have correct perms...exited 0.

[fix-attrs.d] applying ownership & permissions fixes...

[fix-attrs.d] done.

[cont-init.d] executing container initialization scripts...

[cont-init.d] 00-container-environment-00-init.sh: executing... 

[cont-init.d] 00-container-environment-00-init.sh: exited 0.

[cont-init.d] 00-container-environment-01-override-nginx.sh: executing... 

[cont-init.d] 00-container-environment-01-override-nginx.sh: exited 0.

[cont-init.d] 00-container-environment-01-override-php.sh: executing... 

[cont-finish.d] executing container finish scripts...

[cont-finish.d] done.

[s6-finish] waiting for services.

[cont-init.d] 00-container-environment-01-override-php.sh: exited 0.

[s6-finish] sending all processes the TERM signal.

[s6-finish] sending all processes the KILL signal and exiting.

@nigelgbanks
Copy link
Contributor

I've raise another pull request for that, though against isle-dc: Islandora-Devops/isle-dc#234 If your happy with that I'll merge it too.

@nigelgbanks
Copy link
Contributor

nigelgbanks commented Feb 24, 2022

I think you're the only one to test this functionality in like a year 😄

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

No branches or pull requests

2 participants