gcloud run deploy <SERVICE> \
--image gcr.io/$GOOGLE_CLOUD_PROJECT/<BILLING_IMAGE> \
--<AUTHENTICATED>
3. optional: click on the Service URL in cloud shell, or curl manually. e.g.curl https://public-billing-service-XXXXXXX.a.run.app
Task 2:
Same as task 1, with different values.
+----------------+-------------------------------------------+
| FIELD | VALUE |
+----------------+-------------------------------------------+
| Image Name | frontend-staging:0.1 |
| Service Name | frontend-staging-service |
| Authentication | unauthenticated |
| Code | pet-theory/lab07/staging-frontend-billing |
+----------------+-------------------------------------------+
Task 3:
+----------------+--------------------------------------+
| FIELD | VALUE |
+----------------+--------------------------------------+
| Image Name | billing-staging-api:0.2 |
| Service Name | private-billing-service |
| Authentication | authenticated |
| Code | pet-theory/lab07/staging-api-billing |
+----------------+--------------------------------------+
Delete the existing Billing Service
cd ~/<CODE>
gcloud beta run services delete public-billing-service
2. Build an image using Cloud Build: similar to task 1
3. Deploy the image to Cloud Run requiring authentication: similar to above, just be aware this time is authenticated. –no-allow-unauthenticated
4. Test service:
BILLING_SERVICE=private-billing-service
BILLING_URL=$(gcloud run services describe $BILLING_SERVICE \
--format "value(status.URL)")
curl -X get -H "Authorization: Bearer $(gcloud auth print-identity-token)" $BILLING_URL
Task 4:
+-----------------+---------------------------+
| FIELD | VALUE |
+-----------------+---------------------------+
| Service Account | billing-service-sa |
| Display Name | Billing Service Cloud Run |
+-----------------+---------------------------+
+-----------------+-----------------------------------+
| FIELD | VALUE |
+-----------------+-----------------------------------+
| Service Account | frontend-service-sa |
| Display Name | Billing Service Cloud Run Invoker |
+-----------------+-----------------------------------+
same command as Task 4
Task 7:
+-----------------+----------------------------------------+
| FIELD | VALUE |
+-----------------+----------------------------------------+
| Image Name | frontend-prod:0.1 |
| Service Name | frontend-prod-service |
| Authentication | unauthenticated |
| Code | pet-theory/lab07/prod-frontend-billing |
| Service Account | frontend-service-sa |
+-----------------+----------------------------------------+
Deploy the image to Cloud Run & Enable Authentication: refer to Task 5
cd ~/<CODE>
## similar to task 5 build and deploy command above
2. Enable Service Account: similar to task 5
gcloud run services add-iam-policy-binding <SERVICE_NAME> \
--member=serviceAccount:<SERVICE_ACCOUNT>@$GOOGLE_CLOUD_PROJECT.iam.gserviceaccount.com \
--role=roles/run.invoker
3. optional: click on URL printed in cloud shell to verify endpoint access
Congratulations
After that you should be able to finish this challenge lab and obtain a skill badge:
This blog post is recording my journey on proof of concept development on ionic 4 capacitor & PWA development in December 2018, just note down some obstacles I faced or founding in the journey, and this is not a tutorial.
Although Progressive Web Apps (PWA) are installable without app store, as of today business requirement may still need the distribute channel via app store. With ionic (UI) and Cordova framework, one single code base can serve native apps and web apps together.
ionic 4
Capacitor or Stencil
Capacitor is still in Release Candidate in Dec 2018, and 1.0 production in 2019. Integrate with Angular. Cross platform: iOS, android, Web, Electron (win & macOS)
Stencil: web component (similar to ploymer), reusable, independent (angular, react, vue)
selected Capacitor as per requirement.
Toolings: Intellij Idea (as subscribed), or Visual Studio Code (free)
Creation on iOS & android projects is smooth and easy. ionic team really did a great job there. However, PWA isn’t that user-friendly. npm install @ionic/pwa-elements only adding UI component.
$ ionic server –> live reload on source folder, so PWA doesn’t work as pre-caching & routing info in /www (build) folder, not src/service-worker.js
edit package.json, add “dist”: “ng build && workbox injectManifest” Then run $ npm run dist to build. Then run $ npx cap serve
alternatively, http-server can be used, that will use /www file. e.g. http-server www -c-1 -o -a -S localhost -p 8200
HTTPS: PWA works on localhost, 192.168.x.x . Others need HTTPS. It won’t work on non-SSL, took some time to find out, as office wifi is not Class C network. Yet it runs okay at home.