Module: AppEngine::Tasks

Defined in:
lib/appengine/tasks.rb

Overview

App Engine Rake Tasks.

To make these tasks available, add the line require "appengine/tasks" to your Rakefile. If your app uses Ruby on Rails, then the appengine gem provides a railtie that adds its tasks automatically, so you don't have to do anything beyond adding the gem to your Gemfile.

The following tasks are defined:

Rake appengine:exec

Executes a given command in the context of an App Engine application, using App Engine remote execution. See Exec for more information on this capability.

The command to be run may either be provided as a rake argument, or as command line arguments, delimited by two dashes --. (The dashes are needed to separate your command from rake arguments and flags.) For example, to run a production database migration, you can run either of the following equivalent commands:

bundle exec rake "appengine:exec[bundle exec bin/rails db:migrate]"
bundle exec rake appengine:exec -- bundle exec bin/rails db:migrate

To display usage instructions, provide two dashes but no command:

bundle exec rake appengine:exec --

Parameters

You may customize the behavior of App Engine execution through a few enviroment variable parameters. These are set via the normal mechanism at the end of a rake command line. For example, to set GAE_CONFIG:

bundle exec rake appengine:exec GAE_CONFIG=myservice.yaml -- bundle exec bin/rails db:migrate

Be sure to set these parameters before the double dash. Any arguments following the double dash are interpreted as part of the command itself.

The following environment variable parameters are supported:

GAE_CONFIG

Path to the App Engine config file, used when your app has multiple services, or the config file is otherwise not called ./app.yaml. The config file is used to determine the name of the App Engine service.

GAE_SERVICE

Name of the service to be used. If both GAE_CONFIG and GAE_SERVICE are provided and imply different service names, an error will be raised.

GAE_VERSION

The version of the service, used to identify which application image to use to run your command. If not specified, uses the most recently created version, regardless of whether that version is actually serving traffic.

GAE_TIMEOUT

Amount of time to wait before appengine:exec terminates the command. Expressed as a string formatted like: "2h15m10s". Default is "10m".