views:

222

answers:

3

In order to redeploy a GAE application, I currently have to install the GAE deployment tools on the system that I am using for deployment. While this process is relatively straight forward, the deployment process is a manual process that does not work from behind a firewall and the deployment tools must be installed on every machine that will be used for updating GAE apps. A more ideal solution would be if I could update a GAE application from another GAE application that I have deployed previously. This would remove the need to have multiple systems configured to deploy apps.

Since the GAE deployment tools are written in Python and the GAE App Engine supports Python, is it possible to modify appcfg.py to work from within GAE? The use case would be to pull a project from GitHub or some other online repository and update one GAE application from another GAE app. If this is not possible, what is the limiting constraint?

+2  A: 

One limiting constraint could be the protocol that the python sdk uses to communicate with the GAE servers. If it only uses HTTP, you might be OK. but if it's anything else, you might be out of luck because you can't open a socket directly from within GAE.

Peter Recore
It's HTTP. *extra text SO demands to make my message long enough*
Nick Johnson
A: 

What problem did you have by trying to update behind a firewall?

I've got some, but finally I manage to work around them.

About your question, the constraint is that you cannot write files into a GAE app, so even though you could possibly pull from the VCS you can't write those pulled files.

So you would have to update from outside the GAE in first place.

Anyway every machine that needs to update the GAE should have the SDK anyway just to see if they changes work.

So, If you really want to do this you have two alternatives:

  1. Host your own "updater" site and istall the SDK there, then when you want to update log into your side ( or run a script ) and do the remote update.

  2. Although I don't know Amazon EC2 well, I think you can do pretty much the same thing as op 1 from there.

Finally I think the password to update has to be typed always. ( you could have the SDK of the App engine and modify that, because it is open source )

OscarRyz
+5  A: 

Is it possible? Yes. The protocol appcfg uses to update apps is entirely HTTP-based, so there's absolutely no reason you couldn't write an app that's capable of deploying other apps (or redeploying itself - self-modifying code)! You may even be able to reuse large parts of appcfg.py to do it.

Is it easy? Probably not. It's quite likely you'll need to understand a decent chunk of appcfg's internals, and the RPCs it uses to upload new apps - not a trivial undertaking. You'll also need to store your credentials in the app, in all likelihood - though you can use a role account that is and admin only for the apps it's deploying to minimize risk there.

Nick Johnson
What about the: "...to pull a project from GitHub or some other online repository and update one GAE application.." part? While is possible to programatically pull from the VCS, you can't store files into GAE. So, the option would be to either keep them in memory, or store them. Then, you not only have to tweak the appcfg t for the authentication, but also for the fetch from db, the transformation into something meaningful and the upload.
OscarRyz
You can fetch-and-upload one file at a time for the new app version - there's no need to fetch and store them all. Only modified files need to be uploaded, too, which reduces the number of operations required.
Nick Johnson