Software Coding

PHP Coding in the Cloud for Google App Engine

I love my Chromebook, and the whole idea of cloud computing. It’s great to have a single-login to GSuite (formerly Google Apps), and custom web-apps that easily integrate. But coding on my Chromebook has been — well — awkward. There are a number of Cloud-based IDEs (Cloud9, Codenvy), but none that really integrate well with Google App Engine.

One would think Google would provide great web-based tools. Maybe, probably, someday. But meanwhile – here is one way how to do it with the “basics” — GitHub (or other git repository) — and Google’s Cloud Shell.

    1. Create a Google App Engine Project (GAE).  You’ll need a unique name – like zork23 – it will wind up as zork23.appspot.com.
    2. Create a zork23 project on GitHub under youraccount on github, and you can edit the code right there on GitHub.
    3. Log into your Google Cloud Console and click on the Cloud Shell icon at right.

    shell

    1. You are now at a terminal of your very own virtual linux computer, with git and the gcloud tools installed. You can use git to manage a local copy of your app, and then use gcloud to deploy. A quick-start example of doing so with a python app is here.
    2. I had never used git from the command line before. To get your app, you clone it into your virtual computer computer:
      >cd ~/src
      >git clone https://youraccount@github.com/youraccount/zork23.git
    3. If you’ve worked with Google App Engine before, you’ve probably deployed using a tool called appcfg.py which references a special configuration file called app.yaml. gcloud has a few different requirements – you cannot specify the application name or the version in the app.yaml file. Instead you do:
      > cd ~/src/zork23
      > gcloud app deploy  ./app.yaml  –project=zork23  –version=1
    4. Then — you can jump back and forth between editing in github, and using the uparrow to keep running shell commands for updating:
      > git pull https://youraccount@github.com/youraccount/zork23.git
      > gcloud app deploy ./app.yaml –project=zork23 –version=1

    It really should not have to be this way, of course – both github and google could just have a nice little button that does this. But, in the meantime, this works smoothly for me.