Cloud9 IDE - Online IDE

Show all articles

Deploy to Google App Engine with Cloud9 and git

By | 8 Comments

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.


 

Comments

*

*

* Required fields

  1. Sarthak says:

    That’s really great.I worked on app engine.This will make things lot easier. :)

  2. [...] I ended up settling for Cloud9 as my IDE of choice. It not only has a huge expanse of features, but it’s pretty, theme-able and for me, just feels right! There are two ways to use Cloud9, the normal way is to go their website, sign up for an account and start coding away. However, this is not the only choice, you can also grab the code from their GitHub repository and run it yourself! By default the normal Cloud9 does not offer Appengine integration, but you can deploy directly to appengine using git. [...]

  3. Ron says:

    Great article, thanks for that :)

  4. Aaron Carlson says:

    For other bash/git/cloud9/appEngine n00bs out there.

    After I went through the setup described in this post I got the following error when executing git push appengine master:

    fatal: remote error: Invalid username/password.
    You may need to use your OAuth token password; Note that generated google.com passwords are not compatible with private repositories

    To fix this I had to change the command in the post from:

    echo “machine code.google.com login EMAIL password PASSWORD” >> ~/.netrc

    to

    echo “machine source.developers.google.com login EMAIL password PASSWORD” >> ~/.netrc

    I copied the command directly from the post and modified the EMAIL and PASSWORD parameters. The command in the post has the funky double quotes. Make sure you type the normal double quotes. Also, when I generated the push to deploy git repository on Google it gave me a repository with source.developers.google.com not code.google.com. Once I fixed those two things I was able successfully execute the push command!

    Also, If you want to see the contents of the .netrc file in Cloud9 execute the following command:

    cat ~/.netrc

    You can delete it using the following command:

    rm ~/.netrc

  5. Hi, I think your site might be having browser compatibility issues.

    When I look at your blog site in Ie, it looks fine
    but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, wonderful blog!

  6. Martin Brock says:

    I’d love to use Cloud 9 to develop for app engine, but though I was able to deploy with a git push successfully, when a deploy failed, I couldn’t rollback the deployment. Since a failed deployment must be rolled back before a subsequent deployment, I could never deploy this way again. Surely, there’s a way to perform this rollback, but I’ve googled all day for it without success. If you want to develop for GAE in the cloud, you can do it with Codenvy.com. C9′s IDE is superior, but this defect is fatal as far as I can tell.

  7. Tom says:

    Can anyone clarify which email and password are used for the authentication piece? The cloud console UI no longer looks like it does in the example.

    I created a new OAuth 2.0 service account and that includes in email address in the format of (12 numbers)@developer.gserviceaccount.com but there is no password listed.

    Am I even headed in the right direction?