Shop is a sample e-commerce Progressive Web App. In this fork we added build yaml files to deploy it in Cloud Run and App Engine
- Just push the change
- a sample e-commerce shopping site
- pattern for a real-life shopping cart and store checkout flow
- pattern for using custom announcers for accessibility
Cloud Run
To start playing we decided to use an example PWA to run at different Google Cloud Platform products.
gcloud init
npm init
npm install --save prpl-server
Create file server/app_std.yaml to the project.
runtime: nodejs8
service: pwa-shop
handlers:
- url: '.*'
script: auto
secure: always
redirect_http_response_code: 301
npm run build
gcloud app deploy server/app_std.yaml
To deploy an application to Cloud Run call the gcloud build step to invoke gcloud beta run deploy:
- Enable the Cloud Run API.
- Grant the Cloud Run Admin role to the Cloud Build service account:
- In GCP Console, access the IAM menu.
- In the list of members, locate and select[PROJECT_NUMBER]@cloudbuild.gserviceaccount.com.
- Click on EDIT (pencil) button in that row to grant a new role to that account.
- Click Add another role.
- Select Cloud Run, and then Cloud Run Admin.
- Click Save.
- Grant the IAM Service Account User role to the Cloud Build service account on the Cloud Run runtime service account:
- In GCP Console, access the Service Accounts menu.
- In the list of members, locate and select [PROJECT_NUMBER]-compute@developer.gserviceaccount.com.
- Click SHOW INFO PANEL in the top right corner.
- In the Permissions panel, click the Add Member button.
- Enter the Cloud Build service account ([PROJECT_NUMBER]@cloudbuild.gserviceaccount.com) in the New Member input field.
- In the Role dropdown, select Service Accounts, and then Service Account User.
- Click Save.
Mexico Cloud Run Club - 2019-08-17 - Page
To test prpl-server build:
$ npm run serve:prpl-server
To test static build:
$ npm run serve:static
Our production deployment of SHOP is hosted on App Engine with Node.js. It can be deployed with the same steps as PWA Starter Kit.