Deployer: Question / Bug shared_dirs (recipe/deploy/shared.php)

Created on 9 Jan 2018  路  1Comment  路  Source: deployphp/deployer

| Q | A
| ----------------- | ---
| Issue Type | Bug, Question
| Deployer Version | 6.0.5
| Local Machine OS | MAC
| Remote Machine OS | Debian (PHP 7.1)

Description

I just want to set /image folder as shared directory, but I am getting following error:

In Client.php line 96:

  [Deployer\Exception\RuntimeException (1)]
  The command "ln -nfs --relative /var/www/deployments/project.com/shared/image/ /var/www/deployments/project.com/releases/1/image/" failed.

  Exit Code: 1 (General error)

  Host Name: project.com

  ================
  ln: target '/var/www/deployments/project.com/releases/1/image/' is not a directory: No such file or directory

When I check the code of recipe/deploy/shared.php, shared directory is removed from source here and when creating the directory it is using parent directory of shared_dir here and here. It means, it is removing /var/www/deployments/project.com/releases/1/image/ and creating /var/www/deployments/project.com/releases/1/ which is already exists and root folder. So when it tries to link it fails.

I fixed this error by removing dirname from here and here.

PS: I was using deployer for my Laravel projects successfully with recipe/laravel.php, I don't understand how it was working so far...

Steps to reproduce

It is a simple OpenCart installation. You can test it with a fresh OpenCart installation or any php project should produce this error.

Content of deploy.php

require 'recipe/common.php';

set('shared_files', ['image/']);
...

Output log

It is in Description.

Most helpful comment

Ok, I need to remove trailing slash from path 'image/' -> 'image'. Maybe a rtrim is needed here.

>All comments

Ok, I need to remove trailing slash from path 'image/' -> 'image'. Maybe a rtrim is needed here.

Was this page helpful?
0 / 5 - 0 ratings