dockware / dockware

Managed Shopware 6 Docker setups with dockware. Run any Shopware 6 version within minutes (locally) in Docker
https://dockware.io
MIT License
153 stars 52 forks source link

Error while running watch-storefront script #11

Closed hagmann closed 4 years ago

hagmann commented 4 years ago

While running watch-storefront, the following error occurred: image

The compilation was still successful, but the JS files are not being loaded using port 9999: image

This may lead to this error: image

The sources are available as expected on localhost:9999.

System details: Windows 10 Pro Docker Toolbox

martinweinmayr commented 4 years ago

@hagmann which dockware image are you running? And how did you start the watcher? and how does your ports section look like in your docker-compose file?

hagmann commented 4 years ago

@martinweinmayr

Dockerfile:

version: "3"

services:

  shopware:
    image: dockware/dev:latest
    container_name: shopware
    ports:
      - "80:80"
      - "3306:3306"
      - "222:22"
      - "8888:8888"
      - "9999:9999"
    networks:
      - web
    environment:
      - SW_CURRENCY=CHF
      - XDEBUG_ENABLED=1
      - XDEBUG_REMOTE_HOST=192.168.99.101

networks:
  web:
    external: false

I started the watcher using

cd /var/www
make watch-storefront
martinweinmayr commented 4 years ago

@hagmann which dockware version?

dev/contribute/essential?

shopware version? 6.3.0?

hagmann commented 4 years ago

@martinweinmayr

dockware/dev:latest Shopware 6.3.1.0 (Updated in the Administration)

martinweinmayr commented 4 years ago

just to be sure, in the .env you have SHOPWARE_HTTP_CACHE_ENABLED=0 ?

hagmann commented 4 years ago
APP_ENV=dev
APP_SECRET=1
INSTANCE_ID=1
DATABASE_URL=mysql://root:root@localhost:3306/shopware
APP_URL=http://localhost
MAILER_URL=smtp://localhost:1025
COMPOSER_HOME=/var/www/html/var/cache/composer
SHOPWARE_ES_ENABLED=0
dimitripreiss commented 4 years ago

Hi,

I have the same problem after I updated Shopware to 6.3.1.0 in the administration (#10).

@martinweinmayr I checked your suggestion and add SHOPWARE_HTTP_CACHE_ENABLED = 0 but but unfortunately the error still exists.

martinweinmayr commented 4 years ago

we will pack sw 6.3.1 on monday, i think then we will also see what the problem ist ... Normaly a admin update should not be that problem as it is based on production theme.

I'll give you feedback latest on monday, maybe already today

martinweinmayr commented 4 years ago

ps. on my site it works well... Strange

martinweinmayr commented 4 years ago

in the and of the process you see something like that?

image

and if you change a scss file it reloads automaticly? right?

martinweinmayr commented 4 years ago

ahhhh i see on the 1st image they try to open 9998. This should not happen if you really use our make command. @hagmann

If you do it your way you have to map the port 9998:9998 in your ports section of the docker-compose file.

hagmann commented 4 years ago

@martinweinmayr I actually followed the docs so I am not sure what it tries to use port 9998 instead of 9999. Both ports are now mapped in docker-compose.xml and forwared to the docker machine. But resources are still now proxied to one of these ports.

The compiler itself works flawlessy.

martinweinmayr commented 4 years ago

compiler and watcher works now? "compiled successfull" is also the result of watchers ...

hagmann commented 4 years ago

@martinweinmayr As mentioned in the first post, the compiler always worked. The issue are the resources that are not being loaded through port 9999.

martinweinmayr commented 4 years ago

if the watcher would work you should see the message "compiled successfull" and not what you have postet in your first image

hagmann commented 4 years ago

Here is a larger image of the steps and where it fails image

martinweinmayr commented 4 years ago

mine lookes like this

image

martinweinmayr commented 4 years ago

especially this line seems me missing on your site: cd /var/www/html && PROJECT_ROOT=/var/www/html APP_URL=http://localhost ESLINT_DISABLE=true npm --prefix /var/www/html/vendor/shopware/storefront/Resources/app/storefront run hot

martinweinmayr commented 4 years ago

can you check your makefile pls?

should look like this: .PHONY: help .DEFAULT_GOAL := help

help: @grep -E '^[a-zA-Z_-]+:.?## .$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

---------------------------------------------------------------------------------------------

watch-storefront: ## starts watcher for admin at http://localhost @echo "RequestHeader add hot-reload-mode "1"" > /var/www/html/.htaccess.watch cd /var/www/html && ./bin/build-storefront.sh cd /var/www/html && php bin/console theme:dump cd /var/www/html && PROJECT_ROOT=/var/www/html APP_URL=http://localhost ESLINT_DISABLE=true npm --prefix /var/www/html/vendor/shopware/storefront/Resources/app/storefront run hot

stop-watch-storefront: ## Reverts everything back to normal operation @rm -rf /var/www/html/.htaccess.watch

---------------------------------------------------------------------------------------------

watch-admin: ## starts watcher for admin at http://localhost:8888 cd /var/www/html && ./bin/build-administration.sh cd /var/www/html && php bin/console bundle:dump cd /var/www/html && PROJECT_ROOT=/var/www/html APP_ENV=dev PORT=8888 HOST=0.0.0.0 ENV_FILE=/var/www/html/.env ESLINT_DISABLE=true npm run --prefix /var/www/html/vendor/shopware/administration/Resources/app/administration dev -- http://0.0.0.0

https://github.com/dockware/dockware/blob/master/template/assets/assets/shopware6/makefile.twig

martinweinmayr commented 4 years ago

ok i might was wrong, but im getting closer :-)

hagmann commented 4 years ago

@martinweinmayr I recreated the docker instance but unfortunately I receive the same results. My makefile looks like this: image (sorry about the bad contrast)

Any idea why this like is missing in my makefile?

Once I execute this line manually, it seems to work correctly 👍

Apart from the fonts that are not loaded proxied (9999) image

martinweinmayr commented 4 years ago

i have now the same output as you, with the port 9998 and so on. But storefront works well. and i see changes emediatly.

We will investigate it a bit deeper on monday. To also get fonts working.

hagmann commented 4 years ago

@martinweinmayr Awesome, thank you :)

martinweinmayr commented 4 years ago

ok found it ...

you have to manually call bin/console theme:compile that the default assets getting coppied to the assets folder...

LaurensGoedel commented 4 years ago

We have the same issue sinsce last friday after we updated to 6.3.1.0. We tried to call the scripts manually as @hagmann mentioned, but didnt work.
We tried the bin/console theme:compile too, but alsno won't solve the issue.

For now we added 9998:9998 in our docker-compose file and open the frontend on that port. That seems the only working solution for now for us.

martinweinmayr commented 4 years ago

@LaurensGoedel do you also have windows?

today we will release all new versions of shopware for dockware and than normaly everything should work as normal ...

LaurensGoedel commented 4 years ago

@martinweinmayr yes, win10 and we use Docker Desktop and WSL to run

That sounds good, looking forward for it!

martinweinmayr commented 4 years ago

so finally we fixed it!

solution: in your current setup just update the /var/www/html/.htaccess.watch and add the following line RequestHeader add hot-reload-port 9999

if your fonts a re missing just bin/console theme:compile

Later this day we will update all dockware images ✌️

LaurensGoedel commented 4 years ago

My coworker just encountered the same issue, and your solution for the .htaccess.watch file solves the problem.

martinweinmayr commented 4 years ago

as we have now released 6.3.1.0 and 6.3.1.1 the watcher will work again ...