Roots Discourse

Bedrock uploads directory symlink issue

I am deploying a Bedrock website using Capistrano.

In my config/deploy.rb I have the following code:

set :linked_files, fetch(:linked_files, []).push('.env')
set :linked_dirs, fetch(:linked_dirs, []).push('web/app/uploads')

The thing is I am using Elementor on my site, it generates an important CSS file in web/app/uploads/elementor.

To include this in the deployment I added the following in my .gitignore file.


The thing is the CSS only gets deployed if I remove set :linked_dirs, fetch(:linked_dirs, []).push('web/app/uploads'), but the problem is if I remove this normal file upload will not work.

But if I include it, file upload works but not the Elementor CSS file.

What do you think I can do to make normal upload work and Elementor CSS gets deployed?

I did it by adding some commands in my deploy.rb

I added before 'deploy:symlink:shared', 'deploy:copy_elementor_files', this will call copy_elementor_files before making the symlink of uploads directory.

Then in the copy_elementor_files

namespace :deploy do
  desc 'Copy elementor files'
  task :copy_elementor_files do
    on roles(:app) do
      execute "cp -R #{fetch(:release_path)}/web/app/uploads/elementor #{shared_path}/web/app/uploads"

This will copy elementor css files from latest release to shared folder.