Get latest version number of the Google App Engine SDK - google-app-engine

I am writing a script to automatically download and update the installed version of the Google App Engine SDK. I can determine the installed version.
I currently need to make a wget request and check to see if it returns a 404 error; actually this is at least 2 requests, one to check for a bug fix update and a second to check for a minor version update.
I would like to avoid making these wget requests. To do this I need to determine the latest (stable not pre-release) version of the SDK. Is this info available via an API or other queryable source?

The python SDK checks for the current SDK when running the dev server. The launcher also has this facility.
This would be the method I would use.
For the command line sdk the python code that implements the check is https://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/tools/sdk_update_checker.py and as you pointed out the code for the launcher is https://code.google.com/p/google-appengine-wx-launcher/source/browse/trunk/launcher/app.py
The code performs an api RPC to http://appengine.google.com/api/updatecheck and gets a yaml response. So you can either use that code, or even just import and SDKUpdateChecker from sdk_checker.

The accepted answer has recently broken. http://appengine.google.com/api/updatecheck now returns a response like this with the latest release version set to 0.0.0:
$ curl -LSfs https://appengine.google.com/api/updatecheck
release: "0.0.0"
timestamp: 1586242881
api_versions: ['1']
supported_api_versions:
python:
api_versions: ['1']
python27:
api_versions: ['1']
go:
api_versions: ['go1', 'go1.9']
java7:
api_versions: ['1.0']
go111:
api_versions: [null]
The latest available version is 1.9.90 at
https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.90.zip
It is possible that there will be future versions (1.9.91, etc.) provided at a similar URL, but that remains to be seen. It looks like gcloud components install and gcloud components update can be used to install the SDK, though it may be more difficult to script it.
UPDATE:
https://cloud.google.com/appengine/docs/standard/python/sdk-gcloud-migration
As of July 30, 2019, the standalone App Engine SDK is deprecated. It will become unavailable for download on July 30, 2020.
gcloud is the way forward here, though I'm not sure of a good way to automate gcloud updates. If I find a good suggestion or come up with one, I'll update here.

Related

How to do AppEngine Go 1.16 local development?

AppEngine supports Go 1.16 for a year now. But dev_appengine.py still doesn't:
RuntimeError: Unknown runtime 'go116'; supported runtimes are 'custom', 'go', 'go111', 'go112', 'go113', 'go114', 'go115', 'java', 'java7', 'java8', 'php55', 'php72', 'php81', 'python', 'python-compat', 'python27', 'python310', 'python37', 'python38', 'python39'.
The official documentation is unhelpful.
How can I do local Go 1.16 development of my AppEngine app?
I assume you meant dev_appserver.py and not dev_appengine.py. If so, then
It looks like you're using GAE Standard env in which case, gcloud CLI version 409.0.0 (which seems to be the latest, at least for Mac) doesn't support go 1.1.6. The go runtimes supported in it are
go, go111, go112, go113, go114, go115
You can find the list of supported runtimes in the file
{{path to gcloud sdk_installation}}/platform/google_appengine/google/appengine/tools/devappserver2/runtime_factories.py
If you switch to GAE Flex, I believe you'll be able to use go 1.1.6 since you'll then be using a custom runtime
You can also just run your App as you would a standard go App e.g using command go run <go_package>

Go app engine dev_appserver.py doesn't support runtime go112

