The scripts in this repository help manage GCP VM images containing the code & data that support bvc Live 3D walkthrough property service requests.
The scripts below offer an abstract level of control over the code, instances, and models needed to realize an image, and provide a reasonable set of operations to build, test and deploy the system.
Creating and deploying a bvc Windows image is a complex undertaking, as it involves pulling together different code and executable modules, along with property models, and performing subjective tests on staging VM instances before wrapping it all up for production.
The procedures documented below require a number of complicated invocations of gcloud, gsutil, ssh, and Windows command-line utilities. The scripts do most of the heavy-lifting
A bvc VM image is a Windows Server OS, with the following items:
- C:\Users\bvw_admin account (password in 1Password)
- Setup to autologon to bvw_admin and run startup script upon boot
C:\Users\bvw_admin\live-node\...
JS code pulled from BitBucketC:\Users\bvw_admin\live-app\...
Unity player build of template + live-appC:\Users\bvw_admin\startup.bat
Script to run live-node automatically upon bootC:\Users\bvw_admin\builds
Folder containing property-specific Unity builds, and property id links to each one.
- Local installation of gcloud, gsutil
- Git for Windows (if running on a Windows machine locally)
bvimages.sh -
Creates and publishes VM images used by above VM instancesbvinstances.sh -
Lists, creates, and deletes VM instancesbvzones.sh -
Lists GCP availability zones with GPUscrontab.txt -
Manages per-client VM allocations (temporary until dynamic provisioning implemented)bvmodels.sh -
Manages and deploys property models to staging VM
New VM instances are created with a default template and image, which we incrementally update anytime new live-node, live-app, or property models are available. We add the updates and test in staging before preparing a new image for production. The first step is to create a VM in staging:
- Open a Git Bash shell, type in the following:
./bvinstances.sh create ln-buildtest-01
The live-node service handles communication and startup/shutdown of local live-app sessions. The code repository is: https://bitbucket.org/bvc/live-node/src/main/. To update, just open a shell onto the remote VM, cd to the live-node working directory, and pull the latest live-node code with git:
- Open a Git Bash shell, type in the following:
gcloud compute ssh bvw_admin@ln-buildtest-01
cd live-node
git pull
The live-app program is a Unity player build, that loads and streams 3D property models to WebRTC clients during a bvc Live 3D walkthrough session. The live-app compressed archives are located in a Google storage bucket: gs://live-app-repo-us/. To update, open a shell onto the staging VM, download and uncompress a live-app archive, and repoint the live-app link to the new live-app folder.
gcloud compute ssh bview_admin@ln-buildtest-01
(this opens a new shell window, into it, type the following:gsutil cp gs://live-walkthrough-repo-us/live-app/live-app-XXXXXX.7z .
7z x live-app-XXXXXX
rm live-app
mklink /d live-app live-app-XXXXXX
- Using unity-dev-tools (https://bitbucket.org/bvc/unity-dev-tools/src/master/BvBuildPlayer/)
- Create and test Unity build locally with BvBuildAddressables.bat script (in bvw-unity repository)
- Publish Unity build with BvBuildPublish.bat, which creates a zipped file, uploads to Google storage bucket live-app-repo-us
- Create new VM in staging, download the build to C:\bvw_admin\builds\
- Unzip file and create a link from propertyId to the build folder
- Perform QA test on the property from https://staging.bvc.com
- Run
bvimages.sh create
to create a new image, and replace the "latest" image name - Create another new VM in staging, and performs basic tests to ensure proper working order
- Run
bvimages.sh publish
to copy the image to production - Run a sanity check on production
- On local machine in this working directory, open a Unix shell (bash on mac, or 'git bash' on Windows)
./bvinstances.sh create ln-buildtest-01
./bvmodels.sh list
- Choose a model from the list, copy the full path (e.g. gs://live-app-repo-us/S2D0a1yzC8s8Mfm37Fv8-alto18_20pinest_newyork-cs41-20230501-153111.7z)
./bvmodels.sh deploy gs://live-app-repo-us/S2D0a1yzC8s8Mfm37Fv8-alto18_20pinest_newyork-cs41-20230501-153111.7z --vm ln-buildtest-01
- Repeat as needed for other properties
- On local machine, open browser to https://staging.bvc.com, navigate to property matching the build id (in this case JF0FT0AdOJWvmTfvubYW is the Healthpeak 100 Acorn Park Dr property)
- Select "Live Walkthrough", notice Unity startup in remote desktop, wait for scene to appear, QC the live UX for that property.
./bvimages.sh create --vm ln-buildtest-01
(this automatically stops the instance)./bvinstances.sh create ln-buildtest-02
- TEST: (same to above, just basic sanity check of Live Walkthrough on a few properties to ensure the image works)
.\bvimages.sh publish
- On local browser, visit https://portal.bvc.com, run same test as above
Any image can be copied to the livenode-latest
name used by the VM templates, so to rollback, simply choose a previous image from the list, and copy it to the name (staging), or publish it (production).
./bvimages.sh list
NAME DESCRIPTION
lni-20220928-185911-06062e7-6-props live-node-sha=06062e7,bvw-unity-cs=5343-5477-5548-5614-5654-5558
lni-20220928-234817-06062e7-6-props live-node-sha=06062e7,bvw-unity-cs=5343-5477-5548-5614-5654-5658
lni-20221003-090523-06062e7 ln-sha-06062e7,prop-cs-5343-5477-5548-5614-5654-5658
livenode-latest source:lni-20221003-090523-06062e7
gcloud compute images delete livenode-latest --project=bvc-portal-staging
gcloud compute images create -q livenode-latest --project bvc-portal-staging --source-image=lni-20220928-234817-06062e7-6-props --description=source:lni-20220928-234817-06062e7-6-props
./bvimages.sh publish --name lni-20220928-234817-06062e7-6-props