Reputation: 629
I have a rails app and I'm using Capistrano as the deploy gem.
My deploy.rb file has this:
set :application, 'appname'
set :repo_url, '[email protected]:someone/some_app.git'
set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml', 'secrets.json')
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads', 'public/assets/')
set :rvm_ruby_version, '2.2.2@deploy'
The problem is that not all of my assets are inside the app folder, some are in the public folder since I'm using a lot of template code. Inside the public/assets folder are a lot of sub directories necessary for the app to run. Putting 'public/assets' in the linked_dirs option only symlinks that specific folder, and manually writing all sub directories inside it seems like a terrible solution. How do I tell Capistrano to include everything (even sub directories) inside a folder in the deploy?
Upvotes: 0
Views: 229
Reputation: 2653
Good question. I see a couple of possibilities, all ways to work around the core issue that you must define every single specific folder.
public/assets
to be shared. The downside of not sharing them is that when you deploy a new version of the app with changed assets, the old assets disappear. For a public facing app, this may be a problem. If it is an internal app, or if you have an Akamai/Cloudflare style CDN in front of it caching the old files, it may not be.public/static_assets
. Those will also be accessible.public/assets
.There are probably other ways, but hopefully this either offers a solution or gives you a starting point from which to go.
Upvotes: 1