因此,我尝试设置 Wp-Deploy 大约 3 周了 :(
我有一个用于暂存的 digitalocean droplet,最终能够让我的本地环境将文件部署到服务器,但是,我无法使数据库命令正常工作。当我尝试备份数据库时,我得到了以下输出
dixon@Sphinx /var/www/html $ bundle exec cap staging db:backup
00:00 db:backup_name
01 mkdir -p /var/www/vhosts/thedixonbuilds.com/httpdocs/shared/db_backups
✔ 01 root@<ip address> 1.748s
02 wp db export - | gzip > /var/www/vhosts/thedixonbuilds.com/httpdocs/shared/db_backups/20190210165609.sql.gz
02 /usr/bin/env:
02 ‘wp’
02 : No such file or directory
02
✔ 02 root@<ip address> 0.244s
Downloading db_backups/20190210165609.sql.gz 100.0%
03 rm /var/www/vhosts/thedixonbuilds.com/httpdocs/shared/db_backups/20190210165609.sql.gz
✔ 03 root@<ip address> 0.228s
当我尝试运行 db:push 时
00:00 db:backup_name
01 mkdir -p /var/www/vhosts/thedixonbuilds.com/httpdocs/shared/db_backups
✔ 01 root@<ip address> 1.399s
02 mkdir -p db_backups
✔ 02 dixon@localhost 0.003s
03 wp db export - | gzip > db_backups/20190210170146.sql.gz
✔ 03 dixon@localhost 0.271s
Uploading db_backups/20190210170146.sql.gz 100.0%
04 gzip -c -d /var/www/vhosts/thedixonbuilds.com/httpdocs/shared/db_backups/20190210170146.sql.gz | wp db import -
04 bash: wp: command not found
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: gzip exit status: 127
gzip stdout: Nothing written
gzip stderr: bash: wp: command not found
Caused by:
SSHKit::Command::Failed: gzip exit status: 127
gzip stdout: Nothing written
gzip stderr: bash: wp: command not found
/var/www/html/lib/capistrano/tasks/db.rake:148:in `block (4 levels) in <top (required)>'
/var/www/html/lib/capistrano/tasks/db.rake:147:in `block (3 levels) in <top (required)>'
Tasks: TOP => db:push
(See full trace by running task with --trace)
我不确定 capistrano 如何实现数据库操作,也不清楚 usr/bin/env 应该包含什么。有人能给我一些线索吗?
谢谢!
答案1
这两个操作都因相同的原因而失败。你没看到错误吗?
他们来了:
02 /usr/bin/env:
02 ‘wp’
02 : No such file or directory
和:
gzip stderr: bash: wp: command not found
两次,你的脚本都试图运行wp
命令,但它未安装或不在您的 PATH 中。您需要先安装它,然后确保您的 PATH 设置正确。