shyim / shopware-docker

Easy to use Docker Installation for Shopware 5 and Shopware 6
MIT License
115 stars 27 forks source link

Enable caching leads to 500 error #24

Closed AryaSvitkona closed 4 years ago

AryaSvitkona commented 5 years ago

First of all a big thank you for your work in this repository!

I followed your manual and was able to setup a shopware 5 installation in just about a few minutes. Without caching the shop is very slow (frontend/backend). Thats why I switched from "CACHE_VOLUMES=false" to "true" inside the .env file.

After restart the docker containers, I receive a 500er error which I can't find inside the nginx log.

Steps to reproduce:

shyim commented 5 years ago

@jinnoflife have you a idea?

AryaSvitkona commented 5 years ago

I have to say that I use the newest docker binary and I work on OSX. Hope that's not the issue but I found some forum posts, which are related to performance issues on OSX.

lx-wnk commented 5 years ago

@AryaSvitkona Did the error occur in the frontend or in the backend? Could you execute: swdc shell-root cd /var/www/html/your_project_name && chown www-data:www-data ./* -R

I just tried the config with a fresh installation which works like a charm. @shyim I think it is something about the folder permissions after mounting the cache as volumes

AryaSvitkona commented 5 years ago

Thank you for your reply, but that didn't solve the issue. As you can see I have no entry inside the logfile since ~10:00 (tried it right now on ~12:00). Screenshot 2019-08-08 at 12 10 19

lx-wnk commented 5 years ago

I don't see any cache-volumes that are created for "memoshop". Could you take a screenshot of your directory where the projects are located?

Could you contact me via gitter?

AryaSvitkona commented 5 years ago

I'm sorry, I don't have a gitter account since I work with Slack.

I don't see any cache-volumes that are created for "memoshop".

Am I wrong or does this happen in the upper part right after "swdc up" in the screenshot?

"Creating volume "shopware-docker_shopware-platform-vagrant_web_cache" with local driver" etc.?

lx-wnk commented 5 years ago

Am I wrong or does this happen in the upper part right after "swdc up" in the screenshot?

Yes you are right. The volumes are created when you start the container. There should be two to four volumes for each project-directory.

Somehow there are no containers for memoshop

AryaSvitkona commented 5 years ago

Since this is a problem with my installation, there is no issue in this repo. I will have another look and try to change as little as possible inside the config files. e.x. changed "$HOME/Code" to "$HOME/Sites" and some other stuff

shyim commented 5 years ago

Maybe enable error messages to see the right error message https://developers.shopware.com/developers-guide/shopware-config/#example-development-config

AryaSvitkona commented 5 years ago

Thanks, I will give it another try this weekend. It would be great if I / we can use your docker environment :)

AryaSvitkona commented 5 years ago

Well on a different machine I've done the same steps as I did a few days ago, but now the first time I run "swdc up" it created the cache folder and showed this error.

Fatal error: Uncaught RuntimeException: Unable to create the store directory (/var/www/html/rutisshop/var/cache/docker____REVISION___/html). in /var/www/html/rutisshop/vendor/symfony/http-kernel/HttpCache/Store.php:40 Stack trace: #0 /var/www/html/rutisshop/engine/Shopware/Components/HttpCache/Store.php(67): Symfony\Component\HttpKernel\HttpCache\Store->__construct('/var/www/html/r...') #1 /var/www/html/rutisshop/engine/Shopware/Components/HttpCache/AppCache.php(282): Shopware\Components\HttpCache\Store->__construct('/var/www/html/r...', Array, true, Array) #2 /var/www/html/rutisshop/engine/Shopware/Components/HttpCache/AppCache.php(79): Shopware\Components\HttpCache\AppCache->createStore() #3 /var/www/html/rutisshop/shopware.php(105): Shopware\Components\HttpCache\AppCache->__construct(Object(Shopware\Kernel), Array) #4 {main} thrown in /var/www/html/rutisshop/vendor/symfony/http-kernel/HttpCache/Store.php on line 40

After another "swdc down" and "swdc up" (few seconds in between) the project folder wont be linked again. I already tried the command from a few posts before, which will set the right permissions.

shyim commented 5 years ago

Did you tried setting permissions to these folders? 🤔

lx-wnk commented 5 years ago

@shyim I think I found the problem.

There was an access right problem for the volumes

shyim commented 5 years ago

@AryaSvitkona can you test the referenced commit?

AryaSvitkona commented 5 years ago

You guys are great! Hope there is a chance to give something back :) Jup, but I'm not sure how I can checkout a specific commit on a fork of your repo.

lx-wnk commented 5 years ago

@AryaSvitkona You could use: git remote add fork-jinn https://github.com/jinnoflife/shopware-docker.git && git fetch fork-jinn && git checkout fix/volumes

AryaSvitkona commented 5 years ago

Well I have to say that I have the same issue as before. I deleted everything, cloned your fork, switched to fix/volumes branch and installed a new SW instance. Same error..

The "media" and the "var" folders were created inside the "shopware-docker" directory, but they are empty. The "media" and "var" folder inside the shopware project are not empty.

lx-wnk commented 5 years ago

The media folder shouldn't be empty

At the moment I can't exactly tell where the error is coming from. On my machine everything works fine when remove the FOLDER_web_cache from the mounted volumes - don't as me why.

I'll take a look asap.

@shyim should we revert the commit?

AryaSvitkona commented 4 years ago

I was investigating again and found out, that I'm not able to create a folder inside de cache directory due to missing permissions. I checked the parent folder twice which has the same owner/group and same permissions as other folders in which I was able to create a subfolder.

example below: Bildschirmfoto 2019-11-21 um 20 18 47

shyim commented 4 years ago

Can you run swdc shell-root and fix the permissions? chown -R dev:dev /var/www/html/shopware5/var

AryaSvitkona commented 4 years ago

Jep, solves the issue, but now it stucks again while writing inside the directory. Fatal error: Uncaught RuntimeException: Unable to write in the web directory (/var/www/html/shopware5/web/cache) in /var/www/html/shopware5/engine/Shopware/Components/Theme/Compiler.php:233 Stack trace: #0 /var/www/html/shopware5/engine/Library/Enlight/Template/Plugins/function.compileLess.php(58): Shopware\Components\Theme\Compiler->compileLess('1574359354', Object(Shopware\Models\Shop\Template), Object(Shopware\Models\Shop\DetachedShop)) #1 /var/www/html/shopware5/var/cache/docker____REVISION___/templates/frontend_Responsive_de_DE_1/a5/7e/47/a57e47ff14eccfbc04c90ff080429320f780a0c1.snippet.index.tpl.php(817): smarty_function_compileLess(Array, Object(Enlight_Template_Default)) #2 /var/www/html/shopware5/var/cache/docker____REVISION___/templates/frontend_Responsive_de_DE_1/a5/7e/47/a57e47ff14eccfbc04c90ff080429320f780a0c1.snippet.index.tpl.php(263): content_5dd6e6c7893ca4_61888107(Object(Enlight_Template_Default)) #3 /var/www/html/shopware5/engine/Library/Smarty/sysplugins/smarty_internal_templatebase.php(180): content_ in /var/www/html/shopware5/engine/Shopware/Components/Theme/Compiler.php on line 233

shyim commented 4 years ago

Do the same with chown -R dev:dev /var/www/html/shopware5/web

AryaSvitkona commented 4 years ago

Great, solved the 500er issue :) I'm not sure how that issue appeared, since I never touched the ownership for those folders before. Seems that this issue can be marked as resolved, right?

shyim commented 4 years ago

How is the performance?

AryaSvitkona commented 4 years ago

I have to say that the performance didn't increase since I activated the caching inside .env I'm much faster with my local apache 2.4 setup. But as we know docker on osx isn't as fast as on linux.