Skip to content
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

Read Only File System (ROFS) support? #1954

Closed
pdugas opened this issue Dec 1, 2017 · 7 comments
Closed

Read Only File System (ROFS) support? #1954

pdugas opened this issue Dec 1, 2017 · 7 comments

Comments

@pdugas
Copy link

pdugas commented Dec 1, 2017

I've been trying to get a complicated SF3.3 app running up on Google App Engine's Standard PHP environment. Started with GoogleCloudPlatform/appengine-symfony-starter-project. And moved forward addressing various issues as I added more an more pieces to the application - entities and Cloud SQL for the database, a cache warmer for JMS Serializer, etc.

I added EasyAdminBundle without issue in DEV. As usual, very simple. Pushed it up to GAE and ran into the error below. Looks like another cache warmer is in order. The filesystem on GAE is read-only so we must pre-load the cache locally then deploy the resulting files. Can anyone here provide some guidance on what should go in the warmUp() method to accomplish this?

PHP Fatal error:  Uncaught exception 'InvalidArgumentException' with message 'The directory "/base/data/home/apps/p~***/staging.405912533122113545/var/cache/prod/easy_admin" is not writable.' in /base/data/home/apps/p~***/staging.405912533122113545/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php:92
Stack trace:
#0 /base/data/home/apps/p~***/staging.405912533122113545/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php(37): Doctrine\Common\Cache\FileCache->__construct('/base/data/home...', '.doctrinecache....', 2)
#1 /base/data/home/apps/p~***/staging.405912533122113545/vendor/javiereguiluz/easyadmin-bundle/src/Cache/CacheManager.php(25): Doctrine\Common\Cache\FilesystemCache->__construct('/base/data/home...')
#2 /base/data/home/apps/p~***/staging.405912533122113545/var/cache/prod/appProdProjectContainer.php(1286): EasyCorp\Bundle\EasyAdminBundle\Cache\CacheManager->__construct('/base/data/home...')
#3 /base/data/home/a in /base/data/home/apps/p~***/staging.405912533122113545/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php on line 92
@pdugas
Copy link
Author

pdugas commented Dec 6, 2017

The use of Doctrine's FileCache appears to be the issue I'm having. The is_writeable() test in the constructor is failing as I'd expect. Looking at what was deployed, the existing CacheWarmer appears to be working - var/cache/prod/easy_admin/dc/xxxxx.doctrinecache.data exists. If I patch FileCache.php to comment out that test, things get a little further on GAE production - now chasing a Twig issue.

Related, I suggested (doctrine/cache#240) that the test be moved and was quickly shot down.

@javiereguiluz
Copy link
Collaborator

Thanks for investigating this issue. I'm very interested in helping you make this work on GAE. If the problem is that we can't write files during the execution of the app, then we could detect that in a compiler pass and replace the FilesystemCache by the ArrayCache. I'll try to look in detail into this soon.

@pdugas
Copy link
Author

pdugas commented Dec 6, 2017

In this case, the cache file created by the CacheWarmer is working with the patch. Seems to me it'd be nice to be able to use the pre-cached file and not resort to using an array.

See GoogleCloudPlatform/appengine-symfony-starter-project for some of the other issues with running on GAE-Standard. The Twig adjustments seem to work for basic stuff but I'm having trouble as soon as I try using things like csrf_token() and the app variable in templates. Getting this error when I try and load the EasyAdmin route.

request.CRITICAL: Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Could not parse property path "[entities][]". Unexpected token "[" at position 10")." at /base/data/home/apps/p~xxx/staging.xxx/vendor/javiereguiluz/easyadmin-bundle/src/Resources/views/default/list.html.twig line 1 {"exception":"[object] (Twig_Error_Runtime(code: 0): An exception has been thrown during the rendering of a template (\"Could not parse property path \"[entities][]\". Unexpected token \"[\" at position 10\"). at /base/data/home/apps/p~xxx/staging.xxx/vendor/javiereguiluz/easyadmin-bundle/src/Resources/views/default/list.html.twig:1, Symfony\\Component\\PropertyAccess\\Exception\\InvalidPropertyPathException(code: 0): Could not parse property path \"[entities][]\". Unexpected token \"[\" at position 10 at /base/data/home/apps/p~xxx/staging.xxx/vendor/symfony/symfony/src/Symfony/Component/PropertyAccess/PropertyPath.php:116)"} []

@javiereguiluz
Copy link
Collaborator

I'm not sure I can remove the constructor check because that would work in this case ... but would cause problems in other legitimate cases when the exception must be thrown because the cache dir is not writable (but the filesystem is). I'm trying another approach in #1965.

In any case, I'm very interested in all the problems you are facing with GAE ... not only for this bundle but for the entire Symfony project. So please, report any problem you find with Symfony components so we can fix them. Thanks!

@pdugas
Copy link
Author

pdugas commented Dec 6, 2017

My notes so far are at https://paul.dugas.cc/2017/11/02/symfony-on-google-app-engine/. Where do you suggest I look for help on the Twig issue? I've added an issue in the starter-project (GoogleCloudPlatform/appengine-symfony-starter-project#25) but don't see any activity there.

@pdugas
Copy link
Author

pdugas commented Dec 7, 2017

I went ahead and submitted it here, symfony/symfony#25368

@javiereguiluz
Copy link
Collaborator

I'm closing this issue because we're starting a new phase in the history of this bundle (see #2059). We've moved it into a new GitHub organization and we need to start from scratch: no past issues, no pending pull requests, etc.

I understand if you are angry or disappointed by this, but we really need to "reset" everything in order to reignite the development of this bundle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants