Linked Folders produces strange results

Skip to first unread message

Vincent G

Dec 12, 2017, 2:16:13 PM12/12/17
to Capistrano
Ruby ruby 2.0.0p648
Capistrano  3.10.1 (Rake Version: 12.3.0)
Rake / Rails / etc
Working on.... Mac OS X
Deploying to... CentOS


I am trying to understand how the linked_dirs work. i have the following as an example

append :linked_dirs, "storage", "node_modules", "vendor", "public"

the above causes a few issues:

1. if i keep the "public" in the linked dirs, on initial deploy the public folder is missing a lot of files that are present in the git repository. For example, without the "public" listed in linked_dirs i get the following tree inside current/public:

[git@web003 current]$ ls -lh public/
-x  3 git git 4.0K Dec 12 16:48 custom
-rw-rw-r--  1 git git    0 Dec 12 16:48 favicon.ico
-x  2 git git 4.0K Dec 12 16:48 fonts
-x  4 git git 4.0K Dec 12 16:48 rsvp
-x  2 git git 4.0K Dec 12 16:48 images
-rw-rw-r--  1 git git 2.7K Dec 12 16:48 index.php
-rw-rw-r--  1 git git 1.2K Dec 12 16:48 manifest.json
-x  8 git git 4.0K Dec 12 16:48 maverick
-rw-rw-r--  1 git git   26 Dec 12 18:43 mix-manifest.json
-x 15 git git 4.0K Dec 12 18:43 modules
-rw-rw-r--  1 git git   24 Dec 12 16:48 robots.txt
-rw-rw-r--  1 git git  781 Dec 12 16:48 serviceWorker.js
-xr-x  4 git git 4.0K Dec 12 18:43 vendor
-rw-rw-r--  1 git git  914 Dec 12 16:48 web.config

With "public" set in linked_dirs i have the following directory tree in current/public

[git@web003 public]$ ls -lh
-rw-rw-r--  1 git git   26 Dec 12 17:16 mix-manifest.json
-x 15 git git 4.0K Dec 12 17:16 modules
-xr-x  4 git git 4.0K Dec 12 17:16 vendor

There is a lot missing and i am not entirely sure why. Also mix_manifest.js is a file that is generated and updated when we run some compile scripts, i'd like that to be shared but it seems i can't add it to linked_files since on initial deploy it does not exists and it returns an error:

00:02 deploy:check:linked_files
      ERROR linked file /var/www/xxx/shared/public/mix-manifest.json does not exist on xxx

2. This is similar to the above just with node_modules

If we share node_modules when trying to run npm run... it seems like it can't find certain files for example

npm run w-production // shortcut for:

cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--env.mixfile=build/w.mix" "--env.scss=1"

if the node_modules is not shared that works just fine. if it's shared it just compiles nothing, as it seems it can't really find the appropriate files since the node_modules points to a symbolic link.

Any idea what can be done in the scenarios above?

Thank You.

Lee Hambley

Dec 12, 2017, 2:35:13 PM12/12/17
to Capistrano
Hi Vincent, linked_dirs links directories from the shared/ path into the current release. This means as a rule that your public/ from Git will be replaced by one in shared/. I hope that clears up and misunderstanding from linked_dirs.

What were you hoping to achieve?

You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web, visit
For more options, visit
Reply all
Reply to author
0 new messages