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

Add a run-updates.sh script to run updates from the command line #820

Closed
jenlampton opened this issue Mar 20, 2015 · 32 comments
Closed

Add a run-updates.sh script to run updates from the command line #820

jenlampton opened this issue Mar 20, 2015 · 32 comments

Comments

@jenlampton
Copy link
Member

On pantheon the updates can't be run from the dashboard because that depends on drush, and we don't have drush working quite yet. As an interim solution (and since there are other people who may want to run updates from the command line) we should add a run-updates.sh script into the scripts directory in core.

@serundeputy
Copy link
Member

I like the sound of this. Should the run-updates.sh script curl in the latest 1.0.x.tgz?

  • curl https://github.com/backdrop/backdrop/archive/v1.0.5.zip
  • tar xzf latest.tgz
  • mv current ./core to ./bub_core
  • mv {untar} ./core

something like that?

@quicksketch
Copy link
Member

I think we're just talking about a shell version of update.php, just to run updates that are already there.

@serundeputy
Copy link
Member

drush updb works now.

Does drush updb satisfy this requirement?

@jenlampton
Copy link
Member Author

Yes, if we can get @greganderson or @populist or others over at Pantheon to install the drush commands for Backdrop.

@quicksketch
Copy link
Member

Though we'll need to fix Drush so that doesn't break Drupal 7 installations when the Backdrop extension is installed. backdrop-contrib/backdrop-drush-extension#9

@jenlampton
Copy link
Member Author

@quicksketch I'm not sure how that works on pantheon - it may not matter since each site is on it's own?

@populist
Copy link

populist commented Mar 4, 2016

The way it works on Pantheon is that each CMS we deploy (Drupal 7, Drupal 8, WordPress, Backdrop) has special options. In the case of Drush, sites based on D7 uses a different version of Drush than D8. Backdrop uses the same version as D7 of course.

@serundeputy
Copy link
Member

@populist what we/Backdrop actually need is what is currently the master branch of the drush project, but I think will become the 8.x (backdrop-contrib/backdrop-drush-extension#23) branch once the drush community starts working on Drush 9.

But for now the backdrop/drush extension needs the master branch of drush.

thanks,
~Geoff

@populist
Copy link

populist commented Mar 7, 2016

@serundeputy assuming that @greg-1-anderson gets that version running for Drupal 8, we can easily switch Backdrop to use that version instead.

@greg-1-anderson
Copy link

Currently, Pantheon is running Drush 8 (current master branch) for all Drupal 8, and all new Drupal 7 sites. If you have a very old Drupal 7 site, it will be running Drush 5, but the easy workaround here for Backdrop is to just make a new Pantheon site, so you can be sure that your base Drush is the right version.

From there, I'm not sure why the base configuration isn't working (presuming that your Backdrop Drush bootstrap class is appropriately loaded and available), but I posted a suggested workaround at #1682 that could be tried.

@greg-1-anderson
Copy link

Also, before trying #1682, I should also ask if anyone tried just putting the Backdrop drush commands at PANTHEON_BACKDROP_ROOT/drush. That should be sufficient on a new Pantheon site running Drush 8.

@serundeputy
Copy link
Member

thanks @populist and @greg-1-anderson for looking at these issues!

@greg-1-anderson I've installed a brand new Pantheon Backdrop site.
Added the backdrop/drush extension to PANTHEON_BACKDROP_ROOT/drushand committed to pantheon.

Here is a drush updb attempt:

geoff@gspmbp bd-drush (master) $ terminus --site=bd-drush --env=dev drush "updb"
[2016-03-07 23:59:52] [warning] Note: This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g. updating modules or plugins), you will need to toggle into read/write SFTP mode first.
[2016-03-07 23:59:52] [info] Running drush updb on bd-drush-dev
    cmd: 'updb'
    site: 'bd-drush'
    env: 'dev'
Drush 5.10.1 does not support Drupal . Use Drush 4 instead.              [error]
The drush command 'updb' could not be executed.                          [error]
Drush was not able to start (bootstrap) the Drupal database.             [error]
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See `drush topic docs-aliases` for
details.
 * connect the database through a socket. The socket file may be
wrong or the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.

Drush was attempting to connect to:
  Drupal version    :
  Default theme     : garland
  Administration theme: garland
  PHP configuration :
/srv/bindings/997d9247fc0b48eda99d0765977c6736/php.ini
/srv/bindings/997d9247fc0b48eda99d0765977c6736/php.ini
  Drush version     : 5.10.1
  Drush configuration:
/srv/bindings/997d9247fc0b48eda99d0765977c6736/.drush/drushrc.php
  Drupal root       :
/srv/bindings/997d9247fc0b48eda99d0765977c6736/code
  %paths            : Array


[2016-03-07 23:59:57] [error] Either we could not connect, or Drush has exited with code 1
    client: 'Drush'
    code: 1

any ideas? Looks like it is picking up Drush version : 5.10.1.

thanks,
~Geoff

@greg-1-anderson
Copy link

Drush 5 is totally wrong. I was going to try to fix the Drush version for you, but I can't find your site. Did you delete it already?

Maybe try making a new Drupal 8 site, remove everything from the repository, and re-add Backdrop. Then commit and install through the normal web UI, and see what version of Drush you get. If you do this, your framework should be set to 'drupal8', and you should as a result always get Drush 8.

@serundeputy
Copy link
Member

@greg-1-anderson
Copy link

I guess I didn't ask Hubot nicely enough. Found it, set your Drush to 8. See if it runs better now. I'm going to take a look at your framework setting too.

@greg-1-anderson
Copy link

Oh, Backdrop has its own framework value. Makes sense; also explains why it does not work out of the box.

@serundeputy
Copy link
Member

different:

geoff@gspmbp bd-drush (master) $ terminus --site=bd-drush --env=dev drush "updb"
[2016-03-08 00:53:09] [warning] Note: This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g. updating modules or plugins), you will need to toggle into read/write SFTP mode first.
[2016-03-08 00:53:09] [info] Running drush updb on bd-drush-dev
    cmd: 'updb'
    site: 'bd-drush'
    env: 'dev'

Parse error: syntax error, unexpected '[' in /opt/pantheon/drush-8/includes/startup.inc on line 63
Ok
[2016-03-08 00:53:15] [error] Either we could not connect, or Drush has exited with code 255
    client: 'Drush'
    code: 255
geoff@gspmbp bd-drush (master) $ terminus --site=bd-drush --env=dev drush "cc all"
[2016-03-08 00:53:33] [warning] Note: This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g. updating modules or plugins), you will need to toggle into read/write SFTP mode first.
[2016-03-08 00:53:33] [info] Running drush cc all on bd-drush-dev
    cmd: 'cc all'
    site: 'bd-drush'
    env: 'dev'

Parse error: syntax error, unexpected '[' in /opt/pantheon/drush-8/includes/startup.inc on line 63
Ok
[2016-03-08 00:53:40] [error] Either we could not connect, or Drush has exited with code 255
    client: 'Drush'
    code: 255

@greg-1-anderson
Copy link

I'll bet you would really like to have php 5 running on that endpoint too. Made that change as well; sorry I didn't notice that the first time.

@serundeputy
Copy link
Member

@greg-1-anderson did you change the framework value or something?

now it is looking for other versions.
here are cc all -v and updb -v outputs:

geoff@gspmbp ~ $ terminus --site=bd-drush --env=dev drush "cc all"
[2016-03-08 21:04:43] [warning] Note: This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g. updating modules or plugins), you will need to toggle into read/write SFTP mode first.
[2016-03-08 21:04:43] [info] Running drush cc all on bd-drush-dev
    cmd: 'cc all'
    site: 'bd-drush'
    env: 'dev'
No Drupal site found, only 'drush' cache was cleared.                  [warning]
geoff@gspmbp ~ $ terminus --site=bd-drush --env=dev drush "cc all -v"
[2016-03-08 21:05:07] [warning] Note: This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g. updating modules or plugins), you will need to toggle into read/write SFTP mode first.
[2016-03-08 21:05:07] [info] Running drush cc all -v on bd-drush-dev
    cmd: 'cc all -v'
    site: 'bd-drush'
    env: 'dev'
Include /etc/drush/drush-commandfiles                                   [notice]
Include /etc/drush/drush-8-commandfiles                                 [notice]
Include /etc/drush/drupal-7-drush-commandfiles                          [notice]
No Drupal site found, only 'drush' cache was cleared.                  [warning]
Command dispatch complete                                               [notice]
geoff@gspmbp ~ $ terminus --site=bd-drush --env=dev drush "updb -v"
[2016-03-08 21:05:33] [warning] Note: This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g. updating modules or plugins), you will need to toggle into read/write SFTP mode first.
[2016-03-08 21:05:33] [info] Running drush updb -v on bd-drush-dev
    cmd: 'updb -v'
    site: 'bd-drush'
    env: 'dev'
