-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: For Cloud Environment - Customizable temp file prefix naming #884
Comments
What's the suggested solution from GAE for apps that need to write things? I'm sure someone else already had the same problem. |
Here it is: https://cloud.google.com/appengine/docs/php/googlestorage/ But since you're after executing raw PHP templates, |
Ah okay. So maybe just try to set |
Tried setting the TEMP @ikkez but GAE's wrapper doesn't work for directory functions(like mkdir - https://github.com/bcosca/fatfree/blob/master/lib/base.php#L2632) only file specific functions, so it threw an error. |
I'm lovin F3's template language too much right now @xfra35 😄 |
Oh wait @ikkez I see its supported (https://cloud.google.com/appengine/docs/php/googlestorage/advanced#php_filesystem_functions_support_on_google_cloud_storage), so maybe its something to do with my bucket, lemme check... |
So I get "file_put_contents(): Exclusive locks may only be set for regular files" (https://github.com/bcosca/fatfree/blob/master/lib/base.php#L1817) |
...yeah, so when I remove the LOCK_EX|, it works! Need a more permanent solution though. |
Ok, so that roughly resolves the file writing issue but in terms of templates written, the template has a prefix made up of the hash(ROOT**(which is $_SERVER['DOCUMENT_ROOT'])** . BASE . filename . 'php'), which would mean that every time a template is written, it will be based off the servers ROOT and if there are multiple servers serving a template, there will be multiple versions of the same template written. I found the similar issue in terms of caching, so would also like to request an option to customize the name here too: https://github.com/bcosca/fatfree/blob/master/lib/base.php#L2409 as when a key is cached, it could also have multiple versions of itself written depending on the server serving the request. |
Ok, so my updated findings/requests: File writing on GAE issue - (https://github.com/bcosca/fatfree/blob/master/lib/base.php#L1817)
Cloud template naming issue - https://github.com/bcosca/fatfree/blob/master/lib/base.php#L2639
Caching naming issue - https://github.com/bcosca/fatfree/blob/master/lib/base.php#L2409
|
Hi everyone, regarding TEMP, per https://gae-php-tips.appspot.com/2015/03/03/file-system-changes-in-app-engine-1-9-18/ we can now use the in-memory file system for this, so f3->set('TEMP', sys_get_temp_dir()). Chris |
The temp file name prefix can now be adjusted with the |
Hey @ikkez! The seed solves the taking advantage of the templates cache(TEMP) across multiple servers via setting it to the cloud storage BUT using sys_get_temp_dir() for TEMP doesn't store the files beyond the request: "The in memory filesystem will be flushed at the end of the request, and is not shared in between requests to the same instance."(https://gae-php-tips.appspot.com/2015/03/03/file-system-changes-in-app-engine-1-9-18/) This is great for actual temporary stuff but the template cache is tied to the TEMP dir ...so we won't be able to take advantage of the template cache(TEMP). I've set our TEMP to a cloud storage dir, it writes and reads from the cloud storage dir :) |
Hey guys,
I'm trying to get F3 working on Google App Engine (GAE), the problem is that the F3 app is served from multiple servers, on each server, a request for a template would be expecting a temp filename made up of a hash(ROOT . BASE). ROOT changes accordingly to the server serving the request, so the expected template name changes from server to server.
This wouldn't be a problem except that GAE is read-only(attempting to write to disk would throw an error), so a solution is to upload Temp files generated locally to GAE, the main issue then being that the temp filenames won't match up with the temp filenames requested per server.
Could you code it to allow the "template prefix" to be customisable?
to something like:
The text was updated successfully, but these errors were encountered: