Rails/Capistrano tool to deploy static assets to Rackspace Cloud Files or Amazon Cloud Front?

我与影子孤独终老i 提交于 2020-01-23 03:43:04

问题


Is anyone aware of a tool that will automatically deploy a Rails app static assets to Rackspace Cloud Files or Amazon Cloud Front?

In my perfect world capistrano would automatically upload everything in javascripts, stylesheets, and images then override the default image_tag and script_tags to route to the appropriate CDN path.

It would be great if the deploy task created a new container with each deploy like cap creates a new release directory, or maybe it should use the same containers and keep a cached file with the hashes of all the deployed assets and only deploy new assets to take advantage of long CDN TTLs.


回答1:


I'm not aware of anything, but you could probably script something to do this without too much work.

The Fog gem provides an agnostic API for pushing files to Amazon S3 and Rackspace Cloud files, among others.




回答2:


I haven't done it myself yet, but I think it can be done with rsync as a capistrano task.

Have look at this.

http://railscasts.com/episodes/133-capistrano-tasks




回答3:


I have previously used Rackspace Cloud Files CloudFuse for Linux http://www.rackspace.com/knowledge_center/article/mounting-rackspace-cloud-files-to-linux-using-cloudfuse.

It allows you to mount your cloud files containers so that they can be written using standard file system operations, which makes for simple scripting in your deploy scripts. You'll obviously want to take care of keeping the machine that does this secure.



来源:https://stackoverflow.com/questions/6379380/rails-capistrano-tool-to-deploy-static-assets-to-rackspace-cloud-files-or-amazon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!