Skip to content

{{ project_dir }} resolves to the local project directory in runLocal() #101

Description

@jjsmclaughlin

In DefaultDeployer, {{ project_dir }} resolves to the local project directory when it is used inside runLocal(). This may be intended behaviour, but it makes it difficult to copy things to the release directory.

Consider the case of a public/build directory generated by Webpack Encore. I cannot install Webpack Encore on the production server, so I need to copy my public/build folder into the deployment from my local machine. So within beforeFinishingDeploy() I want to do something like:

$this->runLocal('rsync -r public/build/ me@remote:{{ project_dir }}/public/build');

But unfortunately in this case, {{ project_dir }} resolves to the local path of my project, making a nonsense command.

Could we have a {{ remote_project_dir }} available from runLocal()?

Even better, {{ remote_web_dir }}, {{ remote_bin_dir }} etc?

Perhaps you think that a sane deployment should not be copying things manually from the local machine to the server like this. But in that case I think you need to make DefaultDeployer support Webpack Encore managed assets, because this is a recommended solution now in the Symfony docs.

Thank you for considering this. I really like easy-deploy-bundle. It's a great relief not to have to use Capistrano any more.

Activity

  1. tlorens commented on Jan 7, 2020

    @tlorens

    I have the very same need.

  2. TAR5 commented on Apr 20, 2021

    @TAR5

    Heres an easy way to get the remote project dir:

    $serverRepository = $this->getConfig(Option::servers);
    $servers = $serverRepository->findAll();
    
    foreach ($servers as $server) {
        $remoteProjectDir = $server->get(\EasyCorp\Bundle\EasyDeployBundle\Server\Property::project_dir);
        
        // $remoteProjectDir points to the release folder.
    }
  3. fd6130 commented on Nov 12, 2021

    @fd6130

    Heres an easy way to get the remote project dir:

    $serverRepository = $this->getConfig(Option::servers);
    $servers = $serverRepository->findAll();
    
    foreach ($servers as $server) {
        $remoteProjectDir = $server->get(\EasyCorp\Bundle\EasyDeployBundle\Server\Property::project_dir);
        
        // $remoteProjectDir points to the release folder.
    }
    

    Hi, where should we apply this code to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions