markshust / docker-magento

Mark Shust's Docker Configuration for Magento
https://m.academy/courses/set-up-magento-2-development-environment-docker/
MIT License
2.53k stars 997 forks source link

Run bin/setup-pwa-studio magento.test cannot be completed on win 10 OS WSL 2 Ubuntu #434

Open refaelgold opened 3 years ago

refaelgold commented 3 years ago

Hey , Im trying to create an PWA app with custom M2 instance inside docker for a serval hours but I1 cant get any progress .

I'm running the command : bin/setup-pwa-studio magento.test but im getting a serval errors inside the process and i will be glad for some advices how to solve my issue

~/docker-magento$ bin/setup-pwa-studio magento.test Install NodeJS and Yarn on host machine, otherwise setup will fail Cloning into 'pwa-studio'... remote: Enumerating objects: 1423, done. remote: Counting objects: 100% (1423/1423), done. remote: Compressing objects: 100% (874/874), done. remote: Total 41321 (delta 634), reused 807 (delta 416), pack-reused 39898 Receiving objects: 100% (41321/41321), 32.54 MiB | 1.23 MiB/s, done. Resolving deltas: 100% (26993/26993), done. 00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'install'

For solving the first issue I did manually clone of PWA repo from compose/bin/setup-pwa-studio Bash file and and take the url repo and try get progress with solution.

I run the following commands: bin/bash BASE_URL=${1:-master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud} git clone https://github.com/magento/pwa-studio.git yarn install and then Im running yarn buildpack and i get an issue with ssl(i think). yarn buildpack create-custom-origin packages/venia-concept at LinuxPlatform.deleteProtectedFiles (/var/www/html/pwa-studio/node_modules/devcert/dist/platforms/linux.js:99:17) $ /var/www/html/pwa-studio/node_modules/.bin/buildpack create-custom-origin packages/venia-concept at uninstall (/var/www/html/pwa-studio/node_modules/devcert/dist/certificate-authority.js:124:25) Please enter the password for app on f0cc157fce9b. at Object. (/var/www/html/pwa-studio/node_modules/devcert/dist/certificate-authority.js:18:9) Error: spawnSync sudo ENOENT at Generator.next () at Object.spawnSync (internal/child_process.js:1067:20) at /var/www/html/pwa-studio/node_modules/tslib/tslib.js:115:75 at spawnSync (child_process.js:602:24) at new Promise () at Object.execFileSync (child_process.js:629:15) at Object.__awaiter (/var/www/html/pwa-studio/node_modules/tslib/tslib.js:111:16) at Object.run (/var/www/html/pwa-studio/node_modules/devcert/dist/utils.js:22:28) at Object.installCertificateAuthority [as default] (/var/www/html/pwa-studio/node_modules/devcert/dist/certificate-authority.js:16:20)t/dist/platforms/linux.js:99:17)

 at Object.<anonymous> (/var/www/html/pwa-studio/node_modules/devcert/dist/index.js:55:50):124:25)

 at Generator.next (<anonymous>)/html/pwa-studio/node_modules/devcert/dist/c**ertificate-authority.js:18:9)**

After running bin/setup-ssl magento.test - Im still get the same error.

bin/setup-ssl magento.test Using the local CA at "/root/.local/share/mkcert" ✨ info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Created a new certificate valid for the following names 📜

The certificate is at "nginx.crt" and the key at "nginx.key" ✅ (/var/www/html/pwa-studio/node_modules/devcert/dist/certificate-authority.js:16:20) Moving key and cert to /etc/nginx/certs/... Restarting containers to apply updates.../pwa-studio/node_modules/devcert/dist/index.js:55:50)

If there is any solution for using M2 local instance for PWA app inside WIN 10 WSL V2 - I will be glad to know how to implement it . Maybe there is no solution for that and I will be forced to use a remote server for dev or buy a MacBook :D

EmperorKonstantin commented 3 years ago

While i do not have an answer for you, and have given up on WSL2 development entirely, VSCode Remote SSH development could be a life-saver for you. Pair it with an Intel NUC and an Samsung NVME SSD Drive that has Ubuntu installed directly on it and stuff it into your desk drawer or near your router.

markshust commented 2 years ago

Are you still having this issue? I actually think it may be best to even remove this helper script and run PWA Studio code locally. I just ran this last week on mac and everything went very smooth. I'm not convinced we need to run these node apps through Docker.

refaelgold commented 2 years ago

The main issue that https is not sercure after runnikng the following commands :

**- bin/setup-ssl: Generate an SSL certificate for one or more domains. Ex. bin/setup-ssl magento.test foo.test

nirgoldman@DESKTOP-S0DRAGF:/mnt/c/Users/refae/PhpstormProjects/magento.test$ bin/setup-ssl-ca The local CA is already installed in the system trust store! �

                                                           System password requested to install certificate authority on host...

Checking for libnss3-tools: install ok installed [sudo] password for nirgoldman: Sorry, try again. [sudo] password for nirgoldman: Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done. nirgoldman@DESKTOP-S0DRAGF:/mnt/c/Users/refae/PhpstormProjects/magento.test$ bin/setup-ssl magento.test

Created a new certificate valid for the following names �

After running those command i get an Invalid Cert Screenshot 2021-10-16 204056

Even if i will remove the PWA studio and ignore the the script - I will get an error about https . Temp sulotion is use the command : set NODE_TLS_REJECT_UNAUTHORIZED=1

I try to install ssl in WSL 2 but its useless becuase i think that i need to install it inside the docker

WSL2 SSL installation https://jitheshkt.medium.com/enable-ssl-on-wsl2-apache-windows-10-bcdfef71024a

markshust commented 2 years ago

Thanks for this information. I'll need some help here, as I don't currently have a Windows machine to test this.