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

Run composer commands as nginx #329

Merged
merged 9 commits into from
Sep 27, 2023
Merged

Conversation

DonRichards
Copy link
Member

Running composer install or update frequently causes modules to install as root. This should prevent that.

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@ysuarez
Copy link
Contributor

ysuarez commented Apr 19, 2023

From the tech call today, if this PR works adjust the syntax from the resulting docs from this older PR too
https://islandora.github.io/documentation/installation/docker-maintain-drupal/#updating-your-drupal-site

DonRichards and others added 2 commits April 21, 2023 11:10
Co-authored-by: Chris Burgess <[email protected]>
Co-authored-by: Chris Burgess <[email protected]>
@DonRichards
Copy link
Member Author

@xurizaemon Thanks! It worked.

@aOelschlager aOelschlager self-requested a review April 26, 2023 17:30
Makefile Outdated
@@ -309,7 +310,7 @@ download-default-certs:

# Run Composer Update in your Drupal container
composer_update:
docker-compose exec -T drupal with-contenv bash -lc 'composer update'
docker-compose exec -T drupal with-contenv bash -lc su nginx -s /bin/bash -c 'composer update'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be changed to match the other changes using the --user nginx instead of su nginx -s /bin/bash -c?

@aOelschlager
Copy link
Contributor

OS: Pop!_OS 22.04 LTS
I ran make starter_dev and ran into these errors:

docker-compose exec --user nginx -T drupal with-contenv bash -lc "composer install"
bash: /root/.bash_profile: Permission denied
Cannot create cache directory /root/.composer/cache/repo/https---packages.drupal.org-8/, or directory is not writable. Proceeding without cache
Cannot create cache directory /root/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /root/.composer/cache/files/, or directory is not writable. Proceeding without cache
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 184 installs, 0 updates, 0 removals

  • Downloading composer/installers (v1.12.0)
    ... [I removed this for ease of reading]

  • Syncing islandora-rdm/islandora_fits (dev-8.x-1.x f03b4ee) into cache
    Failed to download islandora-rdm/islandora_fits from source: Failed to clone https://github.com/roblib/islandora_fits.git via https, ssh protocols, aborting.

  • https://github.com/roblib/islandora_fits.git
    fatal: could not create leading directories of '/root/.composer/cache/vcs/https---github.com-roblib-islandora-fits.git'

  • [email protected]:roblib/islandora_fits.git
    fatal: could not create leading directories of '/root/.composer/cache/vcs/https---github.com-roblib-islandora-fits.git'

    Now trying to download from dist

    • Downloading islandora-rdm/islandora_fits (dev-8.x-1.x f03b4ee)
      ... [I removed this for ease of reading]
    • Syncing islandora/advanced_search (dev-contrib 5756be0) into cache
      Failed to download islandora/advanced_search from source: Failed to clone https://github.com/digitalutsc/advanced_search.git via https, ssh protocols, aborting.
  • https://github.com/digitalutsc/advanced_search.git
    fatal: could not create leading directories of '/root/.composer/cache/vcs/https---github.com-digitalutsc-advanced-search.git'

  • [email protected]:digitalutsc/advanced_search.git
    fatal: could not create leading directories of '/root/.composer/cache/vcs/https---github.com-digitalutsc-advanced-search.git'

    Now trying to download from dist

    • Downloading islandora/advanced_search (dev-contrib 5756be0)
      ... [I removed this for ease of reading]
    • Installing drupal/core (9.5.8): Extracting archive
      Install of drupal/core failed
    • Installing drupal/admin_toolbar (3.3.0): Extracting archive
      Install of drupal/admin_toolbar failed
    • Installing nesbot/carbon (2.66.0): Extracting archive
    • Installing professional-wiki/edtf (2.0.2): Extracting archive
    • Installing drupal/token (1.11.0): Extracting archive
      Install of drupal/token failed
    • Installing technosophos/libris (2.0.2): Extracting archive
    • Installing drupal/entity (1.4.0): Extracting archive
      Install of drupal/entity failed
    • Installing drupal/bibcite (2.0.0-beta2): Extracting archive
      Install of drupal/bibcite failed
    • Installing drupal/citation_select (1.0.0-beta3): Extracting archive
      Install of drupal/citation_select failed
    • Installing drupal/config_inspector (2.1.0): Extracting archive
      Install of drupal/config_inspector failed
    • Installing drupal/config_update (1.7.0): Extracting archive
      Install of drupal/config_update failed
    • Installing drupal/core-recommended (9.5.8)
    • Installing doctrine/common (3.4.3): Extracting archive
    • Installing drupal/devel (5.1.1): Extracting archive
      Install of drupal/devel failed
    • Installing drupal/field_group (3.4.0): Extracting archive
      Install of drupal/field_group failed
    • Installing drupal/field_permissions (1.2.0): Extracting archive
      Install of drupal/field_permissions failed
    • Installing drupal/field_report (2.1.0): Extracting archive
      Install of drupal/field_report failed
    • Installing drupal/hal (1.0.3): Extracting archive
      Install of drupal/hal failed
    • Installing drupal/jquery_ui (1.6.0): Extracting archive
      Install of drupal/jquery_ui failed
    • Installing drupal/jquery_ui_menu (2.0.0): Extracting archive
      Install of drupal/jquery_ui_menu failed
    • Installing drupal/jquery_ui_autocomplete (2.0.0): Extracting archive
      Install of drupal/jquery_ui_autocomplete failed
    • Installing drupal/key (1.17.0): Extracting archive
      Install of drupal/key failed
    • Installing drupal/matomo (1.21.0): Extracting archive
      Install of drupal/matomo failed
    • Installing drupal/pdf (1.1.0): Extracting archive
      Install of drupal/pdf failed
    • Installing drupal/rest_oai_pmh (2.0.0-beta8): Extracting archive
      Install of drupal/rest_oai_pmh failed
    • Installing drupal/restui (1.21.0): Extracting archive
      Install of drupal/restui failed
    • Installing drupal/taxonomy_manager (2.0.8): Extracting archive
      Install of drupal/taxonomy_manager failed
    • Installing drupal/term_reference_change (2.0.0-beta3): Extracting archive
      Install of drupal/term_reference_change failed
    • Installing drupal/term_merge (2.0.0-beta4): Extracting archive
      Install of drupal/term_merge failed
    • Installing drupal/transliterate_filenames (2.0.1): Extracting archive
      Install of drupal/transliterate_filenames failed
    • Installing drupal/twig_tweak (3.2.1): Extracting archive
      Install of drupal/twig_tweak failed
    • Installing league/csv (9.8.0): Extracting archive
    • Installing drupal/csv_serialization (2.1.0): Extracting archive
      Install of drupal/csv_serialization failed
    • Installing drupal/views_data_export (1.3.0): Extracting archive
      Install of drupal/views_data_export failed
    • Installing drupal/views_field_view (1.0.0-beta5): Extracting archive
      Install of drupal/views_field_view failed
    • Installing webmozart/assert (1.11.0): Extracting archive
    • Installing webmozart/path-util (2.3.0): Extracting archive
    • Installing webflo/drupal-finder (1.2.2): Extracting archive
    • Installing nikic/php-parser (v4.15.4): Extracting archive
    • Installing psy/psysh (v0.10.12): Extracting archive
    • Installing league/container (3.4.1): Extracting archive
    • Installing grasmash/yaml-expander (1.4.0): Extracting archive
    • Installing enlightn/security-checker (v1.10.0): Extracting archive
    • Installing grasmash/expander (1.0.0): Extracting archive
    • Installing consolidation/config (1.2.1): Extracting archive
    • Installing consolidation/site-alias (3.1.7): Extracting archive
    • Installing consolidation/site-process (4.2.1): Extracting archive
    • Installing consolidation/robo (3.0.11): Extracting archive
    • Installing consolidation/filter-via-dot-access-data (1.0.0): Extracting archive
    • Installing chi-teck/drupal-code-generator (1.33.1): Extracting archive
    • Installing drush/drush (10.6.2): Extracting archive
    • Installing firebase/php-jwt (v5.5.1): Extracting archive
    • Installing islandora-rdm/islandora_fits (dev-8.x-1.x f03b4ee): Extracting archive
      Install of islandora-rdm/islandora_fits failed
    • Installing psr/http-client (1.0.2): Extracting archive
    • Installing psr/event-dispatcher (1.0.0): Extracting archive
    • Installing solarium/solarium (6.2.8): Extracting archive
    • Installing myclabs/php-enum (1.8.4): Extracting archive
    • Installing maennchen/zipstream-php (2.2.6): Extracting archive
    • Installing drupal/search_api (1.29.0): Extracting archive
      Install of drupal/search_api failed
    • Installing drupal/search_api_solr (4.2.10): Extracting archive
      Install of drupal/search_api_solr failed
    • Installing drupal/facets (2.0.6): Extracting archive
      Install of drupal/facets failed
    • Installing islandora/advanced_search (dev-contrib 5756be0): Extracting archive
      Install of islandora/advanced_search failed
    • Installing ml/iri (1.1.4): Extracting archive
    • Installing ml/json-ld (1.2.1): Extracting archive
    • Installing easyrdf/easyrdf (1.1.1): Extracting archive
    • Installing islandora/chullo (1.3.0): Extracting archive
    • Installing drupal/geolocation (3.12.0): Extracting archive
      Install of drupal/geolocation failed
    • Installing islandora/controlled_access_terms (v2.2.0): Extracting archive
      Install of islandora/controlled_access_terms failed
    • Installing stomp-php/stomp-php (5.0.0): Extracting archive
    • Installing islandora/jsonld (2.1.3): Extracting archive
      Install of islandora/jsonld failed
    • Installing symfony/security-core (v4.4.48): Extracting archive
    • Installing symfony/polyfill-intl-grapheme (v1.27.0): Extracting archive
    • Installing symfony/string (v5.4.22): Extracting archive
    • Installing symfony/property-info (v5.4.22): Extracting archive
    • Installing symfony/property-access (v5.4.22): Extracting archive
    • Installing symfony/security-http (v4.4.50): Extracting archive
    • Installing symfony/security-guard (v4.4.46): Extracting archive
    • Installing symfony/security-csrf (v5.2.12): Extracting archive
    • Installing symfony/polyfill-php81 (v1.27.0): Extracting archive
    • Installing symfony/config (v4.4.44): Extracting archive
    • Installing symfony/security-bundle (v4.4.50): Extracting archive
    • Installing monolog/monolog (2.9.1): Extracting archive
    • Installing symfony/monolog-bridge (v5.2.12): Extracting archive
    • Installing symfony/monolog-bundle (v3.8.0): Extracting archive
    • Installing symfony/polyfill-php56 (v1.20.0)
    • Installing namshi/jose (7.2.3): Extracting archive
    • Installing islandora/crayfish-commons (3.0.0): Extracting archive
    • Installing drupal/prepopulate (2.4.0): Extracting archive
      Install of drupal/prepopulate failed
    • Installing drupal/migrate_source_csv (3.5.0): Extracting archive
      Install of drupal/migrate_source_csv failed
    • Installing drupal/migrate_plus (6.0.1): Extracting archive
      Install of drupal/migrate_plus failed
    • Installing drupal/jwt (1.1.0): Extracting archive
      Install of drupal/jwt failed
    • Installing twistor/stream-util (v1.0.1): Extracting archive
    • Installing league/mime-type-detection (1.11.0): Extracting archive
    • Installing league/flysystem (1.1.10): Extracting archive
    • Installing twistor/flysystem-stream-wrapper (v1.0.9): Extracting archive
    • Installing league/flysystem-replicate-adapter (1.0.1): Extracting archive
    • Installing drupal/flysystem (2.0.0-beta1): Extracting archive
      Install of drupal/flysystem failed
    • Installing drupal/filehash (2.0.9): Extracting archive
      Install of drupal/filehash failed
    • Installing drupal/file_replace (1.3.0): Extracting archive
      Install of drupal/file_replace failed
    • Installing drupal/features (3.12.0): Extracting archive
      Install of drupal/features failed
    • Installing drupal/eva (3.0.0): Extracting archive
      Install of drupal/eva failed
    • Installing drupal/ctools (4.0.3): Extracting archive
      Install of drupal/ctools failed
    • Installing drupal/context (4.1.0): Extracting archive
      Install of drupal/context failed
    • Installing islandora/islandora (2.7.0): Extracting archive
      Install of islandora/islandora failed
    • Installing islandora/openseadragon (2.0.3): Extracting archive
      Install of islandora/openseadragon failed
    • Installing islandora/views_nested_details (1.0.0): Extracting archive
      Install of islandora/views_nested_details failed
    • Installing library/pdf.js (2.16.105): Extracting archive
      Install of library/pdf.js failed
    • Installing mjordan/islandora_workbench_integration (v1.0.0): Extracting archive
      Install of mjordan/islandora_workbench_integration failed
      0/118 [>---------------------------] 0%
      9/118 [==>-------------------------] 7%
      25/118 [=====>----------------------] 21%
      39/118 [=========>------------------] 33%
      58/118 [=============>--------------] 49%
      78/118 [==================>---------] 66%
      97/118 [=======================>----] 82%
      107/118 [=========================>--] 90%
      118/118 [============================] 100%
      118/118 [============================] 100%

    [RuntimeException]
    web/core does not exist and could not be created.

