Closed narration-sd closed 7 years ago
This happens if mysqldump
(or pg_dump
if using PostgreSQL) isn’t available, which Craft 3 relies on for creating DB backups.
If it can’t be added, then you can open up config/general.php
and add this:
'backupCommand' => false,
Ok, that makes good sense, and thanks as always for being right there on a point.
What I should do is add mysqldump to the Docker container for php – not there consequence of slim provisioning.
Will close when I get that done – must be later.
And because it isn't documented yet, here's the full docblock for that config setting:
/**
* Craft will use the command line libraries `pg_dump` and `mysqldump` for backing up a database
* by default. It assumes that those libraries are in the $PATH variable for the user the web server is
* running as.
*
* If you want to use some other library, or want to specify an absolute path to them,
* or want to specify different parameters than the default, or you want to implement some other backup
* solution, you can override that behavior here.
*
* There are several tokens you can use that Craft will swap out at runtime:
*
* * `{path}` - Swapped with the dynamically generated backup file path.
* * `{port}` - Swapped with the current database port.
* * `{server}` - Swapped with the current database host name.
* * `{user}` - Swapped with the user to connect to the database.
* * `{database}` - Swapped with the current database name.
* * `{schema}` - Swapped with the current database schema (if any).
*
* This can also be set to `false` to disable database backups completely.
*/
great stuff, thanks, Brad.
Not sure why this wasn't clear in the logs anyway as a cause, just a seeming blind web app fail?
But when you get to it, among the thousands...or if I missed the requisite line...
C.
Ok, turned out this just needed adding mariadb-client package to the php-fpm container docker-compose file - built and up in seconds, and immediately worked with the update database dump.
The update itself killed my plugins, some triviata there no doubt also easy to find.
I do have one question, though -- couldn't work out how you get the database user/password added into the sqldump command, which is missing this as it's built.
Closed this was already by Brandon, so I'll email this query, as don't think you'll see it.
...and the plugins problem was due to the Windows junction => link in vendor being replicated exactly as a soft link from the dev machine, which isn't correct.
What's needed is an rsync -L, which translates to an ansible synchronize copy_links: yes
All done, beta 3 on a Dockered DO droplet as well.
@narration-sd if you leave the backupCommand set to null (default behavior), then you can see the default parameters Craft will pass into mysqldump here: https://github.com/craftcms/cms/blob/develop/src/db/mysql/Schema.php#L138
Credential are passed in through --defaults-extra-file
, which creates a tmp file using the credentials you supplied to Craft to connect to the database.
Ah, slipped over that first parameter when looked at it -- eyes too quick. Makes sense and closure.
Thanks, Brad, as ever, and great to know you look at comments after issue closed -- seems most close out even their notification. But this is P&T...
Description
Couldn’t backup the database. How would you like to proceed? --- nice and appreciated message here Occurs on DO/Docker droplet, while update works fine on Vagrant vm
Steps to reproduce
Additional info
phperrors.log has PHP Notice: Trying to get property of non-object in /usr/share/nginx/mdo/vendor/craftcms/cms/src/web/View.php on line 514
folder perms look right, made 777 to check
considering that php line source, there are sites; order 1 in craft_sites is en-US, worked before, including original beta to beta.2
web.log has: 2017-02-07 13:14:30 [63.143.42.243][-][ratr26ddernj2ukt7ngup2k6j5][profile end][yii\db\Command::query] SELECT * FROM
craft_info
2017-02-07 13:14:30 [63.143.42.243][-][ratr26ddernj2ukt7ngup2k6j5][error][yii\web\HttpException:503] craft\web\ServiceUnavailableHttpException in /usr/share/nginx/mdo/vendor/craftcms/cms/src/web/Application.php:588 Stack trace:0 /usr/share/nginx/mdo/vendor/craftcms/cms/src/web/Application.php(159): craft\web\Application->_processUpdateLogic(Object(craft\web\Request))
1 /usr/share/nginx/mdo/vendor/yiisoft/yii2/base/Application.php(380): craft\web\Application->handleRequest(Object(craft\web\Request))
2 /usr/share/nginx/mdo/public/index.php(10): yii\base\Application->run()
3 {main}
2017-02-07 13:14:30 [63.143.42.243][-][ratr26ddernj2ukt7ngup2k6j5][profile begin][craft\web\View::renderTemplate] 503 2017-02-07 13:14:30 [63.143.42.243][-][ratr26ddernj2ukt7ngup2k6j5][profile begin][craft\web\twig\Template::display] 503 2017-02-07 13:14:30 [63.143.42.243][-][ratr26ddernj2ukt7ngup2k6j5][profile begin][craft\web\twig\Template::display] _layouts/message 2017-02-07 13:14:30 [63.143.42.243][-][ratr26ddernj2ukt7ngup2k6j5][profile begin][craft\web\twig\Template::display] _layouts/base
Craft version: currently beta.2
PHP version: 7.0.12, as worked with beta.2
Database driver & version: mysql
Plugins & versions: couple of simple local Twig extension plugins; work fine in beta.2