Seems like google cloud's shell commands are super limited.
I can see docs about using appcfg.py to upload and download code from app engine, but what are the commands to just get basic info about it?
Is there a list services command? Or a get running versions command? I still don't understand where the app engine code I upload lives.
What are the commands to just "poke" app engine stuff?
To get info about what appcfg.py can do:
$ appcfg.py help
Usage: appcfg.py help <action>
appcfg.py: error: Expected a single action argument. Must be one of:
...
list_versions: List all uploaded versions for an app.
...
$ appcfg.py help list_versions
Usage: appcfg.py [options] list_versions [directory]
List all uploaded versions for an app.
The 'list_versions' command outputs the uploaded versions for each module of
an application in YAML. The YAML is in formatted as an associative array,
mapping module_ids to the list of versions uploaded for that module. The
default version will be first in the list.
...
A bit newer than appcfg.py and the officially recommended one these days (but still not covering all the stuff from the Console) is the gcloud CLI from the Cloud SDK (and in particular the gcloud app submenu for GAE apps).
Your uploaded code lives in the cloud :) Donno exactly where, but you can see it in the Console's Debug page. Not directly accessible from the cloud shell's VM (AFAIK). If you want to access it in the cloud shell you need to download it from your app to your "cloud homedir" (using one of the 2 utilities).
As for "poking", you have to be very specific as different kinds of poking are done in different ways (many in the GUI only). Probably better to do it in a separate question (or questions).
Related
I have been writing a pretty simple python quizz system (called game.py) and I am working to deploy it on heroku. The app functions exclusively within the confines of a python console, with no interface of any kind but that provided by a terminal.
As such, I would like to be able to have the application on Heroku simply be akin to what you obtain with a one-off dyno, available on the dashboard (or in a terminal with the CLI) with:
heroku run python game.py
The application works perfectly well in it's deployed form (exclusively from the Heroku git) and locally, but in order for the app to be available to a larger public, I would need to have such a console appear on the "https://[appname].herokuapp.com/" URL that you are given on deployment of the app.
Naively, I would think this to be unspeakably simple to pull off, but I have yet to find a way to do it.
The only reasonable thing I have found would have been to create a Procfile, but lacking any documentation on the commands available, I only have been able to try variations of:
web: run python game.py
Which doesn't create a web console. And:
web: bash
Which simply crash with error code h10, with no other information given.
Any help, any suggestion, any workaround you can think of would be extremely appreciated.
I have an App Engine app contains 3 modules and a dispatch.yaml. It works perfectly in production, however on the dev server (using GAE Launcher) only the default module is loaded.
The command which is run by the launcher:
Running command: "['D:\\Python27\\pythonw.exe', 'D:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=10081', '--admin_port=8002', 'D:\\path\\to\\my\\app']"
I know that when running dev_appserver.py using the command line it is possible to specify all modules as arguments. Is there a way of doing it when using the Launcher?
I believe this is done the same way as you do for an IDE like PyCharm, where you pass the yaml files (for each module) in the Extra Flags section.
Double-click the instance in App Engine Launcher
Under Extra Flags, add all the yaml files for your modules, separated by a space "app.yaml app2.yaml app3.yaml"
Bardia's answer is correct. However, after experiencing the problem myself and speaking with a GAE support engineer, I've added some further details. This information is currently missing from the official GAE documentation, but Google are planning to add it soon.
To use Google App Engine Launcher to 'Run' or 'Deploy' an application that uses modules you first need to:
Double click the application in Google App Engine Launcher, to bring up the Application Settings window.
Under Extra Flags, list the yaml files separated by spaces. Specify the full file path. If you are using a routing file, dispatch.yaml, list it first. Don't include app.yaml as this is already included by default.
e.g. /Users/.../dispatch.yaml /Users/.../app2.yaml /Users/.../app3.yaml
There is also a blog post, which explains how to do it, here:
http://www.shiftedup.com/2014/11/11/running-modules-locally-using-the-googleappenginelauncher-application
Update
Yaron commented that this method only works when you click the 'Run' button to run on localhost, but it doesn't work when you click 'Deploy' to deploy to production. I checked and I had the same problem, so I contacted Google support. They advised me that Google App Engine Launcher is now archived and is no longer supported. Instead we should use the new 'gcloud preview app deploy' command.
To deploy multiple modules, type the following into the command line:
gcloud preview app deploy ~/my_app/app.yaml \
~/my_app/another_module.yaml
Which is a shame, because I quite liked Google App Engine Launcher.
I'm trying to create a KhanAcademy (KA) clone on Google App Engine (GAE). I downloaded the offline version of KA (http://code.google.com/p/khanacademy/downloads/list) for Mac, and set it up with GoogleAppEngineLauncher (https://developers.google.com/appengine/). Because KA was produced on Python 2.5, I have the setup running through the Python 2.5 included in the KA offline version download, and I added these extra flags to the app (to essentially duplicate the functionality of the included Run file):
--datastore_path=/Users/Tadas/KhanAcademy/code/datastore --use_sqlite
As is, GAELauncher is able to get that up and running perfectly fine on a localhost. However, to get it up on my Google appspot domain, I need to change the application name in app.yaml. When I change "application: khan-academy" in app.yaml to a new name and try to run the local version via GAELauncher (or the included Run file), the site comes up but all the content (exercises, etc.) has disappeared (essentially, the site loses most of its functionality). If I try to "Deploy" the app in this state, I received a 500 Server Error when I try to go on the appspot website. Any ideas as to what could be going wrong?
Thanks.
The problem is that your 'clone' application does not have access to Khans Academy's AppEngine datastore so there is no content to display. Even if you do use all of the code for their application, you are still going to have to generate all of your own content.
Even if you are planning to 'clone' their content, too, you are going to have to do a lot of probably manual work to get it in to your application's datastore.
I've heard that other platforms support auto-deployment of their code to production when they push changes to their Git repository.
Can I set up something similar to this for AppEngine? How?
I'm using Python2.7 on Windows, and bitbucket as a repository.
Thanks!
Since app engine deploy is just a python script, why can't you just write a shell script that calls 'git push' followed by 'python appcfg.py deploy'?
Any bitbucket hooks that will send from bitbucket->appengine after you upload to app is probably a bad idea since it will require storing your app engine login credentials on github.
Other projects might have your app server pull from github/bitbucket. You can do this if your app engine site just serves static websites using http://drydrop.binaryage.com/, but you can't update actual running code this way.
Recently, App Engine added Push to Deploy features: https://developers.google.com/appengine/docs/push-to-deploy
It only has built in support for GitHub, but it might still be possible to configure BitBucket to work with it.
I have a python script that is intended to run on my local machine every night. It's goal is to pull data from a third party server, do some processing on it, and execute bulk upload to GAE datastore.
My issue though is hot to run bulk upload from a python script. All examples I have seen (including Google's documentation) use command line "appcfg.py upload_data ..." and as far as I can see appcfg.py and bulkloader.py do not expose any API that is guaranteed not to change.
My two options as I see them now is to either execute "appcfg.py upload_data ..." command from my python script, which seems a roundabout way of doing things. Or to directly call appcfg.py's internal methods, which means I have to recode tings in case they change.
Appengine can run cron jobs. All you need is to write is a single script which pulls the data from third party server and upload it to appengine engine, Appenigne will do the rest for you. Appengine cron this has everything you need to know about running a cron job in appengine
This answer is now outdated. Please see the below link for my latest answer for bulk upload data to app engine.
How to upload data in bulk to the appengine datastore? Older methods do not work