How to Install PWA Studio for Live Server
-
06-05-2021 - |
Pregunta
I have and AWS instance running Magento 2.3.5 with sample data and installed PWA Studio by following directions here:
https://magento.github.io/pwa-studio/tutorials/pwa-studio-fundamentals/project-setup/
Node and Yarn is installed and all working and everything gets installed following those directions.
But, I cannot find any directions on how to use this on a live server. After following the above instructions all I get is this URL:
https://pwa-studio-plo4s.local.pwadev:8091
And clicking that does not get anything in my browser.
I even tried following the Venia Storefront directions:
https://magento.github.io/pwa-studio/venia-pwa-concept/setup/
But I can't tell if I am supposed to follow those directions instead of the other directions or in addition to those directions. If I follow them in addition to it just installs it in another PWA directory.
I can't find anything that will tell me how to view this live using my domain name. All of the setup to view the site/pwa is not clear at all. Even sites like Nexcess, Webkul and CedCommerce that have PWA articles have been no help and just seem to repeat the same directions.
Can someone offer instructions on how to see this live? There has to be something/someone that has had success and good directions on how to get this implemented and working with a live site.
Thanks, Stan
Solución
Let's assume you already have or installed NodeJS >=10.14.1 and Yarn >=1.13.0 in your server. And also you have a running Magento 2 instance. Now follow below step by step.
In your Magento root directory run
git clone https://github.com/magento/pwa-studio.git
After clone complete go to pwa-studio folder
cd pwa-studio
Then run below command one by one
yarn install
yarn buildpack create-custom-origin packages/venia-concept
Now set you backend url (site base url)
MAGENTO_BACKEND_URL="https://mymagentosite.come/" \
CHECKOUT_BRAINTREE_TOKEN="sandbox_8yrzsvtm_s2bg8fs563crhqzk" \
yarn buildpack create-env-file packages/venia-concept
After that run below commands
yarn run build
yarn run watch:venia
Now what you need to do to connect you pwa-studio with your Magento is install Magento_UpwardConnector module
composer require magento/module-upward-connector
php bin/magento setup:upgrade
php bin/magento cache:flush
Now you have to set connection between pwa-studio and magento by below commands. You have to give exact path of the upward.yml file.
bin/magento config:set -e web/upward/path /var/www/vhosts/mymagentosite/htdocs/pwa-studio/packages/venia-concept/dist/upward.yml
Thank you.