Drupal\Core\Command\InstallCommand should provide a --password option

Created on 30 June 2024, 10 months ago

Problem/Motivation

When troubleshooting and reviewing issues on different core branches I've following workflow

git checkout 11.x
composer install
php -d memory_limit=512M core/scripts/drupal quick-start standard
# Above command will install Drupal and generate random password. Since 
            
              
              
              🐛
              quick-start installation stops responding
                Active
              
             this will hang up randomly, so I must do following:
# 1. go to http://127.0.0.1:8888/user/1/edit and change "Email address" domain to valid and change password to something that is easy to remember/static so the browser password manager can use it.
# 2. ctrl+c on terminal
php -d memory_limit=256M -S localhost:8888 .ht.router.php

I understand this workflow is just a work-a-round for 🐛 quick-start installation stops responding Active , but since that issue is going to take time to fix, I'd like to get password option so the workflow could be minified to:

git checkout 11.x
composer install
php -d memory_limit=512M core/scripts/drupal quick-start standard --password=123
# ctrl+c on terminal
php -d memory_limit=256M -S localhost:8888 .ht.router.php

Steps to reproduce

Proposed resolution

Add password option to Drupal\Core\Command\InstallCommand

Remaining tasks

- MR
- Acceptance for idea
- Tests
- RTBC
- Profit

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component
Install 

Last updated about 12 hours ago

No maintainer
Created by

🇫🇮Finland sokru

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @sokru
  • Pipeline finished with Failed
    10 months ago
    Total: 175s
    #212327
  • Pipeline finished with Failed
    10 months ago
    Total: 171s
    #212331
  • Pipeline finished with Success
    10 months ago
    Total: 603s
    #212338
  • Status changed to Needs review 10 months ago
  • 🇫🇷France andypost

    Nice idea

  • Status changed to Needs work 9 months ago
  • 🇫🇷France andypost

    Needs work for test and I left nitpick improvement

  • Pipeline finished with Success
    9 months ago
    Total: 551s
    #238048
  • Pipeline finished with Canceled
    9 months ago
    Total: 78s
    #238315
  • Pipeline finished with Success
    9 months ago
    Total: 470s
    #238317
  • Status changed to Needs review 9 months ago
  • 🇫🇮Finland sokru

    Added one test to assert the password is echoed correctly on Quick Start command. Otherwise I feel its very hard to test the actual login without converting the relevant tests (QuickStartTest and TestSiteApplicationTest) into browser tests.

    Therefore I removed the "Needs tests", but feel free to re-add the tag with more information about desired tests.

  • 🇮🇳India prashant.c Dharamshala

    Does this commandphp -d memory_limit=256M core/scripts/drupal quick-start standardnot work with ddev

    On a fresh clone on Drupal 11.x, did a ddev ssh, tried the above command, and got the following error for providing the database details in the settings file.

    0/17 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]
    Installing Drupal
    
    In install.core.inc line 991:
                                                                                                                                                         
      Resolve all issues below to continue the installation. For help configuring your database server, see the <a href="https://www.drupal.org/docs/in  
      stalling-drupal">installation handbook</a>, or contact your hosting provider.<ul><li>The database server version <em class="placeholder">3.40.1</  
      em> is less than the minimum required version <em class="placeholder">3.45</em>.</li></ul>                                                         
                                                                                                                                                         
    
    quick-start [--langcode [LANGCODE]] [--password [PASSWORD]] [--site-name [SITE-NAME]] [--host [HOST]] [--port [PORT]] [-s|--suppress-login] [--] [<install-profile-or-recipe>]
    

    Am I missing or doing something wrong here?
    Please suggest.

  • 🇫🇮Finland sokru

    Does this command php -d memory_limit=256M core/scripts/drupal quick-start standard not work with ddev

    The attached error message shows (not very clearly) that the SQLite3 version provided by the DDEV is lower than required version.

  • Pipeline finished with Success
    9 months ago
    Total: 491s
    #238402
  • 🇮🇳India prashant.c Dharamshala

    @sokru Sorry my bad did not realise this is DDEV specific issue not with this.

  • 🇮🇳India prashant.c Dharamshala

    @andypost

    Finally, the ddev issue was resolved, I was already on the latest ddev version but still, it was taking SQLite as 3.40.

    The command I used to refresh the docker container fixed the issue ddev debug refresh. Hope this will help others facing a similar issue.

    Tested the password parameter and site installation worked fine along with the password was set as the supplied password.

    DDEV command ddev exec -d /var/www/html php core/scripts/drupal quick-start standard --password=123

    17/17 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓]
    Congratulations, you installed Drupal!
    Username: admin
    Password: 123
    Drupal development server started: <http://127.0.0.1:8888>
    This server is not meant for production use.
    One time login url: <http://127.0.0.1:8888/user/reset/1/1722427623/LCAA_p8pF2FKW_67nSea0ybqEmIyzpo4l9Z7knbRZUY/login>
    Press Ctrl-C to quit the Drupal development server.
    
                                                                                                                            
     [ERROR] No suitable browser opening command found, open yourself: 'http://127.0.0.1:8888/user/reset/1/1722427623/LCAA_p8pF2FKW_67nSea0ybqEmIyzpo4l9Z7knbRZUY/login?destination=%2F'
    

    For DDEV replace the http://127.0.0.1:8888 with your site domain.

    I think good for RTBC.

  • Status changed to RTBC 9 months ago
  • 🇫🇷France andypost

    Created CR https://www.drupal.org/node/3465079

    Looks nothing to be done here except final FM review and commiters

  • Status changed to Needs work 8 months ago
  • 🇳🇿New Zealand quietone

    This change, if accepted, should also be included on the wiki page, https://www.drupal.org/docs/getting-started/installing-drupal/drupal-qui...

    I made a recommendation on the MR, setting to needs work for that.

  • Pipeline finished with Success
    8 months ago
    Total: 610s
    #251182
  • Status changed to Needs review 8 months ago
  • 🇫🇮Finland sokru

    Added the recommendation to MR. I don't see any draft workflow on wiki page, so I assume updating the documentation should be done only after MR has been merged.

  • Status changed to RTBC 8 months ago
  • 🇺🇸United States smustgrave

    Believe that is the case with documentation pages. Right @quietone?

  • 🇳🇿New Zealand quietone

    Add 'to' to title

    • catch committed c5193b30 on 11.x
      Issue #3458167 by sokru, andypost, prashant.c, quietone: Add password...
  • 🇬🇧United Kingdom catch

    Committed/pushed to 11.x, thanks!

    Still needs documentation updates.

  • 🇫🇮Finland sokru

    I gave some thought on documentation page update, but I'd say its better to leave as simple as possible. The documentation page gives the instructions for "--help" flag for quick-start command, and that shows the instructions for all the options, including the password option.

  • Status changed to Fixed 6 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024