简体   繁体   English

适用于Google Cloud Storage的PHP流包装器

[英]PHP stream wrapper for Google Cloud Storage

I am in a process of setting up Prestashop installation in a cluster of 3 GCE instances, managed by Kubernetes. 我正在由Kubernetes管理的3个GCE实例的群集中设置Prestashop安装。 I use Cloud SQL as DB and all seems to be running well, except, of course the images part, since prestashop in each pod uploads and shows images to/from it's local filesystem. 我使用Cloud SQL作为数据库,并且除图像部分外,其他一切似乎都运行良好,因为每个pod中的prestashop会在其本地文件系统上载图像并向其显示图像。

In App Engine I cloud use stream_context_set_default() and that would allow me to use "gs://mybucket" as a regular path. 在App Engine中,我使用cloud_stream_context_set_default(),这将允许我将“ gs:// mybucket”用作常规路径。 Is there a way to do that in Compute Engine? 有没有办法在Compute Engine中做到这一点? If it is possible, making Prestashop use Cloud Storage bucket can be done in 2 lines of code. 如果可能的话,可以通过两行代码来使Prestashop使用Cloud Storage存储桶。

There is a StreamWrapper for Amazon S3 service that does exactly what I need: http://hiousi.tumblr.com/post/94824087894/prestashop-images-hosted-on-amazon-s3 But I would like to use Cloud Storage. 有一个Amazon S3服务的StreamWrapper完全可以满足我的需求: http : //hiousi.tumblr.com/post/94824087894/prestashop-images-hosted-on-amazon-s3但我想使用Cloud Storage。

The source code for the stream wrapper can be downloaded at https://github.com/GoogleCloudPlatform/appengine-php-sdk/tree/master/google/appengine/ext/cloud_storage_streams . 可以从https://github.com/GoogleCloudPlatform/appengine-php-sdk/tree/master/google/appengine/ext/cloud_storage_streams下载流包装器的源代码。

It has a couple of dependencies on other GAE APIs such as App Identity & Urlfetch. 它与其他GAE API(例如App Identity&Urlfetch)有一些依赖关系。 They may need to be stubbed out or replaced by equivalent services on GCE. 它们可能需要在GCE上插入或替换为等效的服务。

i have created a PHP StreamWrapper for Google Compute Engine, if you're still interested. 如果您仍然感兴趣,我已经为Google Compute Engine创建了一个PHP StreamWrapper。 Here is the link to my adapted version. 这是我改编版的链接。 https://github.com/jimyaghi/GCECloudStorageStreamWrapper https://github.com/jimyaghi/GCECloudStorageStreamWrapper

Sorry it's not more friendly, but it's a good useful bit of work. 抱歉,它并不友好,但这是一项非常有用的工作。 i'm using it and it works great. 我正在使用它,效果很好。

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

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