-
-
Notifications
You must be signed in to change notification settings - Fork 605
Running OSv on Google Compute Engine
WALDEMAR KOZACZUK edited this page Sep 8, 2024
·
5 revisions
https://cloud.google.com/console
wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-x86_64.tar.gz
tar xfx ./google-cloud-cli-linux-x86_64.tar.gz
./google-cloud-sdk/install.sh
gcloud init
$ cd osv
$ ./scripts/build image=golang-pie-httpserver,httpserver-monitoring-api
$ gcloud config set project <YOUR_PROJECT_ID>
$ gcloud config set compute/zone <YOUR_ZONE> #for example us-east1-c
./scripts/deploy_to_gce.sh create <OSV-IMAGES-FOLDER> <OSV-INSTANCE-NAME>
The script deploy_to_gce.sh
does the following:
- creates an image tarball of the last built OSv image
- copies the image tarball to the Google storage folder specified by
<OSV-IMAGES-FOLDER>
- creates a GCE instance image of the tarball in GCS
- creates and starts a new GCE instance of the image created above
- creates firewall rules to allow networking traffic on ports 8000 and 9000
Also, the script takes a third optional parameter: the instance type. The default one is f1-micro
.
$ ./scripts/deploy_to_gce.sh describe <OSV-IMAGES-FOLDER> <OSV-INSTANCE-NAME>
$ curl http://<PUBLIC_IP>:8000/os/dmesg
$ curl http://<PUBLIC_IP>:9000/
$ ./scripts/deploy_to_gce.sh delete <OSV-IMAGES-FOLDER> <OSV-INSTANCE-NAME>