I am trying to migrate my Go app to runtime go112, but dev_appserver.py throw the following error:
RuntimeError: Unknown runtime 'go112'; supported runtimes are 'custom', 'go', 'go111', 'java', 'java7', 'java8', 'php55', 'php72', 'python', 'python-compat', 'python27', 'python37'.
Current Go version is 1.12.11
Edit: I used apt-get to install the SDK.
apt-get update && apt-get install google-cloud-sdk google-cloud-sdk-app-engine-python\
google-cloud-sdk-app-engine-python-extras\
google-cloud-sdk-app-engine-java\
google-cloud-sdk-app-engine-go\
google-cloud-sdk-datalab\
google-cloud-sdk-datastore-emulator\
google-cloud-sdk-pubsub-emulator\
google-cloud-sdk-cbt\
google-cloud-sdk-cloud-build-local\
google-cloud-sdk-bigtable-emulator\
kubectl -y
That way it seems I can't use gcloud components update and the packages are not up-to-date in the repos.
Now my questions is: Does google-cloud-sdk-app-engine-go support go runtime 1.12? If not, when will it support runtime 1.12?
Update: I installed cloud SDK and run gcloud components update successfully on another computer, dev_server.py still throw the same error. Does the local SDK actually support rumtime 1.12?
go112 runtime is not available on local dev_appserver.py. This has been discussed on the App Engine Go forum at
https://groups.google.com/forum/#!topic/google-appengine-go/kHxZ9zIb_QE
The expectation is that starting from go112 runtime, there is no "appengine" way of running the go server and works normally like any go server outside GAE. There are a few open issues like dispatching urls though.
It sounds like you gcloud SDK is an old version and not recognize "runtime: go112", please run this command in order to update your SDK.
gcloud components update
After the update you can be able to deploy an app engine service using GO 1.12 runtime, check the changes that you need to perform in you App.yaml in this link

appcfg.cmd java version; 1.7 installed; 1.6 in path; tells me it needs 1.6 ti yokiad

I try to use this command to deploy my application to
appspot.google.com:
c:\a\appeng\bin\appcfg.cmd --use_java7 update c:\a\u3e
Generates the error messsage.
C:\a>c:\a\appeng\bin\appcfg.cmd --use_java7 update c:\a\u3e
Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
has value '1.7', but '1.6' is required.
Error: could not find java.dll
Error: could not find Java SE Runtime Environment.
I tried setting the path to use the Java 1.6 SDK we downloaded
but that did not help or change any thing.
The web resources talk about what version of Java is used
by the application once it appears on Google's servers; I
did not see anything about the Java version for the upload
process including developers.google.com/appengine/docs/java/gettingstarted/uploading and developers.google.com/appengine/docs/java/tools/uploadinganapp#Command_Line_Arguments as well as searching this site specifically and checking google.
Can I deploy
an application from the computer in my house without
deinstalling the Java 1.7 I use for other purposes?
Thank you for looking at this question. I resolved the problem. It was not related to Google Application Development
Server. It was a difficult-to-resolve path problem to the directory where the Java executables were kept.

"ImportError: No module named _ssl" with dev_appserver.py from Google App Engine

