Venia PWA Configuration

Magento (Venia) PWA configuration

Change to your VHost directory, in this example we use example.com that is part of the example domain-group:

cd /microcloud/domains/example/domains/example.com/

Clone the PWA studio git repo:

git clone https://github.com/magento-research/pwa-studio.git ___pwa

Change to the ___pwa directory and run the install:

cd ___pwa
npm install

Copy the base .env and edit the MAGENTO_BACKEND_URL variable to point to your site:

cp packages/venia-concept/.env.dist packages/venia-concept/.env

Run the build and start the service:

! The PORT variable needs to be passed through, otherwise a random port will be chosen when the app is restarted. You should also ensure this is unique if you are hosting multiple PWA instances.

npm run build
PORT=3000 pm2 start --name=venia npm -- run start

Save the pm2 processlist so it's restored on restart:

pm2 save

Nginx/VHost configuration (Magento on different domain)

The below configuration should be implemented on the VHost that is hosting your frontend - not the VHost hosting Magento.

# Passthrough Requests to NodeJS
location ~* ^/ {
  include sites-config/magestack-headers.conf;
  proxy_pass http://acc1.i:3000;
}

After implementing the nginx rules, you should ensure you test and reload the nginx configuration.