Developing for Google App Engine from ChromeOS

The backstory

The holiday season brings with it a lot of great things including family, traveling, and a lot of time to relax. I travel pretty frequently and am accustomed to the whole process. I make it a personal challenge to see how slim I can pack (much to the exasperation of my wife). For this trip, in particular, my goal was to only bring one laptop. As I was packing to go on vacation I basically had one rule: no work laptop.

No problem. I'll just use one of my laptops (I am an IT guy, after all). Well, as it turns out I only have two laptops. One is an ASUS G75VW, a 17.3" gaming laptop (it's really a mildly portable desktop), and the other is a 10" ASUS Chromebook Flip.

I love my Flip. It's got great battery life that lasts 10-12 hours and is the perfect size for traveling. If Erin and I go to a coffee shop I frequently just have her toss it in her purse next to her iPad. As a convertible laptop I can play games on planes during take-off/landing, but it still has a physical keyboard.

Chromebook Flip and a coffee.. the essentials

Alright, alright, to the point of this post. One project I wanted to work on during my down time was my GAEmes database. Normally I'd just remotely access a virtual machine running from my apartment to write and submit code. For whatever reason I decided it would be a fun challenge to see if I could completely adapt my workflow to allow for App Engine development from the cloud. This means no remotely accessing machines I've got stuffed away in my closet.

Coding in the cloud

The first step was to figure out some way of writing/testing code from ChromeOS. There were two paths I could take. I could either write code locally on my Flip and find some way to deploy it into App Engine or find some sort of cloud IDE that would allow me to write and test code from the browser.

I ended up going the cloud IDE route because it seemed a bit more true to the nature of my challenge. There are a couple of options out there: Nitrous.iocodeanywhere.com, and c9.io (to name a few). Nitrous seems to directly support App Engine development, but doesn't have a free tier. I ended up going with Cloud9 because it was free, integrated into GitHub, and I could get the App Engine devappserver working (sort of).

Setting up a Cloud9 Workspace

Setting up a Cloud9 workspace is surprisingly easy. You can set up a free account at c9.io or log in with your GitHub or Bitbucket credentials. The latter options give you instant integration with your repositories.

Once signed in you can either clone one of your pre-existing repos into a workspace, try out the test workspace, or create a new workspace from scratch. For the purpose of this post I'll assume you're creating a new workspace from scratch. Be sure the keep the custom template selected.

Create a workspace with the custom template

This will drop you into the Cloud9 IDE interface for your newly created workspace. I've found the tiling options to be super useful for working on a small screen. Of particular note you'll see a bash terminal at the bottom of your screen. That's where we'll need to do a little work.

Cloud9 IDE

Installing Python App Engine SDK

We need to download, install, and configure the Python App Engine SDK to handle debugging and deploying our app. Let's get started.

$ VERSION=1.9.30
$ cd ~/
$ wget https://storage.googleapis.com/appengine-sdks/featured/google_appengine_$VERSION.zip
$ unzip google_appengine_$VERSION.zip

You should now have a folder in the home directory called google_appengine. This contains everything you need to deploy your app. Google has some great documentation on uploading and deploying apps to AppEngine.

Note: The first time you use appcfg.py you'll need to specify the --noauth_local_webserver flag.

Set up devappserver2.py

At this point you have everything you need to deploy an app. However, the debugging process will pretty painful if you need to deploy to AppEngine to test any change. The dev app server is great for debugging, but requires a bit of hacking to make it work in the Cloud9 environment. Full credit for this bit goes to Ole over at stack overflow.

First, open up the devappserver code:
$ open ~/google_appengine/google/appengine/tools/devappserver2/devappserver2.py
This should open up devappserver2.py in the text editor. First, comment out the following lines (lines 827-830 in SDK 1.9.30).
admin = admin_server.AdminServer(options.admin_host, options.admin_port,
                              self._dispatcher, configuration, xsrf_path)
admin.start()
self._running_modules.append(admin)

Next, we need to add the second line below (currently located at line ~1030). I've added the previous line for context:

options = PARSER.parse_args()
# Add this next line
options.host = os.environ['IP']
Lastly, modify the following lines (currently 927-928):
return api_server.APIServer(options.api_host, options.api_port,
                            configuration.app_id)
to look like this.
return api_server.APIServer(os.environ['IP'], options.api_port,
                            configuration.app_id)
You should now be able to launch the devappserver (without the use of the admin console, sadly). Once serving you can use the preview menu to view the served content.


That's it! You should now be able to write, test, and deploy apps for AppEngine from a ChromeOS device.

~MJ

8 comments:

Aruna Ram said...

It was a good tip! This is very helpful to increase my knowledge and Thanks for giving the valid post.


Excel Training in Chennai
Advanced Excel Training in Chennai
corporate training in chennai
Tableau Training in Chennai
Pega Training in Chennai
Spark Training in Chennai
Embedded System Course Chennai
Linux Training in Chennai
Excel Training in Chennai
Advanced Excel Training in Chennai

shreekavi said...


Great post. keep sharing such a worthy information
Selenium Training in Chennai
Selenium Training in Bangalore
Selenium Training in Coimbatore
Selenium Course in Bangalore
Best Selenium Training in Bangalore
Selenium training in marathahalli
Selenium training in Btm
Ethical Hacking Course in Bangalore
Tally Course in Chennai

diyasurya said...

Interesting blog. Got a lotb of information about this technology.
Spoken English Classes in Chennai
Best Spoken English Classes in Chennai
IELTS Coaching in Chennai
Japanese Classes in Chennai
French Classes in Chennai
pearson vue test center in chennai
content writing course in chennai
spanish classes in chennai
Spoken English Classes in OMR
Spoken English Classes in Porur

sasi said...

Great experience for me by reading this blog. Thank you for the wonderful article.
Angularjs Training institute in Chennai
Angular 4 Training in Chennai
angularjs training institute in bangalore
Angular Training in hyderabad
best angularjs training in bangalore
angular training in bangalore
Salesforce Training in Bangalore
Hadoop training in bangalore
angular course in bangalore
angularjs training in marathahalli

Riya Raj said...

Awesome Post!!! Thanks for sharing this great post with us.
JAVA Training in Chennai
Best JAVA Training institute in Chennai
best java course in chennai
JAVA J2EE Training in Chennai
Best JAVA Training in Chennai
java training in OMR
JAVA Training in Annanagar
Big data training in chennai
Selenium Training in Chennai
Android Training in Chennai

chandhran said...

This blog is really nice and informative blog, The explanation given is really comprehensive and informative.
PHP Training in Bangalore
PHP Course in Bangalore
PHP Training Institute in Bangalore
PHP Classes in Bangalore
Best PHP Training Institute in Bangalore
Best php training institute in chennai
best php training institute in coimbatore
best php training in coimbatore
german classes in bangalore
Data Science Courses in Bangalore

Riya Raj said...

Wonderful Blog!!! Thanks for sharing this post with us... and it is more helpful for us.
IOS Training in Chennai
iOS Course in Chennai
iOS Training
Best ios Training institutes in Chennai
IOS training in vadapalani
IOS training in porur
Python Training in Chennai
Hadoop Training in Chennai
Big data training in chennai
JAVA Training in Chennai

banupriya said...

The blog you shared is very good. I expect more information from you like this blog. Thank you.
mvc training in chennai
mvc course in chennai
mvc chennai
mvc classes in chennai
HR course in chennai
ccnp course in chennai
silk test training in chennai
jbpm training in chennai