Background
"In the Python runtime, we've added support for the Python SSL
Library, so you can now open secure connections to remote services
such as Apple's Push Notification service."
This quote is taken from a recent post on the Google App Engine blog.
Implementation
If you want to use native python ssl, you must enable it using the libraries configuration in your application's app.yaml file where you specify the library name "ssl" . . .
These instructions are provided for developers through the Google App Engine documentation.
The following lines have been added to the app.yaml file:
libraries:
- name: ssl
version: latest
This much is in line with the advice provided through the Google App Engine documentation.
Problem
I have tried running my project in three different configurations. Two are working, and one is not.
Working ...
After I upload my application to Google App Engine, and run my project through the live server, everything works fine.
Working ...
When I run my project with manage.py runserver and include the Google App Engine SKD in my PYTHONPATH, everything works fine.
Not Working ...
However, when I run my project with dev_appserver.py, I get the following error:
ImportError at /
No module named _ssl
Request Method: GET
Request URL: http://localhost:8080/
Django Version: 1.4.3
Exception Type: ImportError
Exception Value:
No module named _ssl
Exception Location: /usr/local/lib/google_appengine_1.7.7/google/appengine/tools/devappserver2/python/sandbox.py in load_module, line 856
Python Executable: /home/rbose85/Code/venvs/appserver/bin/python
Python Version: 2.7.3
Python Path:
['/home/rbose85/Code/product/site',
'/usr/local/lib/google_appengine_1.7.7',
'/usr/local/lib/google_appengine_1.7.7/lib/protorpc',
'/usr/local/lib/google_appengine_1.7.7',
'/usr/local/lib/google_appengine_1.7.7',
'/usr/local/lib/google_appengine_1.7.7/lib/protorpc',
'/usr/local/lib/google_appengine_1.7.7',
'/usr/local/lib/google_appengine_1.7.7/lib/protorpc',
'/home/rbose85/Code/venvs/appserver/lib/python2.7',
'/home/rbose85/Code/venvs/appserver/lib/python2.7/lib-dynload',
'/usr/lib/python2.7',
'/usr/local/lib/google_appengine',
u'/usr/local/lib/google_appengine_1.7.7/lib/django-1.4',
u'/usr/local/lib/google_appengine_1.7.7/lib/ssl-2.7',
u'/usr/local/lib/google_appengine_1.7.7/lib/webapp2-2.3',
u'/usr/local/lib/google_appengine_1.7.7/lib/webob-1.1.1',
u'/usr/local/lib/google_appengine_1.7.7/lib/yaml-3.10']
Server time: Wed, 24 Apr 2013 11:23:49 +0000
For the current GAE version (1.8.0 at least until 1.8.3), if you want to be able to debug SSL connections in your development environment, you will need to tweak a little bit the gae sandbox:
add "_ssl" and "_socket" keys to the dictionary _WHITE_LIST_C_MODULES in /path-to-gae-sdk/google/appengine/tools/devappserver2/python/sandbox.py
Replace the socket.py file provided by google in /path-to-gae-sdk/google/appengine/dis27 from the socket.py file from your Python framework.
IMPORTANT: Tweaking the sandbox environment might end up with functionality working on your local machine but not in production (for example, GAE only supports outbound sockets in production). I will recommend you to restore your sandbox when you are done developing that specific part of your app.
The solution by jmg works, but instead of changing the sdk files, you could monkey patch the relevant modules.
Just put something like this on the beginning of your project setup.
# Just taking flask as an example
app = Flask('myapp')
if environment == 'DEV':
import sys
from google.appengine.tools.devappserver2.python import sandbox
sandbox._WHITE_LIST_C_MODULES += ['_ssl', '_socket']
from lib import copy_of_stdlib_socket.py as patched_socket
sys.modules['socket'] = patched_socket
socket = patched_socket
I had to use a slightly different approach to get this working in CircleCI (unsure what peculiarity about their venv config caused this):
appengine_config.py
import os
if os.environ.get('SERVER_SOFTWARE', '').startswith('Development'):
import imp
import os.path
import inspect
from google.appengine.tools.devappserver2.python import sandbox
sandbox._WHITE_LIST_C_MODULES += ['_ssl', '_socket']
# Use the system socket.
real_os_src_path = os.path.realpath(inspect.getsourcefile(os))
psocket = os.path.join(os.path.dirname(real_os_src_path), 'socket.py')
imp.load_source('socket', psocket)
I had this problem because I wasn't vendoring ssl in my app.yaml file. I know the OP did that, but for those landing here for the OP's error, it's worth making sure lines like the following are in your app.yaml file:
libraries:
- name: ssl
version: latest
Stumbled upon this thread trying to work with Apples Push notification service and appengine... I was able to get this working without any monkey patching, by adding the SSL library in my app.yaml, as recommended in the official docs, hope that helps someone else :)
I added the code to appengine_config.py as listed by Spain Train, but had to also add the following code as well to get this to work:
phttplib = os.path.join(os.path.dirname(real_os_src_path), 'httplib.py')
imp.load_source('httplib', phttplib)
You can test if ssl is available at your local system by opening a python shell and typing import ssl. If no error appears then the problem is something else, otherwise you don't have the relevant libraries installed on your system. If you are using a Linux operating system try sudo apt-get install openssl openssl-devel or the relevant instructions for your operating system to install them locally. If you are using windows, these are the instructions.

appcfg.py and pre-release sdk issue

Downloaded python v 1.6.4 of sdk and get following message when running local devserver:
INFO 2012-04-01 20:08:10,177 appcfg.py:582] Checking for updates to the SDK.
INFO 2012-04-01 20:08:11,660 appcfg.py:616] This SDK release is newer than the advertised release.
Re-installed after unistalling both sdk and python 2.7 used fresh download multiple times issue repeats. Also unable to upload an application using appcfg.py
Command typed appcfg.py update appdrectory/
and it spits out standard text
Usage: appcfg.py [options]
Action must be one of:
backends: Perform a backend action.
backends configure: Reconfigure a backend without stopping it.
.....
Suspect is linked to fact that have pre-release appcfg.py
How to un-isntall pre-release sdk and put in latest release sdk Is something special to be done.?
Your syntax should be: python appcfg.py update <directory>.
Is this what you have done?

Resources