Skip to content

Instantly share code, notes, and snippets.

@dustintheweb
Last active August 29, 2015 14:03
Show Gist options
  • Save dustintheweb/4bdc004bfb43d87c372a to your computer and use it in GitHub Desktop.
Save dustintheweb/4bdc004bfb43d87c372a to your computer and use it in GitHub Desktop.
Create a simple CDN with Google App Engine
application: your-app-cdn
version: 1
api_version: 1
runtime: python27
threadsafe: true
handlers:
# web files
- url: /(.*\.css)
mime_type: text/css
static_files: \1
upload: (.*\.css)
- url: /(.*\.js)
mime_type: text/javascript
static_files: \1
upload: (.*\.js)
# image files
- url: /(.*\.(bmp|gif|ico|jpeg|jpg|png))
static_files: \1
upload: (.*\.(bmp|gif|ico|jpeg|jpg|png))
- url: /(.*\.webp)
mime_type: image/webp
static_files: \1
upload: (.*\.webp)
- url: /(.*\.(svg|svgz))
mime_type: image/svg+xml
static_files: \1
upload: (.*\.(svg|svgz))
# audio files
- url: /(.*\.(mid|midi|mp3|wav))
static_files: \1
upload: (.*\.(mid|midi|mp3|wav))
- url: /(.*\.(ogg|oga))
mime_type: audio/ogg
static_files: \1
upload: (.*\.(ogg|oga))
# video/media files
- url: /(.*\.m4v)
mime_type: video/m4v
static_files: \1
upload: (.*\.m4v)
- url: /(.*\.mp4)
mime_type: video/mp4
static_files: \1
upload: (.*\.mp4)
- url: /(.*\.ogv)
mime_type: video/ogg
static_files: \1
upload: (.*\.ogv)
- url: /(.*\.webm)
mime_type: video/webm
static_files: \1
upload: (.*\.webm)
- url: /(.*\.swf)
mime_type: application/x-shockwave-flash
static_files: \1
upload: (.*\.swf)

###Use Google App Engine as a Budget CDN


**Prereq:** - OSX - Homebrew - Google App Engine
**1. Set up an App Engine Project** - https://appengine.google.com

2. Install Google App Engine via Homebrew

brew install google-app-engine

3. Add app.yaml to a project folder on your local machine

4. Push your code to the cloud

cd /path/to/your/project-folder
appcfg.py --oauth2 update .

5. All Done

6. Need to update? Just push your files again!

appcfg.py --oauth2 update /path/to/your/project-folder

πŸ‘πŸ‘πŸ‘


Need to pull down?

1. Grab your code from the cloud

cd /path/to/your/project-folder
appcfg.py --oauth2 download_app -A yourAppID ~/path/to/your/project-folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment