Forum

Thread tagged as: Question, Addons

Kraken App

I've added Kraken to a Perch site (running 2.8.5) with an api (and a new paid Kraken account).

Tried adding three JPEGs last night. They are in the resources folder (at their original size) but I was expecting them to have been 'processed' and reduced file size. Kraken > Jobs shows all three as PENDING but only lists the -thumb@2x versions of the files.

Apart from adding the api details (both parts) and setting mode to production, I have left the image base URL as the default (https://www.example.com). Should this be the resources sub directory?

John Liston

John Liston 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is your site publicly accessible? Kraken does a callback to your site to let Perch know the image is ready to download.

Ah, I wondered about that. Presumably I need to grant write access to the resources directory.

Drew McLellan

Drew McLellan 2638 points
Perch Support

The app overwrites the existing file with the optimised version. Presumably the image has been uploaded through Perch, so it should be writable already.

The file has been uploaded through Perch. Permissions are User: rw Group: r World: r And the Resources folder: rwx r-x r-x

Drew McLellan

Drew McLellan 2638 points
Perch Support

Permissions shouldn't be an issue - if Perch writes the file it should be able to overwrite it.

I tried changing the Image base URL parameter to https://www.example.com/perch/resources but that doesn't appear to have made any difference.

screen shot of recent jobs listing

screen shot of files in resources folder

Anything else I can try

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you turn on debug, and then use a new image, after saving you should see some (I think orange) debug messages showing what's been sent to Kraken. What does it output?

The base URL should be https://example.com - we then append the image path to that to make the full URL. So an image with path

/perch/resources/my-image.png

becomes

https://example.com/perch/resources/my-image.png

Perhaps I don't know how to turn on debug. I've added a line to my Perch config file but this only outputs a debug message at the end of each page in the admin pages. There isn't anything there about sending files to Kraken.

Incidentally, Perch is logging me out frequently which is unusual. John

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show me your diagnostics?

Perch: 2.8.5
Production mode: Production (100)
Installed apps: content (2.8.5), assets (2.8.5), categories (2.8.5), perch_kraken (1.0), perch_backup (1.2)
DB driver: PDO
DB tables: perch2_categories, perch2_category_counts, perch2_category_sets, perch2_content_index, perch2_content_items, perch2_content_regions, perch2_kraken_jobs, perch2_navigation, perch2_navigation_pages, perch2_page_templates, perch2_pages, perch2_resource_log, perch2_resource_tags, perch2_resources, perch2_resources_to_tags, perch2_settings, perch2_user_privileges, perch2_user_role_privileges, perch2_user_roles, perch2_users
Users: 2
App runtimes:
<?php
    include(PERCH_PATH.'/core/apps/content/runtime.php');
?>
Editor plug-ins: ace, ckeditor-save, markitup, ckeditor
H1: 8668a3b200b56c0dfbc49cd320f43d7b
L1: 9ec436e8c56f9a91185b95b4d9b68b67
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.4.9: done
latest_version: 2.8
on_sale_version: 2.8.5
update_2.5: done
update_2.5.1: done
headerScheme: light
hide_pwd_reset: 1
dashboard: 0
content_hideNonEditableRegions: 1
content_frontend_edit: 1
update_2.5.2: done
update_2.5.3: done
update_2.5.4: done
update_2.6: done
update_2.6.1: done
update_2.6.3: done
perch_backup_mysqldump_path:
logoPath: /perch/resources/FSLogo200.png
update_2.7.2: done
update_2.7.3: done
update_2.7.7: done
update_2.8.5: done
perch_kraken_api_key: +++++
perch_kraken_api_secret: +++++
perch_kraken_dev_mode:
perch_kraken_url: https://www.example.com
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: +++++
PERCH_DB_SERVER: +++++
PERCH_DB_DATABASE: +++++
PERCH_DB_PREFIX: perch2_
PERCH_TZ: Europe/London
PERCH_EMAIL_FROM: +++++
PERCH_EMAIL_FROM_NAME: John Liston
PERCH_LOGINPATH: /perch
PERCH_PATH: /var/sites/f/example.com/public_html/perch
PERCH_CORE: /var/sites/f/example.com/public_html/perch/core
PERCH_RESFILEPATH: /var/sites/f/example.com/public_html/perch/resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_CLEAN_RESOURCES:
PERCH_DEBUG: 1
PERCH_RUNWAY:
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_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /var/sites/f/example.com/public_html/perch/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_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: textile
HOSTING SETTINGS

PHP: 5.4.28
Zend: 2.4.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $
MySQL server: 5.6.21
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, gettext, SPL, iconv, session, json, ldap, mbstring, mcrypt, mssql, standard, mysql, mysqlnd, mysqli, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, Reflection, imap, SimpleXML, soap, sockets, exif, tidy, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, cgi-fcgi, memcache, geoip, mhash, ionCube Loader, Zend Guard Loader
GD: Yes
ImageMagick: No
PHP max upload size: 100M
PHP max form post size: 100M
PHP memory limit: 128M
Total max uploadable file size: 100M
Resource folder writeable: Yes
Session timeout: 240 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
DOCUMENT_ROOT: /var/sites/w/www.example.com/public_html
GATEWAY_INTERFACE: CGI/1.1
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
HTTP_CONNECTION: close
HTTP_COOKIE: PHPSESSID=725be3a5a0f5e9399bd0e902c92362db; cmsa=1; _gat=1; _ga=GA1.3.246019834.1424262445; cmssb=0
HTTP_HOST: www.example.com
HTTP_REFERER: https://www.example.com/perch/core/settings/diagnostics/
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36
HTTP_X_FORWARDED_FOR: +++++
PATH: /bin
QUERY_STRING: extended
REDIRECT_STATUS: 200
REMOTE_ADDR: +++++
REMOTE_PORT: 60237
REQUEST_METHOD: GET
REQUEST_URI: /perch/core/settings/diagnostics/?extended
SCRIPT_FILENAME: /var/sites/w/www.example.com/public_html/perch/core/settings/diagnostics/index.php
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
SERVER_ADDR: +++++
SERVER_ADMIN: you@example.com
SERVER_NAME: www.example.com
SERVER_PORT: 80
SERVER_PROTOCOL: HTTP/1.1
SERVER_SOFTWARE: Apache
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1429633696.21
REQUEST_TIME: 1429633696
argc: 1

Ah, I've managed to get an image processed. What I did was to select an existing [image] asset (because I wanted to change it) selected the replacement image and then clicked submit.

The debug message is below. And the list of recent jobs for Kraken shows the new file as COMPLETED

Debug Message
SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='5c262f960af3c0a7b1aea9480c396e7f' LIMIT 1
UPDATE perch2_users SET userHash='641ef1e66375fc978fb3ec81d43d60b4' WHERE userID=1
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT * FROM perch2_resources WHERE resourceID=3648 LIMIT 1
Resizing image... (gd, w150 h150 @2x thumb)
Array
(
    [dev] => 
    [url] => https://www.example.com/perch/resources/sweet-stuff-thumb@2x.jpg
    [callback_url] => https://www.example.com/perch/addons/apps/perch_kraken/callback/
    [wait] => 
)
Array
(
    [id] => +++++
)
INSERT INTO perch2_kraken_jobs(jobID,file_name,file_path) VALUES('+++++','sweet-stuff-thumb@2x.jpg','/var/sites/f/example.com/public_html/perch/resources/sweet-stuff-thumb@2x.jpg')
INSERT IGNORE INTO perch2_resources(resourceApp,resourceBucket,resourceFile,resourceKey,resourceParentID,resourceType,resourceCreated,resourceInLibrary,resourceFileSize,resourceWidth,resourceHeight,resourceMimeType,resourceTitle) VALUES('content','default','sweet-stuff.jpg','orig',0,'jpg','2015-04-21 17:38:29','0',19091,200,133,'image/jpeg','Sweet Stuff')
INSERT IGNORE INTO perch2_resources(resourceApp,resourceBucket,resourceFile,resourceKey,resourceParentID,resourceType,resourceCreated,resourceInLibrary,resourceWidth,resourceHeight,resourceTargetWidth,resourceTargetHeight,resourceDensity,resourceFileSize,resourceMimeType,resourceTitle) VALUES('content','default','sweet-stuff-thumb@2x.jpg','thumb','3658','jpg','2015-04-21 17:38:29','0',150,99,150,150,2,26275,'image/jpeg','Sweet Stuff')
SELECT * FROM perch2_resources WHERE resourceID='3658' LIMIT 1
UPDATE perch2_resources SET resourceTitle='Sweet Stuff', resourceInLibrary=0 WHERE resourceID=3658
Setting alert: Successfully updated (success)
SELECT COUNT(*) FROM perch2_resource_log WHERE resourceID='3658'
SELECT * FROM perch2_resources WHERE resourceParentID='3658' AND resourceKey='thumb'
SELECT * FROM perch2_resources WHERE resourceID='3658' LIMIT 1
SELECT t.* FROM perch2_resource_tags t, perch2_resources_to_tags r2t WHERE t.tagID=r2t.tagID AND r2t.resourceID='3658'
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, great. That's how it should be working.

So, I've tested this further. If you add an asset (I'm working with JPEGs) without selecting a bucket Kraken works fine which is great. But if I select a bucket (clicking By Bucket) and then add an asset it doesn't get processed by Krakenand shows as PENDING.

Drew McLellan

Drew McLellan 2638 points
Perch Support

At which point at you selecting a bucket?

The only way I know to select the bucket is before you add an asset. I select the bucket from the dropdown after clicking By bucket, click Add asset and then drop the file into the drop area. If I select the bucket after clicking Add asset the drop zone goes away and I have to click Add asset again. In both cases the image ends up as PENDING (in the Kraken job list) and does not process as far as I can see.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, great. That gives me something to test. I'll see what I can come up with.

The more common way to add an asset to a bucket is to use the bucket attribute on a template tag - when a new asset is uploaded to that content item, it goes into the named bucket.

Oh yes, that's how it would normally be done. But, with this client, I've been bulk uploading of 12 or more images at a time which are then used on various pages: this is a gallery site for artists.

Now I know, We'll revert to adding them from the individual template pages.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Both methods are equally fine - but knowing what you're doing helps me track down the issue.