在没有 /usr/local/bin/composer 的情况下在服务器上使用 EasyDeployBundle 托管 Symfony 4 应用程序
Hosting Symfony 4 app with EasyDeployBundle on server without /usr/local/bin/composer
对于 Symfony 4 应用程序,我从托管服务提供商那里选择了 Web Cloud 计划 OVH。
对于部署,我决定使用看起来很有前途的 EasyDeployBundle。这是我的配置文件:
<?php
use EasyCorp\Bundle\EasyDeployBundle\Deployer\DefaultDeployer;
return new class extends DefaultDeployer
{
public function configure()
{
return $this->getConfigBuilder()
->server('ovh')
->deployDir('directory/path/at/server')
->repositoryUrl('git@github.com:foo/bar.git')
->repositoryBranch('master')
;
}
}
我有 .ssh/config
个包含以下条目的文件:
Host ovh
Hostname sshcloud.foobar.hosting.ovh.net
Port 12345
User foobar
注意:所有值都是虚拟值,仅供说明之用。
当我运行:
php bin/console deploy --dry-run -v
一切顺利,但当我实际尝试部署时,出现以下错误:
The command "ssh ovh 'which /usr/local/bin/composer'" failed.
问题是我对服务器上的目录 /usr/local/bin/
没有写权限。 composer.phar
在我的主目录中,我无法将其移动到配置的目标。
是否可以告诉 EasyDeployBundle
在另一个目录中查找 composer
?
我真的应该阅读手册,尤其是当我在问题中链接它们时。
有一种方法 remoteComposerBinaryPath
接受到 composer
的自定义路径。我把方法configure
修改成这样:
public function configure()
{
return $this->getConfigBuilder()
->server('ovh')
->deployDir('directory/path/at/server')
->repositoryUrl('git@github.com:foo/bar.git')
->repositoryBranch('master')
<strong>->remoteComposerBinaryPath('composer.phar')</strong>
;
}
在服务器上,我在主文件夹中创建了 .bashrc
并添加了以下行:
export PATH=$PATH:/home/foobar
现在部署正在跨越这个障碍。
我现在有另一个问题,但至少这个问题已经解决了,也许这个答案也能帮助其他人。
对于 Symfony 4 应用程序,我从托管服务提供商那里选择了 Web Cloud 计划 OVH。
对于部署,我决定使用看起来很有前途的 EasyDeployBundle。这是我的配置文件:
<?php
use EasyCorp\Bundle\EasyDeployBundle\Deployer\DefaultDeployer;
return new class extends DefaultDeployer
{
public function configure()
{
return $this->getConfigBuilder()
->server('ovh')
->deployDir('directory/path/at/server')
->repositoryUrl('git@github.com:foo/bar.git')
->repositoryBranch('master')
;
}
}
我有 .ssh/config
个包含以下条目的文件:
Host ovh
Hostname sshcloud.foobar.hosting.ovh.net
Port 12345
User foobar
注意:所有值都是虚拟值,仅供说明之用。
当我运行:
php bin/console deploy --dry-run -v
一切顺利,但当我实际尝试部署时,出现以下错误:
The command "ssh ovh 'which /usr/local/bin/composer'" failed.
问题是我对服务器上的目录 /usr/local/bin/
没有写权限。 composer.phar
在我的主目录中,我无法将其移动到配置的目标。
是否可以告诉 EasyDeployBundle
在另一个目录中查找 composer
?
我真的应该阅读手册,尤其是当我在问题中链接它们时。
有一种方法 remoteComposerBinaryPath
接受到 composer
的自定义路径。我把方法configure
修改成这样:
public function configure()
{
return $this->getConfigBuilder()
->server('ovh')
->deployDir('directory/path/at/server')
->repositoryUrl('git@github.com:foo/bar.git')
->repositoryBranch('master')
<strong>->remoteComposerBinaryPath('composer.phar')</strong>
;
}
在服务器上,我在主文件夹中创建了 .bashrc
并添加了以下行:
export PATH=$PATH:/home/foobar
现在部署正在跨越这个障碍。
我现在有另一个问题,但至少这个问题已经解决了,也许这个答案也能帮助其他人。