简体   繁体   English

AWS S3红宝石AWS-SDK文件传输器使用关键云铸造

[英]aws s3 ruby aws-sdk file transer using pivotal cloud foundry

Help: How do you transfer a PDF File from S3 to a local desktop file directory when the rails app is deployed in Pivotal Cloud Foundry? 帮助:将Rails应用程序部署在Pivotal Cloud Foundry中后,如何将PDF文件从S3传输到本地桌面文件目录? Using ruby and the aws-sdk to download a PDF File from S3 to local client machine directory. 使用ruby和aws-sdk将PDF文件从S3下载到本地客户端计算机目录。

get_object(bucket: @s3_bucket, key: file_name, response_target: "#{Rails.root}/Downloads/#{file_name}")

The above ruby code works. 上面的ruby代码有效。 The file appears inside the Download Directory on the Mac. 该文件显示在Mac上的“下载目录”内。 Problem: deploying the rails app into Pivotal Clown Foundry breaks the placement of the PDF File and where it gets stored. 问题:将Rails应用程序部署到Pivotal Clown Foundry中会破坏PDF文件的位置及其存储位置。 It seems as if get_object returns the PDF to the Cloud Foundry Container in directory in "/home/vcap/app" rather than getting pulled down to the user's remote computer file directory. 似乎get_object将PDF返回到“ / home / vcap / app”目录中的Cloud Foundry容器,而不是下拉至用户的远程计算机文件目录。 But that's not available to the person to open up the file. 但这对打开文件的人不可用。

Pivotal Cloud Foundry will not download any files onto your local work machine by default. 默认情况下,Pivotal Cloud Foundry不会将任何文件下载到本地工作计算机上。

When code is run on Pivotal Cloud Foundry the code only has access to the filesystem in the app instance (container). 在Pivotal Cloud Foundry上运行代码时,该代码只能访问应用程序实例(容器)中的文件系统。

If you wish to retrieve a file from a app instance you may SCP it from the Application Instance. 如果您希望从应用程序实例中检索文件,则可以从应用程序实例中对其进行SCP提取。 Here are the docs on how to do that 这是有关如何做到这一点的文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM