Skip to content

Commit b24924e

Browse files
author
Jon Wayne Parrott
committed
Folderizing the repository.
0 parents  commit b24924e

File tree

142 files changed

+8633
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+8633
-0
lines changed

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Distribution / packaging
7+
.Python
8+
env/
9+
10+
# Installer logs
11+
pip-log.txt
12+
pip-delete-this-directory.txt
13+
14+
# Unit test / coverage reports
15+
htmlcov/
16+
.tox/
17+
.coverage
18+
.coverage.*
19+
.cache
20+
nosetests.xml
21+
coverage.xml
22+
*,cover
23+
24+
*.log
25+
26+
lib/
27+
*.internal
28+
secrets.tar.gz
29+
client_secret.json

.travis.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
sudo: false
2+
language: python
3+
env:
4+
matrix:
5+
- STEP=1-hello-world
6+
- STEP=2-structured-data
7+
- STEP=3-binary-data
8+
- STEP=4-auth
9+
- STEP=5-logging
10+
- STEP=6-pubsub
11+
- STEP=7-gce
12+
global:
13+
- GOOGLE_APPLICATION_CREDENTIALS=$TRAVIS_BUILD_DIR/client-secret.json
14+
before_install:
15+
- openssl aes-256-cbc -K $encrypted_82d8befc5c58_key -iv $encrypted_82d8befc5c58_iv
16+
-in secrets.tar.gz.enc -out secrets.tar.gz -d
17+
- tar -xzf secrets.tar.gz
18+
- pip install tox
19+
before_script:
20+
- echo $GOOGLE_APPLICATION_CREDENTIALS
21+
- ls $TRAVIS_BUILD_DIR
22+
- cp config.py $TRAVIS_BUILD_DIR/$STEP
23+
- cd $TRAVIS_BUILD_DIR/$STEP
24+
script:
25+
- tox

1-hello-world/.dockerignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
__pycache__
2+
*.pyc
3+
*.pyo
4+
*.pyd
5+
.Python
6+
env
7+
pip-log.txt
8+
pip-delete-this-directory.txt
9+
.tox
10+
.coverage
11+
.coverage.*
12+
.cache
13+
nosetests.xml
14+
coverage.xml
15+
*,cover
16+
*.log
17+
.git

1-hello-world/Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright 2015 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# [START docker]
16+
# The Google App Engine python runtime is Debian Jessie with Python installed
17+
# and various os-level packages to allow installation of popular Python
18+
# libraries. The source is on github at:
19+
# https://github.com/GoogleCloudPlatform/python-docker
20+
FROM gcr.io/google_appengine/python
21+
22+
# Create a virtualenv for the application dependencies.
23+
# If you want to use Python 3, add the -p python3.4 flag.
24+
RUN virtualenv /env
25+
26+
# Set virtualenv environment variables. This is equivalent to running
27+
# source /env/bin/activate. This ensures the application is executed within
28+
# the context of the virtualenv and will have access to its dependencies.
29+
ENV VIRTUAL_ENV /env
30+
ENV PATH /env/bin:$PATH
31+
32+
# Install dependencies.
33+
ADD requirements.txt /app/requirements.txt
34+
RUN pip install -r /app/requirements.txt
35+
36+
# Add application code.
37+
ADD . /app
38+
39+
# Use Gunicorn to serve the application.
40+
CMD gunicorn -b :$PORT main:app
41+
# [END docker]

1-hello-world/app.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2015 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# This file specifies your Python application's runtime configuration
16+
# including URL routing, versions, static file uploads, etc. See
17+
# https://developers.google.com/appengine/docs/python/config/appconfig
18+
# for details.
19+
20+
# TODO: Enter your application id below. If you have signed up
21+
# using cloud.google.com/console use the "project id" for your application
22+
# id.
23+
24+
# [START runtime]
25+
runtime: custom
26+
vm: true
27+
entrypoint: custom
28+
# [END runtime]
29+
30+
# Temporary setting to keep gcloud from uploading the virtualenv
31+
skip_files:
32+
- ^v?env$

1-hello-world/main.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2015 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# [START app]
16+
from flask import Flask
17+
18+
19+
app = Flask(__name__)
20+
21+
22+
@app.route('/')
23+
def hello():
24+
"""Return a friendly HTTP greeting."""
25+
return 'Hello World!'
26+
27+
28+
if __name__ == '__main__':
29+
app.run(host='127.0.0.1', port=8080)
30+
# [END app]

1-hello-world/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Flask==0.10.1
2+
gunicorn==19.3.0

1-hello-world/tox.ini

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[tox]
2+
skipsdist = True
3+
envlist = lint
4+
5+
[testenv:lint]
6+
deps =
7+
flake8
8+
flake8-import-order
9+
commands =
10+
flake8 --exclude=env --import-order-style=google

2-structured-data/.dockerignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
__pycache__
2+
*.pyc
3+
*.pyo
4+
*.pyd
5+
.Python
6+
env
7+
pip-log.txt
8+
pip-delete-this-directory.txt
9+
.tox
10+
.coverage
11+
.coverage.*
12+
.cache
13+
nosetests.xml
14+
coverage.xml
15+
*,cover
16+
*.log
17+
.git

2-structured-data/Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright 2015 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License
14+
15+
# The Google App Engine python runtime is Debian Jessie with Python installed
16+
# and various os-level packages to allow installation of popular Python
17+
# libraries. The source is on github at:
18+
# https://github.com/GoogleCloudPlatform/python-docker
19+
FROM gcr.io/google_appengine/python
20+
21+
# Create a virtualenv for the application dependencies.
22+
# If you want to use Python 3, add the -p python3.4 flag.
23+
RUN virtualenv /env
24+
25+
# Set virtualenv environment variables. This is equivalent to running
26+
# source /env/bin/activate. This ensures the application is executed within
27+
# the context of the virtualenv and will have access to its dependencies.
28+
ENV VIRTUAL_ENV /env
29+
ENV PATH /env/bin:$PATH
30+
31+
# Install dependencies.
32+
ADD requirements.txt /app/requirements.txt
33+
RUN pip install -r /app/requirements.txt
34+
35+
# Add application code.
36+
ADD . /app
37+
38+
# Use Gunicorn to serve the application.
39+
CMD gunicorn -b :$PORT main:app

0 commit comments

Comments
 (0)