File tree Expand file tree Collapse file tree 10 files changed +15
-40
lines changed
optional-kubernetes-engine Expand file tree Collapse file tree 10 files changed +15
-40
lines changed Original file line number Diff line number Diff line change @@ -12,4 +12,4 @@ PyMongo==3.6.0
1212six == 1.11.0
1313requests [security ]== 2.18.4
1414honcho == 1.0.1
15- psq == 0.6 .0
15+ psq == 0.7 .0
Original file line number Diff line number Diff line change 2929 </ div >
3030 < ul class ="nav navbar-nav ">
3131 < li > < a href ="/books "> Books</ a > </ li >
32- < li > < a href ="/books/mine "> My Books</ a > </ li >
3332 </ ul >
34- < p class ="navbar-text navbar-right ">
35- {% if session.profile %}
36- < a href ="/logout ">
37- {% if session.profile.image %}
38- < img class ="img-circle " src ="{{session.profile.image.url}} " width ="24 ">
39- {% endif %}
40- {{session.profile.displayName}}
41- </ a >
42- {% else %}
43- < a href ="/oauth2authorize "> Login</ a >
44- {% endif %}
45- </ p >
4633 </ div >
4734 </ div >
4835 < div class ="container ">
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ ZONE=us-central1-f
2020GROUP=frontend-group
2121TEMPLATE=$GROUP -tmpl
2222MACHINE_TYPE=f1-micro
23- IMAGE_FAMILY=debian-8
23+ IMAGE_FAMILY=debian-9
2424IMAGE_PROJECT=debian-cloud
2525STARTUP_SCRIPT=startup-script.sh
2626SCOPES=" userinfo-email,cloud-platform"
@@ -30,7 +30,7 @@ MIN_INSTANCES=1
3030MAX_INSTANCES=10
3131TARGET_UTILIZATION=0.6
3232
33- SERVICE=frontend-web -service
33+ SERVICE=my-app -service
3434
3535#
3636# Instance group setup
@@ -58,7 +58,7 @@ gcloud compute instance-groups managed \
5858 --base-instance-name $GROUP \
5959 --size $MIN_INSTANCES \
6060 --template $TEMPLATE \
61- --zone $ZONE
61+ --zone $ZONE
6262# [END create_group]
6363
6464# [START create_named_port]
@@ -140,7 +140,7 @@ gcloud compute instance-groups managed set-autoscaling \
140140 $GROUP \
141141 --max-num-replicas $MAX_INSTANCES \
142142 --target-load-balancing-utilization $TARGET_UTILIZATION \
143- --zone $ZONE
143+ --zone $ZONE
144144# [END set_autoscaling]
145145
146146# [START create_firewall]
153153 --allow tcp:8080 \
154154 --source-ranges 0.0.0.0/0 \
155155 --target-tags http-server \
156- --description " Allow port 8080 access to http-server"
156+ --description " Allow port 8080 access to http-server"
157157fi
158158
159159# [END create_firewall]
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ resources:
2323 properties :
2424 zone : us-central1-f
2525 machine-type : n1-standard-1
26- machine-image : https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/family/debian-8
26+ machine-image : https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/family/debian-9
2727 min-instances : 1
2828 max-instances : 10
2929 target-utilization : 0.6
Original file line number Diff line number Diff line change @@ -45,7 +45,8 @@ git config --global credential.helper gcloud.sh
4545git clone https://source.developers.google.com/p/$PROJECTID /r/[YOUR_REPO_NAME] /opt/app
4646
4747# Install app dependencies
48- virtualenv /opt/app/7-gce/env
48+ virtualenv -p python3 /opt/app/7-gce/env
49+ source /opt/app/7-gce/env/bin/activate
4950/opt/app/7-gce/env/bin/pip install -r /opt/app/7-gce/requirements.txt
5051
5152# Make sure the pythonapp user owns the application code
@@ -56,13 +57,13 @@ chown -R pythonapp:pythonapp /opt/app
5657cat > /etc/supervisor/conf.d/python-app.conf << EOF
5758[program:pythonapp]
5859directory=/opt/app/7-gce
59- command=/opt/app/7-gce/env/bin/gunicorn main:app --bind 0.0.0.0:8080
60+ command=/opt/app/7-gce/env/bin/honcho start -f ./procfile worker bookshelf
6061autostart=true
6162autorestart=true
6263user=pythonapp
6364# Environment variables ensure that the application runs inside of the
6465# configured virtualenv.
65- environment=VIRTUAL_ENV="/opt/app/env/ 7-gce",PATH="/opt/app/7-gce/env/bin",\
66+ environment=VIRTUAL_ENV="/opt/app/7-gce/env ",PATH="/opt/app/7-gce/env/bin",\
6667 HOME="/home/pythonapp",USER="pythonapp"
6768stdout_logfile=syslog
6869stderr_logfile=syslog
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ gcloud config set compute/zone $ZONE
2020
2121GROUP=frontend-group
2222TEMPLATE=$GROUP -tmpl
23- SERVICE=frontend-web -service
23+ SERVICE=my-app -service
2424
2525gcloud compute instance-groups managed stop-autoscaling $GROUP --zone $ZONE
2626
Original file line number Diff line number Diff line change 1- bookshelf: gunicorn -b 0.0.0.0:$PORT main:app
1+ bookshelf: gunicorn -b 0.0.0.0:8080 main:app
22worker: psqworker --pid /tmp/psq.pid main.books_queue
33monitor: python monitor.py /tmp/psq.pid
Original file line number Diff line number Diff line change @@ -12,4 +12,4 @@ PyMongo==3.6.0
1212six == 1.11.0
1313requests [security ]== 2.18.4
1414honcho == 1.0.1
15- psq == 0.6 .0
15+ psq == 0.7 .0
Original file line number Diff line number Diff line change 2929 </ div >
3030 < ul class ="nav navbar-nav ">
3131 < li > < a href ="/books "> Books</ a > </ li >
32- < li > < a href ="/books/mine "> My Books</ a > </ li >
3332 </ ul >
34- < p class ="navbar-text navbar-right ">
35- {% if session.profile %}
36- < a href ="/logout ">
37- {% if session.profile.image %}
38- < img class ="img-circle " src ="{{session.profile.image.url}} " width ="24 ">
39- {% endif %}
40- {{session.profile.displayName}}
41- </ a >
42- {% else %}
43- < a href ="/oauth2authorize "> Login</ a >
44- {% endif %}
45- </ p >
4633 </ div >
4734 </ div >
4835 < div class ="container ">
Original file line number Diff line number Diff line change @@ -13,4 +13,4 @@ PyMongo==3.6.0
1313six == 1.11.0
1414requests [security ]== 2.18.4
1515honcho == 1.0.1
16- psq == 0.6 .0
16+ psq == 0.7 .0
You can’t perform that action at this time.
0 commit comments