Revert running as nginx
Copy link
Contributor

@aOelschlager aOelschlager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this with make starter_dev and it worked. I checked the permissions in the drupal container and everything was set to nginx.

@aOelschlager
Copy link
Contributor

I tested make composer_update and got this error:
docker-compose exec -T drupal with-contenv bash -lc su nginx -s /bin/bash -c 'composer update'"
/bin/sh: 1: Syntax error: Unterminated quoted string
make: *** [Makefile:312: composer_update] Error 2

It's missing the other quotation mark in front of su. When I added that it ran fine.

@DonRichards
Copy link
Member Author

Should be ready for testing

@DonRichards
Copy link
Member Author

DonRichards commented Sep 27, 2023

Switch the double quotes with the single quotes and that seemed to fix one issue.
But there was also a race condition for starter_dev. The /var/www/drupal directory wasn't available the exact second the chown/composer install tried to run. A wait while /var/www/drupal doesn't exist was added to make starter_dev and make local.

Copy link
Contributor

@aOelschlager aOelschlager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the errors I was having! Thanks Don!!

@aOelschlager aOelschlager merged commit ead1d61 into development Sep 27, 2023
@DonRichards DonRichards deleted the force_composer_as_nginx branch September 27, 2023 21:24
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

Successfully merging this pull request may close these issues.

4 participants