By default, GAE (Google App Engine) supports Python as one of their default run time, which is always free!
- It's always free! Google Cloud Platform provides always-free-tier for standard environment - hence Python!
- Free, auto-renewing SSL cert for custom domains.
- Direct traffic to instance instead of routing it through cloudflare for free cert.
- Makes deployment easier in just one line (using gcloud CLI tool).
Original reference here: https://cloud.google.com/appengine/docs/flexible/custom-runtimes/quickstart
- Install google-cloud-sdk
$ brew tap caskroom/cask
$ brew cask install google-cloud-sdk
- Initialize SDK
$ gcloud init
- Enable billing for newly created GAE (Google App Engine) app
Visit console directly or click:
https://console.developers.google.com/project/{project_name}/settings
Don't forget to replace {project_name} with your project name.
- Create project folder and boilerplate files
$ mkdir portfolio/public
$ cd portfolio
$ touch app.yaml
$ echo "<h1>Hi there!</h1>" > public/index.js
- Edit
app.yaml
- this maps the routes to static files.
app.yaml
runtime: python27
api_version: 1
threadsafe: true
default_expiration: "30d"
handlers:
# site root
- url: /
static_files: public/index.html
upload: public/index.html
expiration: "15m"
secure: always
Check full app.yaml
here which copies and maps everything:
Note: This is GAE specific. Check documentation here.
- Deploy app
$ gcloud app deploy
That's it!
You can stream logs from the command line by running:
$ gcloud app logs tail -s default
To view your application in the web browser run:
$ gcloud app browse
- Add custom domain through GAE.
- Enable SSL through GAE.
Do we have still have this always free tier?