Giter Club home page Giter Club logo

appengine-python-vm-runtime's Introduction

Google Managed VMs Python Runtime

Warning

The instructions here are for a multi-process version of the Python 2.7 runtime currently in beta. To use the stable version of the runtime, follow the documentation at https://cloud.google.com/appengine/docs/managed-vms/ instead.

Contents

  • Using the multi-process runtime
  • Configuration
  • Building your own version
  • Caveats

Using the multi-process runtime

These instructions assume you have a working Python application that has already been deployed successfully to Managed VMs using the default runtime version.

As this version of the Python runtime is currently in beta, it is not built as a stable Docker image like other runtimes. Instead it can be put into place via modifications to an application's Dockerfile.

If your application has an automatically generated Dockerfile (this will be created during the deployment process the first time your app is deployed), copy multicore_runtime/dev/Dockerfile from this repository to your application directory.

If your application has a custom Dockerfile, then compare the two files and merge them. In typical cases this can be done by removing the first line of your application's Dockerfile (starting with FROM) and the last line of multicore_runtime/dev/Dockerfile (ADD . /app) and concatenating the files, with the repository's version first.

Also copy the gunicorn.conf.py file from the repository to your application's root directory. (When the runtime is prepared as a precompiled image, a default will be included in the image and this step will become optional.)

This Dockerfile will download the latest release of the runtime directly from Github. If you would like to instead use a version of the runtime you have modified or that has not yet been released, see the "Building your own version" section.

Post-release, this version of the Python runtime will be made available as a prebuilt Docker image with no manual Dockerfile modification required.

Configuration

By default the multi-process version of the runtime is launched via the Gunicorn webserver and is configured to use gevent-based concurrency and a number of processes equal to the number of CPU cores available.

This can be changed by creating a file called "gunicorn.conf.py" in your application's root directory, which will override the default "gunicorn.conf.py" included with this project. Refer the gunicorn documentation for details: http://gunicorn-docs.readthedocs.org/en/latest/settings.html

Building your own version

If you would like to make modifications to the runtime (either for personal use or to debug or resolve an outstanding issue), you can build and deploy a custom version with the following steps:

  • After cloning the repository locally and making your changes, build a source distribution by running python setup.py sdist from the root directory of the repository.
  • Copy the resulting tar.gz file to your application's folder, in the same directory as the Dockerfile.
  • Also copy "gunicorn.conf.py" to the same directory as above, or use your own.
  • Edit the Dockerfile in your application and look for the line that says ADD (...) /home/vmagent/python-runtime.tar.gz
  • Replace that line with a COPY command, with the filename of your generated tar.gz file instead of the URL as the source, and the same destination. An example is included in the Dockerfile comments.
  • Deploy your application. A warning during deployment where your tar.gz file is rejected for addition because it is too large can be ignored.

Caveats

As this is a beta product, some functionality has not yet been implemented.

  • Handlers that are flagged as login: required or login: admin are not supported. Attemping to access these handlers will result in a 404 as the handlers will not be registered.

There may be other features that work on the current Python runtime and are not implemented or not functional in this version. Please open an issue on Github for any you encounter.

appengine-python-vm-runtime's People

Contributors

andrewsg avatar bryanmau1 avatar hitstergtd avatar proppy avatar vladlf avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.