Noob Capistrano question about saving download directories

In response to this blog post: http://www.simonecarletti.com/blog/2009/02/capistrano-uploads-folder/

I have three questions:

  • Can anyone confirm if the recipe works?
  • Where and how can I place this recipe?
  • I have two folders to survive in each version: / products and / public / images / site_images, what recipe should I follow to achieve this?

I have almost no experience with Capistrano and all I have been able to do so far is just deploying the lid and deploying the lid: cold, so it would be helpful to evaluate a script that I could just copy-paste.

thanks

+2


a source to share


2 answers


This is how I did it, at the end, using the manual approach

Hope this helps all early programmers:



1. cd to releases to find out folder to synchronize
cd /home/yourapp/rails_apps/main/releases/

2. find the folder to sync, one level above last folder shown with ls
REMEMBER!
With ls, the folder list goes as follows:
folder1    folder5
folder2    folder6
folder3    folder7
folder4    folder8

So in this case, copy from folder7

3. copy the folders
To copy images
rsync -av --stats --progress /home/yourapp/rails_apps/main/releases/20100517183232/public/images/ /home/yourapp/rails_apps/main/current/public/images/

To copy products
rsync -av --stats --progress /home/yourapp/rails_apps/main/releases/20100517183232/products/ /home/yourapp/rails_apps/main/current/products/

      

I wonder if they can be automated in some way?

0


a source


  • Yes, I am currently using it in my projects.

  • You can just add the code to the end of the deploy.rb file

  • If the products are outside the public folder, you cannot link them from the public side. In addition, the post / images are expected to be checked out in your SCM repository.



The recipe assumes you have a complete new folder accessible from the open side to accommodate user-uploaded documents. The folder should be excluded from your SCM configuration to prevent accidental commits. You should avoid using shared / images folder for external uploads, or you will have a lot of headaches trying to keep your SCM managed development configuration in sync with public state.

+3


a source







All Articles