We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum
Moving existing resources to an Amazon S3 bucket
I'm having trouble trying to serve all images from an Amazon S3 bucket ('assets-cdn') in Runway 3; I've copied all images from my local resources folder to an Amazon S3 bucket and set this as the default bucket in config.php - these were initially uploaded to the default bucket prior to setting up the S3 bucket. I've also set the PERCH_RESPATH to the S3 cloudfront web path, i.e.
define('PERCH_RESPATH', 'https://cdn.hiddenireland.com'); define('PERCH_DEFAULT_BUCKET','assets-cdn');
All appears fine until I want to edit an existing image: when I edit a blog post in Runway, the existing image loads up fine and is being served from the Cloudfront CDN web path as expected. However, when I select and save a new image (from the default bucket because nothing appears under the new 'assets-cdn' bucket), the image is missing from the post as all the versions of the image are uploading to the local resources folder as opposed to the 'assets-cdn' S3 bucket.
Only if I choose an image that was uploaded to the 'assets-cdn' bucket, do versions of the image get saved to the correct location, i.e. to the S3 bucket. So to make all images in the assets panel to appear under the 'assets-cdn' bucket so that they are saved in the right location, can I just update resourceBucket column in the perch2_resources? i.e. run the following query on the db:
UPDATE perch2_resources SET resourceBucket='assets-cdn' WHERE resourceBucket='default'
Does this look safe enough? Also, do I need to add the buckets="assets-cdn" attribute to all the image tags in my templates or does setting the default bucket to 'assets-cdn' in config.php cover this?
Big thanks! A
Summary information Perch Runway: 3.0.10, PHP: 5.6.31, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO Server OS: Darwin, apache2handler Installed apps: content (3.0.10), assets (3.0.10), categories (3.0.10), perch_blog (5.6.1), perch_forms (1.9) App runtimes: <?php $apps_list = [ 'perch_blog', 'perch_forms', ]; PERCH_LOGINPATH: /perch PERCH_PATH: /Users/adam/Sites/hiddenireland.com/site/perch PERCH_CORE: /Users/adam/Sites/hiddenireland.com/site/perch/core PERCH_RESFILEPATH: /Users/adam/Sites/hiddenireland.com/site/perch/resources Image manipulation: GD PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M F1: 3b606135b33e6a102526838f4152a807 Resource folder writeable: Yes HTTP_HOST: hiddenireland.dev DOCUMENT_ROOT: /Users/adam/Sites/hiddenireland.com/site REQUEST_URI: /perch/core/settings/diagnostics/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Want to reply to this thread?Login with Perch