Forum

Thread tagged as: Runway

Memstore Bucket

Hi,

Could you post example code of a Memset Memstore bucket?

I've tried setting this up, but I'm getting errors and I'm unable to upload assets.

I think I may have the file_path wrong.

Have it working with Rackspace Cloud Files fine.

Thanks,

Rob

Robert Chambers

Robert Chambers 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Hi Robert

please post the steps you have taken plus your Diagnostics Report.

Hi Rachel,

I have the following in runway.php (I've changed the actual password):

'openstack_object_storage' => [

            'username'     => 'msmarkeai2.admin',
            'password'     => 'password',
            'tenantname'   => 'msmarkeai2',
            'endpoint'     => 'https://auth.storage.memset.com',
            'region'       => 'reading',
            'handler'      => 'PerchOpenStack_ResourceBucket',
            'handler_path' => PERCH_PATH.'/addons/apps/perch_openstack/PerchOpenStack_ResourceBucket.class.php',

        ],

And have the following in buckets.php:

return [
   'resources' => [
       'type'      => 'openstack_object_storage',
        'web_path'  => 'https://lof-resources.d89507d4.cdn.memsites.com',
        'file_path' => 'lof-resources',
    ],
]

When I try to upload an image to this bucket it appears briefly and then disappears - with no error message. Nothing is added to the Memstore container.

Looking at the PHP error log, I get:

[15-Nov-2015 14:52:26 UTC] PHP Warning:  Failed to init object storage: A HTTP error occurred
[Status] https://auth.storage.memset.com/v2.0/tokens (403)
[URL] FORBIDDEN
[Message] 
 in /Users/robert/Sites/looking-out-foundation/cms/addons/apps/perch_openstack/lib/openstack/openstack-sdk-php/src/OpenStack/ObjectStore/v1/Resource/StreamWrapper.php on line 785
[15-Nov-2015 14:52:26 UTC] PHP Warning:  move_uploaded_file(swift://lof-resources/20141018110208.jpg): failed to open stream: "OpenStack\ObjectStore\v1\Resource\StreamWrapper::stream_open" call failed in /Users/robert/Sites/looking-out-foundation/cms/core/lib/PerchUtil.class.php on line 738
[15-Nov-2015 14:52:26 UTC] PHP Warning:  move_uploaded_file(): Unable to move '/Applications/MAMP/tmp/php/phpQKRRYs' to 'swift://lof-resources/20141018110208.jpg' in /Users/robert/Sites/looking-out-foundation/cms/core/lib/PerchUtil.class.php on line 738
[15-Nov-2015 14:52:26 UTC] PHP Warning:  Failed to init object storage: A HTTP error occurred
[Status] https://auth.storage.memset.com/v2.0/tokens (403)
[URL] FORBIDDEN
[Message] 
 in /Users/robert/Sites/looking-out-foundation/cms/addons/apps/perch_openstack/lib/openstack/openstack-sdk-php/src/OpenStack/ObjectStore/v1/Resource/StreamWrapper.php on line 785
[15-Nov-2015 14:52:26 UTC] PHP Warning:  getimagesize(swift://lof-resources/20141018110208.jpg): failed to open stream: "OpenStack\ObjectStore\v1\Resource\StreamWrapper::stream_open" call failed in /Users/robert/Sites/looking-out-foundation/cms/core/lib/PerchImage.class.php on line 308
[15-Nov-2015 14:52:26 UTC] PHP Warning:  Failed to init object storage: A HTTP error occurred
[Status] https://auth.storage.memset.com/v2.0/tokens (403)
[URL] FORBIDDEN
[Message] 
 in /Users/robert/Sites/looking-out-foundation/cms/addons/apps/perch_openstack/lib/openstack/openstack-sdk-php/src/OpenStack/ObjectStore/v1/Resource/StreamWrapper.php on line 785
[15-Nov-2015 14:52:26 UTC] PHP Warning:  finfo_file(swift://lof-resources/20141018110208.jpg): failed to open stream: "OpenStack\ObjectStore\v1\Resource\StreamWrapper::stream_open" call failed in /Users/robert/Sites/looking-out-foundation/cms/core/lib/PerchImage.class.php on line 402
[15-Nov-2015 14:52:26 UTC] PHP Notice:  Undefined offset: 0 in /Users/robert/Sites/looking-out-foundation/cms/core/apps/assets/modes/upload.pre.php on line 36
[15-Nov-2015 14:52:26 UTC] PHP Fatal error:  Call to a member function reindex() on a non-object in /Users/robert/Sites/looking-out-foundation/cms/core/apps/assets/modes/upload.pre.php on line 38

This is my full diagnostic report:

Perch Runway: 2.8.15
Production mode: Production (100)
Installed apps: content (2.8.15), assets (2.8.15), categories (2.8.15)
DB driver: PDO
DB tables: ptbl_backup_plans, ptbl_backup_resources, ptbl_backup_runs, ptbl_categories, ptbl_category_counts, ptbl_category_sets, ptbl_collection_index, ptbl_collection_items, ptbl_collection_revisions, ptbl_collections, ptbl_content_index, ptbl_content_items, ptbl_content_regions, ptbl_navigation, ptbl_navigation_pages, ptbl_page_routes, ptbl_page_templates, ptbl_pages, ptbl_resource_log, ptbl_resource_tags, ptbl_resources, ptbl_resources_to_tags, ptbl_settings, ptbl_user_privileges, ptbl_user_role_privileges, ptbl_user_roles, ptbl_users
Users: 1
App runtimes:
<?php
    $apps_list = array(
        'content', 
        'categories',
    );
Editor plug-ins: markitup
H1: c06591ae97a691ac615b8717d722c2e6
L1: d65606deaf1e7543b28bf3e3c938debb
headerColour: rgb(54,54,54)
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 0
content_collapseList: 1
lang: en-gb
update_2.8.15: done
headerScheme: dark
update_runway_2.8.15: done
latest_version: 2.8.15
on_sale_version: 2.8.15
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_SITEPATH: /Users/robert/Sites/looking-out-foundation
PERCH_SCHEDULE_SECRET: tW6Y1m3p72WgXAqp
PERCH_DB_USERNAME: lof_pu
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: lof_pdb
PERCH_DB_PREFIX: ptbl_
PERCH_EMAIL_FROM: robert@robert-chambers.com
PERCH_EMAIL_FROM_NAME: Robert Chambers
PERCH_LOGINPATH: /cms
PERCH_PATH: /Users/robert/Sites/looking-out-foundation/cms
PERCH_CORE: /Users/robert/Sites/looking-out-foundation/cms/core
PERCH_RESFILEPATH: /Users/robert/Sites/looking-out-foundation/cms/resources
PERCH_RESPATH: /cms/resources
PERCH_HTML5: 1
PERCH_TZ: UTC
PERCH_RUNWAY: 1
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /Users/robert/Sites/looking-out-foundation/cms/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SESSION_TIMEOUT_MINS: 20
HOSTING SETTINGS

PHP: 5.4.26
Zend: 2.4.0
OS: Darwin
SAPI: apache2handler
Safe mode: not detected
MySQL client: 5.5.34
MySQL server: 5.5.34
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, intl, json, ldap, mbstring, mysql, mysqli, session, PDO, pdo_sqlite, standard, posix, Reflection, Phar, SimpleXML, soap, sockets, exif, tokenizer, xml, xmlreader, xmlwriter, xsl, zip, apache2handler, imap, gettext, mcrypt, yaz, pgsql, pdo_pgsql, pdo_mysql, mongo
GD: Yes
ImageMagick: No
PHP max upload size: 32M
PHP max form post size: 32M
PHP memory limit: 128M
Total max uploadable file size: 32M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
HTTP_HOST: lookingoutfoundation.dev:8888
HTTP_CONNECTION: keep-alive
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
HTTP_REFERER: https://lookingoutfoundation.dev:8888/cms/core/settings/diagnostics/
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8,pt;q=0.6
HTTP_COOKIE: cmsa=1; PHPSESSID=775311df46e727563c8075d27e77c15a
PATH: /usr/bin:/bin:/usr/sbin:/sbin
SERVER_SOFTWARE: Apache
SERVER_NAME: lookingoutfoundation.dev
SERVER_ADDR: 127.0.0.1
SERVER_PORT: 8888
REMOTE_ADDR: 127.0.0.1
DOCUMENT_ROOT: /Users/robert/Sites/looking-out-foundation
SERVER_ADMIN: you@example.com
SCRIPT_FILENAME: /Users/robert/Sites/looking-out-foundation/cms/core/settings/diagnostics/index.php
REMOTE_PORT: 49591
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /cms/core/settings/diagnostics/?extended
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
PHP_SELF: /cms/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1447599539.86
REQUEST_TIME: 1447599539
argc: 1

Thanks,

Rob

Drew McLellan

Drew McLellan 2638 points
Perch Support

Instead of:

'username'     => 'msmarkeai2.admin',

try:

'username'     => 'admin',

Thanks Drew - that worked.

One other related question, is it possible to make this bucket the default, so you don't have to specifically select it?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Not yet, but that's something we're working on.

Great, that would be useful.

Thanks for your help.