Skip to content

Instantly share code, notes, and snippets.

@dustintheweb
Forked from cagatay/app.yaml
Last active December 2, 2015 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dustintheweb/51026c1bbb90f987a8ab to your computer and use it in GitHub Desktop.
Save dustintheweb/51026c1bbb90f987a8ab to your computer and use it in GitHub Desktop.
Google App Engine (Python) - app.yaml for hosting a static site

####Looking to use Google App Engine as a webhost? This app.yaml will help take you there.

#####Additionally, I've included a rough workflow / the log kept during initial setup.

Prereq:

  • OSX
  • homebrew
  • npm/yeoman/grunt/assemble

In Terminal

brew install google-app-engine

Create an App Engine project

Project settings

  • Project ID: someName
  • App ID: someName-YYYY
  • ex: nintendo-mk8 / nintendo-mk8
  • ex2: lego-lotr / lego-lotr-2014

In your local project/app folder, build your app.yaml

In Terminal:

grunt build

(which runs the dist/build process, etc)

then:

appcfg.py --oauth2 update <path-to-dist-folder>

which authenticates the push via oauth


Using Git?

If you plan on utilizing a Git repo, and would like to set up Push-to-deploy for one less step:

go back to your dashboard

navigate here

  • left panel > source code > releases

tick deploy source only

click create pipeline button

😎 Done

using SourceTree for Git? https://gist.github.com/dustintheweb/21c308b82a024fc8d585

Update

Looks like around Dec 2014 Google decided to disable the simple push-to-deploy for new apps, in favor of a more complicated Jenkins solution. This is annoying, but it looks like progress is being made towards a middle ground https://groups.google.com/forum/#!search/push-to-deploy/google-appengine/XUIh7QlO37U/wL3aqIXlYiAJ

application: your-app-name
version: 1
runtime: python27
api_version: 1
threadsafe: true
default_expiration: "30d"
handlers:
# web files
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
static_files: dist/\1
upload: dist/(.*\.(appcache|manifest))
expiration: "0m"
- url: /(.*\.html)
mime_type: text/html
static_files: dist/\1
upload: dist/(.*\.html)
expiration: "1h"
- url: /(.*\.css)
mime_type: text/css
static_files: dist/\1
upload: dist/(.*\.css)
- url: /(.*\.js)
mime_type: text/javascript
static_files: dist/\1
upload: dist/(.*\.js)
- url: /(.*\.json)
mime_type: application/json
static_files: dist/\1
upload: dist/(.*\.json)
expiration: "1h"
- url: /(.*\.xml)
mime_type: application/xml
static_files: dist/\1
upload: dist/(.*\.xml)
expiration: "1h"
- url: /(.*\.htc)
mime_type: text/x-component
static_files: dist/\1
upload: dist/(.*\.htc)
- url: /(.*\.txt)
mime_type: text/plain
static_files: dist/\1
upload: dist/(.*\.txt)
- url: /(.*\.rss)
mime_type: application/rss+xml
static_files: dist/\1
upload: dist/(.*\.rss)
expiration: "1h"
- url: /(.*\.atom)
mime_type: application/atom+xml
static_files: dist/\1
upload: dist/(.*\.atom)
expiration: "1h"
- url: /(.*\.crx)
mime_type: application/x-chrome-extension
static_files: dist/\1
upload: dist/(.*\.crx)
- url: /(.*\.xpi)
mime_type: application/x-xpinstall
static_files: dist/\1
upload: dist/(.*\.xpi)
- url: /(.*\.safariextz)
mime_type: application/octet-stream
static_files: dist/\1
upload: dist/(.*\.safariextz)
# font files
- url: /(.*\.eot)
mime_type: application/vnd.ms-fontobject
static_files: dist/\1
upload: dist/(.*\.eot)
- url: /(.*\.otf)
mime_type: font/opentype
static_files: dist/\1
upload: dist/(.*\.otf)
- url: /(.*\.ttf)
mime_type: font/truetype
static_files: dist/\1
upload: dist/(.*\.ttf)
- url: /(.*\.woff)
mime_type: application/x-font-woff
static_files: dist/\1
upload: dist/(.*\.woff)
# image files
- url: /(.*\.ico)
mime_type: image/x-icon
static_files: dist/\1
upload: dist/(.*\.ico)
expiration: "7d"
- url: /(.*\.(bmp|gif|ico|jpeg|jpg|png))
static_files: dist/\1
upload: dist/(.*\.(bmp|gif|ico|jpeg|jpg|png))
- url: /(.*\.webp)
mime_type: image/webp
static_files: dist/\1
upload: dist/(.*\.webp)
- url: /(.*\.(svg|svgz))
mime_type: image/svg+xml
static_files: dist/\1
upload: dist/(.*\.(svg|svgz))
# audio files
- url: /(.*\.(mid|midi|mp3|wav))
static_files: dist/\1
upload: dist/(.*\.(mid|midi|mp3|wav))
- url: /(.*\.(ogg|oga))
mime_type: audio/ogg
static_files: dist/\1
upload: dist/(.*\.(ogg|oga))
# video/media files
- url: /(.*\.m4v)
mime_type: video/m4v
static_files: dist/\1
upload: dist/(.*\.m4v)
- url: /(.*\.mp4)
mime_type: video/mp4
static_files: dist/\1
upload: dist/(.*\.mp4)
- url: /(.*\.ogv)
mime_type: video/ogg
static_files: dist/\1
upload: dist/(.*\.ogv)
- url: /(.*\.webm)
mime_type: video/webm
static_files: dist/\1
upload: dist/(.*\.webm)
- url: /(.*\.swf)
mime_type: application/x-shockwave-flash
static_files: dist/\1
upload: dist/(.*\.swf)
- url: /(.*\.unity3d)
mime_type: application/vnd.unity
static_files: dist/\1
upload: dist/(.*\.unity3d)
# windows files
- url: /(.*\.(doc|exe|ppt|rtf|xls))
static_files: dist/\1
upload: dist/(.*\.(doc|exe|ppt|rtf|xls))
# compressed files
- url: /(.*\.(bz2|gz|rar|tar|tgz|zip))
static_files: dist/\1
upload: dist/(.*\.(bz2|gz|rar|tar|tgz|zip))
# index files
- url: /(.*)/
static_files: dist/\1/index.html
upload: dist/(.*)/index.html
expiration: "15m"
# site root
- url: /
static_files: dist/index.html
upload: dist/index.html
expiration: "15m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment