-
Notifications
You must be signed in to change notification settings - Fork 588
Fixing Running the Python Bookshelf on Compute Engine Sample Code #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,8 @@ ZONE=us-central1-f | |
GROUP=frontend-group | ||
TEMPLATE=$GROUP-tmpl | ||
MACHINE_TYPE=f1-micro | ||
IMAGE=debian-8 | ||
IMAGE_FAMILY=debian-8 | ||
IMAGE_PROJECT=debian-cloud | ||
STARTUP_SCRIPT=startup-script.sh | ||
SCOPES="userinfo-email,cloud-platform" | ||
TAGS=http-server | ||
|
@@ -41,7 +42,8 @@ SERVICE=frontend-web-service | |
|
||
# [START create_template] | ||
gcloud compute instance-templates create $TEMPLATE \ | ||
--image $IMAGE \ | ||
--image-family $IMAGE_FAMILY \ | ||
--image-project $IMAGE_PROJECT \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Param -image is deprecated. Updated to use -image-family and -image-project. |
||
--machine-type $MACHINE_TYPE \ | ||
--scopes $SCOPES \ | ||
--metadata-from-file startup-script=$STARTUP_SCRIPT \ | ||
|
@@ -97,13 +99,15 @@ gcloud compute http-health-checks create ah-health-check \ | |
|
||
# [START create_backend_service] | ||
gcloud compute backend-services create $SERVICE \ | ||
--http-health-checks ah-health-check | ||
--http-health-checks ah-health-check \ | ||
--global | ||
# [END create_backend_service] | ||
|
||
# [START add_backend_service] | ||
gcloud compute backend-services add-backend $SERVICE \ | ||
--instance-group $GROUP \ | ||
--instance-zone $ZONE | ||
--instance-group-zone $ZONE \ | ||
--global | ||
# [END add_backend_service] | ||
|
||
# Create a URL map and web Proxy. The URL map will send all requests to the | ||
|
@@ -125,7 +129,7 @@ gcloud compute target-http-proxies create $SERVICE-proxy \ | |
gcloud compute forwarding-rules create $SERVICE-http-rule \ | ||
--global \ | ||
--target-http-proxy $SERVICE-proxy \ | ||
--port-range 80 | ||
--ports=80 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Param --port-range is deprecated. Updated to use --ports. |
||
# [END create_forwarding_rule] | ||
|
||
# | ||
|
@@ -140,9 +144,16 @@ gcloud compute instance-groups managed set-autoscaling \ | |
# [END set_autoscaling] | ||
|
||
# [START create_firewall] | ||
gcloud compute firewall-rules create default-allow-http-8080 \ | ||
# Check if the firewall rule has been created in previous steps of the documentation | ||
if gcloud compute firewall-rules list --filter="name~'default-allow-http-8080'" \ | ||
--format="table(name)" | grep -q 'NAME'; then | ||
echo "Firewall rule default-allow-http-8080 already exists." | ||
else | ||
gcloud compute firewall-rules create default-allow-http-8080 \ | ||
--allow tcp:8080 \ | ||
--source-ranges 0.0.0.0/0 \ | ||
--target-tags http-server \ | ||
--description "Allow port 8080 access to http-server" | ||
--description "Allow port 8080 access to http-server" | ||
fi | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Old script may fail if user has created a default-allow-http-8080 firewall rule in previous steps of the tutorial. Added a new command to create the firewall rule only when the rule has not already existed. |
||
# [END create_firewall] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ pip install --upgrade pip virtualenv | |
# git requires $HOME and it's not set during the startup script. | ||
export HOME=/root | ||
git config --global credential.helper gcloud.sh | ||
git clone https://source.developers.google.com/p/$PROJECTID /opt/app | ||
git clone https://source.developers.google.com/p/$PROJECTID/r/[YOUR_REPO_NAME] /opt/app | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated to use the current format of Cloud Repo addresses. |
||
|
||
# Install app dependencies | ||
virtualenv /opt/app/7-gce/env | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,18 +24,18 @@ SERVICE=frontend-web-service | |
|
||
gcloud compute instance-groups managed stop-autoscaling $GROUP --zone $ZONE | ||
|
||
gcloud compute forwarding-rules delete $SERVICE-http-rule --global | ||
gcloud compute forwarding-rules delete $SERVICE-http-rule --global --quiet | ||
|
||
gcloud compute target-http-proxies delete $SERVICE-proxy | ||
gcloud compute target-http-proxies delete $SERVICE-proxy --quiet | ||
|
||
gcloud compute url-maps delete $SERVICE-map | ||
gcloud compute url-maps delete $SERVICE-map --quiet | ||
|
||
gcloud compute backend-services delete $SERVICE | ||
gcloud compute backend-services delete $SERVICE --global --quiet | ||
|
||
gcloud compute http-health-checks delete ah-health-check | ||
gcloud compute http-health-checks delete ah-health-check --quiet | ||
|
||
gcloud compute instance-groups managed delete $GROUP | ||
gcloud compute instance-groups managed delete $GROUP --quiet | ||
|
||
gcloud compute instance-templates delete $TEMPLATE | ||
gcloud compute instance-templates delete $TEMPLATE --quiet | ||
|
||
gcloud compute firewall-rules delete default-allow-http-8080 | ||
gcloud compute firewall-rules delete default-allow-http-8080 --quiet | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Param --quiet is specified so that user will not be interrupted to confirm on each of the operations when running the script. |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Param -image is deprecated. Updated to use -image-family and -image-project.