Zack Chandler
2006-Mar-08 16:00 UTC
[Rails] best practices for handling uploaded images and capistrano
Quick question: I am going to use the file_column plugin to manage uploading thumbnails. By default the images are stored in the public/ dir of the rails project. The problem I see is that when capistrano redeploys a new build and symlinks it in none of the images will be in the new public/ dir... Does anyone have a solution for this? Thanks, Zack -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060308/d6d12957/attachment-0001.html
Roberto Saccon
2006-Mar-08 16:10 UTC
[Rails] best practices for handling uploaded images and capistrano
Put the directory with the uploaded files into "shared" and just symlink it from within public to there. To automate that you can use the after_symlink filter to create your custom capistrano task. IF you take a closer look at how capistrano works, you see that the same happens with the logfile directories. On 3/8/06, Zack Chandler <zackchandler@gmail.com> wrote:> > Quick question: I am going to use the file_column plugin to manage > uploading thumbnails. By default the images are stored in the public/ dir > of the rails project. The problem I see is that when capistrano redeploys a > new build and symlinks it in none of the images will be in the new public/ > dir... Does anyone have a solution for this? > > Thanks, > Zack > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- Roberto Saccon - http://rsaccon.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060308/ea7293b5/attachment.html
bradley taylor
2006-Mar-08 18:22 UTC
[Rails] Re: best practices for handling uploaded images and capistra
Zack Chandler wrote:> Quick question: I am going to use the file_column plugin to manage > uploading > thumbnails. By default the images are stored in the public/ dir of the > rails project. The problem I see is that when capistrano redeploys a > new > build and symlinks it in none of the images will be in the new public/ > dir... Does anyone have a solution for this?This solution should work. I didn''t test it but it should be close. Set an array to hold a list of model object names that have file_columns: set :models, %w( model_one model_two ) Create the shared directories to store images for the models that use file_column: task :after_setup, :roles => [:app, :web] do models.each { |model| run "mkdir -p #{shared_path}/public/#{model}" } end Create the links: task :after_symlink, :roles => [:app, :web] do models.each { |model| run "ln -nfs #{shared_path}/public/#{model} #{current_path}/public/#{model}" } end Remember to ignore the image directories in your svn repository so you don''t add stuff from your local development machine. Good luck! Bradley Taylor ----- Rails Machine Simplified web application deployment http://railsmachine.com -- Posted via http://www.ruby-forum.com/.
Zack Chandler
2006-Mar-08 22:39 UTC
[Rails] Re: best practices for handling uploaded images and capistra
Bradley, Perfect. I''ll give this a go - thanks a ton! Zack On 3/8/06, bradley taylor <bradley@railsmachine.com> wrote:> > Zack Chandler wrote: > > Quick question: I am going to use the file_column plugin to manage > > uploading > > thumbnails. By default the images are stored in the public/ dir of the > > rails project. The problem I see is that when capistrano redeploys a > > new > > build and symlinks it in none of the images will be in the new public/ > > dir... Does anyone have a solution for this? > > This solution should work. I didn''t test it but it should be close. > > Set an array to hold a list of model object names that have > file_columns: > > set :models, %w( model_one model_two ) > > Create the shared directories to store images for the models that use > file_column: > > task :after_setup, :roles => [:app, :web] do > models.each { |model| run "mkdir -p #{shared_path}/public/#{model}" > } > end > > Create the links: > > task :after_symlink, :roles => [:app, :web] do > models.each { |model| run "ln -nfs #{shared_path}/public/#{model} > #{current_path}/public/#{model}" } > end > > Remember to ignore the image directories in your svn repository so you > don''t add stuff from your local development machine. Good luck! > > Bradley Taylor > > ----- > Rails Machine > Simplified web application deployment > http://railsmachine.com > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060308/c934a0ea/attachment.html
Zack Chandler
2006-Mar-08 22:43 UTC
[Rails] best practices for handling uploaded images and capistrano
Roberto, Thanks. I''ll take a look at the after tasks... What did you mean by "put the uploaded files into shared..." Thanks, Zack On 3/8/06, Roberto Saccon <rsaccon@gmail.com> wrote:> > Put the directory with the uploaded files into "shared" and just symlink > it from within public to there. To automate that you can use the > after_symlink filter to create your custom capistrano task. IF you take a > closer look at how capistrano works, you see that the same happens with > the logfile directories. > > On 3/8/06, Zack Chandler <zackchandler@gmail.com> wrote: > > > Quick question: I am going to use the file_column plugin to manage > uploading thumbnails. By default the images are stored in the public/ dir > of the rails project. The problem I see is that when capistrano redeploys a > new build and symlinks it in none of the images will be in the new public/ > dir... Does anyone have a solution for this? > > Thanks, > Zack > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > -- > Roberto Saccon - http://rsaccon.com > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060308/d1c41ac7/attachment-0001.html
Tom Mornini
2006-Mar-08 23:25 UTC
[Rails] best practices for handling uploaded images and capistrano
Capistrano creates a directory structure that includes: current (symlink into releases) releases shared log system photos <-- (or something similar is where Roberto was suggesting. In addition to Roberto''s spot-on advice, I''d suggest adding the symlinks into the Subversion repository, as it will then be one fewer step to think about. -- -- Tom Mornini On Mar 8, 2006, at 2:43 PM, Zack Chandler wrote:> Roberto, > Thanks. I''ll take a look at the after tasks... > What did you mean by "put the uploaded files into shared..." > > Thanks, > Zack > > On 3/8/06, Roberto Saccon <rsaccon@gmail.com> wrote: > Put the directory with the uploaded files into "shared" and just > symlink it from within public to there. To automate that you can > use the after_symlink filter to create your custom capistrano > task. IF you take a closer look at how capistrano works, you see > that the same happens with the logfile directories. > > On 3/8/06, Zack Chandler < zackchandler@gmail.com> wrote: > Quick question: I am going to use the file_column plugin to manage > uploading thumbnails. By default the images are stored in the > public/ dir of the rails project. The problem I see is that when > capistrano redeploys a new build and symlinks it in none of the > images will be in the new public/ dir... Does anyone have a > solution for this? > > Thanks, > Zack > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > -- > Roberto Saccon - http://rsaccon.com > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060308/a983301a/attachment.html
Zack Chandler
2006-Mar-09 16:46 UTC
[Rails] best practices for handling uploaded images and capistrano
Tom, Thanks for clearing that up. I''m not to the deploying step yet so I haven''t looked with depth at Capistrano yet - I just know that it will be the tool to use. It sounds like I should investigate it soon as it pertains to my immediate image upload needs :) Thanks again, Zack On 3/8/06, Tom Mornini <tmornini@infomania.com> wrote:> > Capistrano creates a directory structure that includes: > > current (symlink into releases) > releases > shared > log > system > photos <-- (or something similar is where Roberto was suggesting. > > In addition to Roberto''s spot-on advice, I''d suggest adding the > symlinks into the Subversion repository, as it will then be one > fewer step to think about. > > -- > -- Tom Mornini > > On Mar 8, 2006, at 2:43 PM, Zack Chandler wrote: > > Roberto, > Thanks. I''ll take a look at the after tasks... > What did you mean by "put the uploaded files into shared..." > > Thanks, > Zack > > On 3/8/06, Roberto Saccon <rsaccon@gmail.com> wrote: > > > > Put the directory with the uploaded files into "shared" and just symlink > > it from within public to there. To automate that you can use the > > after_symlink filter to create your custom capistrano task. IF you take > > a closer look at how capistrano works, you see that the same happens > > with the logfile directories. > > > > On 3/8/06, Zack Chandler < zackchandler@gmail.com> wrote: > > > > > Quick question: I am going to use the file_column plugin to manage > > uploading thumbnails. By default the images are stored in the public/ dir > > of the rails project. The problem I see is that when capistrano redeploys a > > new build and symlinks it in none of the images will be in the new public/ > > dir... Does anyone have a solution for this? > > > > Thanks, > > Zack > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > -- > > Roberto Saccon - http://rsaccon.com > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060309/46b27f2a/attachment.html
Possibly Parallel Threads
- Saving images in shared directory w/ Capistrano/SVN?
- Symlinks in Capistrano?
- MergeJS - Easily merge, compress, cache, and version your javascript!
- Capistrano + symlink to a shared images directory
- [ActsAsFerret] Index Directory Disappears and Not Re-created