Include /etc/drush/drush-commandfiles                                   [notice]
Include /etc/drush/drush-8-commandfiles                                 [notice]
Include /etc/drush/drupal-7-drush-commandfiles                          [notice]
Command updatedb needs a higher bootstrap level to run - you will        [error]
need to invoke drush from a more functional Drupal environment to run
this command.
The drush command 'updb' could not be executed.                          [error]
[2016-03-08 21:05:41] [error] Either we could not connect, or Drush has exited with code 1
    client: 'Drush'
    code: 1

maybe one step closer here.

~Geoff

@greg-1-anderson
Copy link

The framework value is still "backdrop", but I forced your Drush to version 8, and your PHP to version 5.5. It looks like you are running Drush 8 now, but the backdrop include file is not being loaded by Drush.

@serundeputy
Copy link
Member

@greg-1-anderson so i'll try the #1682 method now; on this site

@greg-1-anderson
Copy link

So, your backdrop class actually needs to go in BACKDROP_ROOT/drush/bootstrap. I moved it there, and now we're getting a little farther. Drush is selecting your bootstrap class, but it is now saying that it cannot find a backdrop installation directory.

Take a look at my last two commits, and see if you can debug your site detection code. You probably don't need to put all of Drush in the drush folder at this point.

@greg-1-anderson
Copy link

@serundeputy ^^

@serundeputy
Copy link
Member

@greg-1-anderson does this mean it is failing on bootstrap_backdrop_configuration():

geoff@gspmbp bd-drush (master) $ devd cc all --debug
Using the Drush script found at /Users/geoff/drush-dev/drush.launcher using pcntl_exec
Cache HIT cid: 8.1-dev-commandfiles-0-4d09537459ffc6db259f884a2dfa3d77 [0.01 sec, 2.48 MB]                                                    [debug]
Cache HIT cid: 8.1-dev-commandfiles--1-9c4939192d38b3537ae973e0fd952639 [0.02 sec, 4.57 MB]                                                   [debug]
Bootstrap to phase 1. [0.09 sec, 6.92 MB]                                                                                                 [bootstrap]
Drush bootstrap phase : bootstrap_backdrop_root() [0.09 sec, 6.93 MB]                                                                     [bootstrap]
Initialized Backdrop 1.3.3 root directory at /Users/geoff/sites/bd-drush [0.1 sec, 7.33 MB]                                                  [notice]
Find command files for phase 1 (max=1) [0.1 sec, 5.13 MB]                                                                                     [debug]
Cache HIT cid: 8.1-dev-commandfiles-1-b62b0ac3379a9c394ce42a5126d02b97 [0.1 sec, 5.13 MB]                                                     [debug]
Undefined index: description command.inc:1232 [0.1 sec, 5.29 MB]                                                                             [notice]
Trying to bootstrap as far as we can. [0.13 sec, 7.47 MB]                                                                                     [debug]
Drush bootstrap phase : bootstrap_backdrop_site() [0.16 sec, 7.5 MB]                                                                      [bootstrap]
Initialized Backdrop site bd-drush at . [0.16 sec, 7.5 MB]                                                                                   [notice]
Find command files for phase 2 (max=6) [0.17 sec, 5.22 MB]                                                                                    [debug]
Drush bootstrap phase : bootstrap_backdrop_configuration() [0.17 sec, 5.22 MB]                                                            [bootstrap]


         geoff is the best.




Drush command terminated abnormally due to an unrecoverable error. [0.18 sec, 6.67 MB]

I put in some debug code and does not seem to get past bootstrap_backdrop_configuration()

@greg-1-anderson
Copy link

Well, the good news, at least, is that it appears that the Backdrop bootstrap object is being correctly selected.

@klonos
Copy link
Member

klonos commented Mar 9, 2016

geoff is the best.

😆

@greg-1-anderson
Copy link

Not getting as far as you are; when I run drush status it still just says A Backdrop installation directory could not be found

@serundeputy
Copy link
Member

@greg-1-anderson drush status is not a supported backdrop drush command yet 🐺 try

  • drush cc all
  • drush updb

thanks,
~ Geoff ('aka' da best);

@serundeputy
Copy link
Member

oh; but you got Backdrop installation could not be found; hrmm;

@greg-1-anderson
Copy link

Same result with cc all.

@ghost
Copy link

ghost commented Nov 7, 2019

As far as I know, Drush is working well now. Further issues can be opened in Drush's issue queue.

@ghost ghost closed this as completed Nov 7, 2019
@serundeputy
Copy link
Member

I guess it depends on wether this issues is about getting a client update.php working or about getting update.php to work via Pantheon dashboard; much of the conversation in this issues is about Pantheon dashboard. That being said we could reopen this issues in backdrop-ops/backdrop-pantheon if that is the intention.

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

No branches or pull requests

6 participants