Reputation: 2958
In response to this blog post: http://www.simonecarletti.com/blog/2009/02/capistrano-uploads-folder/
I have three questions:
I have near zero experience with Capistrano and all I have been able to do so far was just cap deploy and cap deploy:cold, so a script which I could just copy-paste would be greatly appreciated.
Thank you
Upvotes: 2
Views: 1077
Reputation: 2958
This is how I did it in the end, by manual approach
I hope this will help all the early coders out there:
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/
Wondering if they could be automated somehow?
Upvotes: 0
Reputation: 176412
Yes, I'm currently using it in my own projects.
You can just append the code at the end of your deploy.rb file
If products is outside the public folder, you can't link it from the public side. Also, public/images is already expected to be checked into your SCM repository
The recipe assumes you want to have a complete new folder available from public side to host the user uploaded documents. The folder should be excluded from your SCM configuration to prevent accidental commits. You should avoid to use the public/images folder for external uploaded files or you will have many headaches trying to synchronize your development configuration, managed by a SCM, with the public state.
Upvotes: 3