How do I upload and sync my static image assets with linked_dirs?

In your screencast you mention the media directory. In the project that I have, I have a shared directory that is structure at the root level like this:

└── content
└── uploads

In my content directory I have symlink to this directory:
content/uploads ~> shared/content/uploads

In my deploy.rb I have a setting like this:

set :linked_dirs, %w{shared}

But this does not work. Nothing gets uploaded and I get the following debug output when doing cap staging deploy:

DEBUG [c0a54454] Command: [ -L /var/www/php/dladv/releases/20140208034339/shared ]
DEBUG [c0a54454] Finished in 0.638 seconds with exit status 1 (failed).
DEBUG [e6f85766] Running /usr/bin/env [ -d /var/www/php/dladv/releases/20140208034339/shared ] on
DEBUG [e6f85766] Command: [ -d /var/www/php/dladv/releases/20140208034339/shared ]
DEBUG [e6f85766] Finished in 0.639 seconds with exit status 1 (failed).

Please help!

I tried looking at this answer but it did not help because I couldn’t understand the solution:

I’m not exactly sure what the issue is, but do you need to have your setup like that? With Bedrock, we don’t even suggest changing the uploads directory anymore. app/uploads is the default and good enough in my opinion. This also avoids any symlinks in your actual repo. Which if you do have some, might be part of the problem.

Basically, my first suggestion is to make your setup simpler if its possible. I don’t know if it would actually solve the problem, but it can’t hurt and should make things easier in the long run.

Ok it makes sense to simplify. Just help me out a bit in understanding how I can do this please. Here is the structure at my root folder called wp:

– config
– content
– shared
– wp

Now the wp inside the wp root folder is a git submodule which contains the wordpress core. If I rename my shared folder where all my images assets are to uploads as you suggest, how do I tell wordpress to find the uploads directory there?

Ot should I instead of using the content/uploads symlink, just delete the symlink and move the actual uploads folder there? Is that what you are trying to tell me?

Also where exactly is the media folder you speak of in your screencast?

If your WP install is setup correctly (which I assume it is because it’s working), you don’t need to configure anything. By default it will be WP_CONTENT_DIR . '/uploads' which for you is content/uploads. So yeah, you’d delete the symlink and just move the folder there. And WP should just put new uploads in there (you may need to change old custom settings you have back to defaults).

The media folder in the screencast would be in the root of your project. So in your case, /wp/media. I was basically trying to keep Roots’ defauls in that screencast which at the time was /media but now we’ve realized it’s just simpler to keep the default especially in a Bedrock style setup.

Oh - roots structure has changed - so that is what confused me so much! I was hunting for this mythical media folder.

I am going to try just moving my folder and remove all symlinks so I there is no need for the linked_dirs configuration correct?

linked_dirs is still needed. But with the simpler setup Capistrano will manage the symlinking on the server for you, you don’t need any in your repo.

Cap has its own shared folder for linked_dirs and linked_files which need to live across deploys (such as uploads).

Yours would be:

set :linked_dirs, %w{content/uploads}