fortrabbit / craft-object-storage Goto Github PK
View Code? Open in Web Editor NEWA Craft 3 plugin that integrates with fortrabbit's S3 compatible Object Storage
License: MIT License
A Craft 3 plugin that integrates with fortrabbit's S3 compatible Object Storage
License: MIT License
Hi there,
Installing Craft 3.5.8 with Object Storage 1.10 reveals this deprecation error:
Support for overriding volume configs in config/volumes.php has been deprecated. Environment variables or dependency injection should be used instead.
volumes.php looks like this for me:
<?php
$objectStorageAccess = [
'url' => "https://" . getenv('OBJECT_STORAGE_HOST'),
'endpoint' => "https://" . getenv('OBJECT_STORAGE_SERVER'),
'keyId' => '$OBJECT_STORAGE_KEY',
'secret' => '$OBJECT_STORAGE_SECRET',
'bucket' => getenv('OBJECT_STORAGE_BUCKET'),
'region' => getenv('OBJECT_STORAGE_REGION'),
];
return [
// Default volume
'objectStorageAssets' => array_merge($objectStorageAccess, [
'name' => 'Site Images',
'subfolder' => 'site_images',
]),
'objectStorageAssets2' => array_merge($objectStorageAccess, [
'name' => 'Banner Images',
'subfolder' => 'banner_images',
]),
'objectStorageAssets3' => array_merge($objectStorageAccess, [
'name' => 'Profile Pictures',
'subfolder' => 'profile_pictures',
]),
];
Does the volumes config file need to be changed to be compatible with future versions of Craft?
I have various volumes setup with fortrabbit Object Storage Volume, which has worked fine for a number of years; however, recently I have been seeing the error Could not open create the stream for "[image file]"
, in my local environment:
When I access the image (any image) in the Assets CP I can see a broken link image but when I 'Preview' or download the image I can see the image itself:
This prevents me from viewing the frontend of the site until I remove the images from that entry.
The issue isn't present on the production site, which uses the same object storage; however, it has started to happen on the staging site, which is also hosted on Fortrabbit and again uses the same object storage.
Is this error related to the fortrabbit Object Storage Volume plugin/setup
Thanks
I'm not able to install craft-object-storage 2.0.0 on Craft 3.6.5.1 via the Craft web UI. I'm hosting Craft in a Docker container and don't have access to a shell on the server. Even if I did, I don't think shell access should be required for this.
The error stems from craft-object-storage's requirement for PHP 7.3+, and Craft 3.x's "platform": { "php": "7.2.5" }
setting. This has been changed in Craft 4.x, so presumably the plugin would install, but I don't want to use a pre-release version of Craft. Shell access would allow me to run Composer manually with the --ignore-platform-reqs
argument, but this isn't an option.
Does craft-object-storage actually depend on PHP 7.3+? Can this require
version be bumped down, or is this Craft's problem?
Hi, the issue aws/aws-sdk-php#2209 is currently breaking the plugin.
I had to downgrade AWS as per https://github.com/thephpleague/flysystem-aws-s3-v3/issues/250#issuecomment-803580076 for the object storage to connect from Craft.
Thanks for the awesome plugin! Can you add/prepare craft 4.0 support?
Hello!
When installing the v1.0.3.1 of fortrabbit Object Storage Volume on Craft 3.3.17, the Asset volumes convert from "Amazon S3" to "fortrabbit Object Storage" as expected, but the field layout options get reset. The data still exists, so I'm wondering if this could be reconnected during the afterInstall event within the plugin.
Thanks for your consideration!
When setting up volumes, their settings (including passwords/secrets) get stored as plain text in the DB as well as in the Project Config YAML file (a new feature in Craft 3.1) although I am using the .ENV vars in volumes.php. I guess this is related or similar to this issue here: craftcms/cms#3531
Is there any chance that the plugin will provide environment variable support soon?
I uploaded ~4000 files to fortrabbit object storage using a GUI client.
I attempted to run php craft index-assets/one volumeHandle
to create ~4000 asset records - it stopped at 1000.
I attempted to run php craft index-assets/one volumeHandle 1001
to start at the next record (poor mans pagination) and it started with the same list of files. Same results starting at image 3000. It seems only the first 1000 images are returned no matter what.
I'm trying to install the plugin on a fresh copy of Craft v3.0.3.1, I've followed the steps listed on the README file but it throws this error:
Return value of fortrabbit\ObjectStorage\Plugin::registerRoutes() must be an instance of fortrabbit\ObjectStorage\void, none returned
I thought maybe the issue was the lack of object storage configuration on the env file but no luck, I remember having issues with the Craft 2 version of this plugin when trying to configure an Object Storage for the US region.
Here's the complete stack:
TypeError: Return value of fortrabbit\ObjectStorage\Plugin::registerRoutes() must be an instance of fortrabbit\ObjectStorage\void, none returned in /var/www/vendor/fortrabbit/craft-object-storage/src/Plugin.php:122
Stack trace:
#0 /var/www/vendor/fortrabbit/craft-object-storage/src/Plugin.php(50): fortrabbit\ObjectStorage\Plugin->registerRoutes()
#1 /var/www/vendor/yiisoft/yii2/base/BaseObject.php(109): fortrabbit\ObjectStorage\Plugin->init()
#2 /var/www/vendor/yiisoft/yii2/base/Module.php(158): yii\base\BaseObject->__construct(Array)
#3 /var/www/vendor/craftcms/cms/src/base/Plugin.php(87): yii\base\Module->__construct('fortrabbit-obje...', Object(craft\web\Application), Array)
#4 [internal function]: craft\base\Plugin->__construct('fortrabbit-obje...', Object(craft\web\Application), Array)
#5 /var/www/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass->newInstanceArgs(Array)
#6 /var/www/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('fortrabbit\\Obje...', Array, Array)
#7 /var/www/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('fortrabbit\\Obje...', Array, Array)
#8 /var/www/vendor/craftcms/cms/src/services/Plugins.php(777): yii\BaseYii::createObject(Array, Array)
#9 /var/www/vendor/craftcms/cms/src/services/Plugins.php(443): craft\services\Plugins->createPlugin('fortrabbit-obje...')
#10 /var/www/vendor/craftcms/cms/src/controllers/PluginsController.php(48): craft\services\Plugins->installPlugin('fortrabbit-obje...')
#11 [internal function]: craft\controllers\PluginsController->actionInstallPlugin()
#12 /var/www/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#13 /var/www/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#14 /var/www/vendor/craftcms/cms/src/web/Controller.php(76): yii\base\Controller->runAction('install-plugin', Array)
#15 /var/www/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('install-plugin', Array)
#16 /var/www/vendor/craftcms/cms/src/web/Application.php(267): yii\base\Module->runAction('plugins/install...', Array)
#17 /var/www/vendor/craftcms/cms/src/web/Application.php(515): craft\web\Application->runAction('plugins/install...', Array)
#18 /var/www/vendor/craftcms/cms/src/web/Application.php(251): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#19 /var/www/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#20 /var/www/web/index.php(21): yii\base\Application->run()
#21 {main}
Because I use file system for storage assets locally, and fortrabbit object storage in production, my volumes.php config is as follows:
<?php
$objectStorageAccess = [
'url' => "https://" . getenv('OBJECT_STORAGE_HOST'),
'endpoint' => "https://" . getenv('OBJECT_STORAGE_SERVER'),
'keyId' => '$OBJECT_STORAGE_KEY',
'secret' => '$OBJECT_STORAGE_SECRET',
'bucket' => getenv('OBJECT_STORAGE_BUCKET'),
'region' => getenv('OBJECT_STORAGE_REGION'),
];
return [
'*' => [
],
'dev' => [
'images' => [
'name' => 'Images',
'handle' => "images",
"type" => 'craft\volumes\Local',
"url" => "@web/images",
"settings" => [
"path" => "@webroot/images",
],
"hasUrls" => true,
],
'files' => [
'name' => 'Files',
'handle' => "files",
"type" => 'craft\volumes\Local',
"url" => "@web/files",
"settings" => [
"path" => "@webroot/files",
],
"hasUrls" => true,
],
],
'production' => [
'images' => array_merge($objectStorageAccess, [
'type' => "fortrabbit\ObjectStorage\Volume",
'name' => 'Images',
'handle' => "images",
'subfolder' => 'production/images',
]),
'files' => array_merge($objectStorageAccess, [
'type' => "fortrabbit\ObjectStorage\Volume",
'name' => 'Files',
'handle' => "files",
'subfolder' => 'production/files',
]),
],
];
However, when I select "Sync config file with settings" I get the error Setting unknown property: fortrabbit\ObjectStorage\Volume::type
I'd like to organize assets depending on an entry. For instance, I have a channel called "Locations" and i'd like each of them to have a subfolder in /locations
assets/uploads/locations/san-diego
assets/uploads/locations/san-francisco
etc
is this possible?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.