Deploy to Google App Engine with Cloud9 and git

By Ivar Pruijn28 July 2013

Last week Brad Abrams wrote a great article about using Cloud9 IDE and git to deploy to Google App Engine. We loved his post, so with permission, we’re reposting it in full below. Please see Cloud9 + Git App Engine Nirvana for his original article.

Cloud9 + Git == App Engine Nirvana

With the recent preview launch of Source Push to Deploy in App Engine, Google has given every App Engine app it’s own git repo. When you push to it, Google will automatically deploy that code to App Engine.

While that is cool in and of itself, what is even more cool is that git is a standard protocol that many tools can speak. So it is now possible to have integration with App Engine from any tool that supports git. Including popular cloud based IDE – Cloud9. Here are the steps for using Cloud9 + git to deploy to App Engine.

Use Cloud9 to edit a Cloud Project

Go to Cloud9 and create a new workspace (choose the “Clone from URL” option). I’d recommend https://github.com/GoogleCloudPlatform/appengine-guestbook-python as a simple frame for an AppEngine app.

Create a new Python workspace in Cloud9 IDE

This should drop you into the Cloud9 editor.

Cloud9 IDE Python workspace

Setup Push to Deploy

Create a new App Engine application at cloud.google.com/console then enable Push-to-Deploy under App Engine in the Application Settings page. Leave this tab open to note the URL for your repo.

Enabling Push-to-Deploy in Google App Engine

Configure Cloud9

Run these commands in your cloud9 console (making sure to replace your email address, auth-token, and repo-url):

echo “machine code.google.com login EMAIL password PASSWORD” >> ~/.netrc
git remote add appengine REPO

Note: The email in this case is the mail address you use to login to your Google App Engine account and the password is the auth-token generated from the admin console, it is not your google password, never type that into a third party tool. ‘REPO’ is the repository URL generated before.

Login to Google App Engine from the Terminal

Make a change

Then simply edit any file in the editor, the go back to the terminal and do a commit then a push.

git commit -a -m “”
git push appengine master

Push to Google App Engine from the Cloud9 IDE Terminal

And we are done!

Google App Engine running guestbook created on Cloud9 IDE

What we have shown is a 100% cloud based development and experience for building an app engine application. This is powered by the standard git deployment support in App Engine and Cloud9.

Happy coding!

P.S. Read more about deployment from Cloud9 on our documentation site: Deploying Your Code.

Ivar Pruijn

Read more posts by Ivar Pruijn.