I am unable to deploy my App Engine Flex Python project with split health checks.
I have enabled health checks:
$ gcloud beta app describe
...
featureSettings:
splitHealthChecks: true
Using the docs as a model, my app.yaml has:
readiness_check:
path: '/health_check'
check_interval_sec: 5
timeout_sec: 4
failure_threshold: 2
success_threshold: 2
app_start_timeout_sec: 600
liveness_check:
path: '/health_check'
check_interval_sec: 30
timeout_sec: 4
failure_threshold: 2
success_threshold: 2
But when I deploy, it fails due to the following error:
File "/env/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 515, in spawn_worker
worker.init_process()
File "/env/local/lib/python2.7/site-packages/gunicorn/workers/gthread.py", line 109, in init_process
super(ThreadWorker, self).init_process()
File "/env/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 122, in init_process
self.load_wsgi()
File "/env/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 130, in load_wsgi
self.wsgi = self.app.wsgi()
File "/env/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/env/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/env/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/env/local/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
__import__(module)
File "/env/local/lib/python2.7/site-packages/vmruntime/wsgi.py", line 48, in <module>
wsgi_config.get_module_config_filename())
File "/env/local/lib/python2.7/site-packages/vmruntime/wsgi_config.py", line 48, in get_module_config
return appinfo_includes.Parse(f)
File "/env/local/lib/python2.7/site-packages/google/appengine/api/appinfo_includes.py", line 57, in Parse
appyaml, _ = ParseAndReturnIncludePaths(appinfo_file, open_fn)
File "/env/local/lib/python2.7/site-packages/google/appengine/api/appinfo_includes.py", line 82, in ParseAndReturnIncludePaths
appyaml = appinfo.LoadSingleAppInfo(appinfo_file)
File "/env/local/lib/python2.7/site-packages/google/appengine/api/appinfo.py", line 2417, in LoadSingleAppInfo
listener.Parse(app_info)
File "/env/local/lib/python2.7/site-packages/google/appengine/api/yaml_listener.py", line 227, in Parse
self._HandleEvents(self._GenerateEventParameters(stream, loader_class))
File "/env/local/lib/python2.7/site-packages/google/appengine/api/yaml_listener.py", line 178, in _HandleEvents
raise yaml_errors.EventError(e, event_object)
EventError: Unexpected attribute 'failure_threshold' for object of type ReadinessCheck.
I'm following the documentation so I'm not sure why it would be triggering an error here.
The only thing I can imagine is that my 'site-packages' is perhaps out of date? I don't believe my Docker should install any google/appengine/ libraries, but I'm at a loss for what I could be doing wrong.
So seems the above failure scenario is caused by the gcr.io/google_appengine/python-compat-multicore docker image being out of date.
The github is up to date with the latest python files, but the associated Docker image was never rebuilt.
I have fixed this particular error by checking out the github and rebuilding the docker image myself, and pointing my appengine flex stuff at my own parent-built-image.
(I now have a separate problem, with split healthchecks being sent to the default paths, and it not letting me override the paths. I have filed that as bug in the Google cloud issue tracker. But at least the above question is now solved for me)
Related
I am trying to setup a ReactJS workspace in VSCode for Parabol. While executing the command yarn db:start, I am receiving the below exception.
yarn run v1.22.11
$ docker-compose -f docker/dev.yml up -d
Traceback (most recent call last):
File "docker\api\client.py", line 214, in _retrieve_server_version
File "docker\api\daemon.py", line 181, in version
File "docker\utils\decorators.py", line 46, in inner
File "docker\api\client.py", line 237, in _get
File "requests\sessions.py", line 543, in get
File "requests\sessions.py", line 530, in request
File "requests\sessions.py", line 643, in send
File "requests\adapters.py", line 439, in send
File "urllib3\connectionpool.py", line 670, in urlopen
File "urllib3\connectionpool.py", line 392, in _make_request
File "http\client.py", line 1255, in request
File "http\client.py", line 1301, in _send_request
File "http\client.py", line 1250, in endheaders
File "http\client.py", line 1010, in _send_output
File "http\client.py", line 950, in send
File "docker\transport\npipeconn.py", line 32, in connect
File "docker\transport\npipesocket.py", line 23, in wrapped
File "docker\transport\npipesocket.py", line 72, in connect
File "docker\transport\npipesocket.py", line 52, in connect
pywintypes.error: (2, 'CreateFile', 'The system cannot find the file specified.')
I am pretty new to ReactJS and have little to no idea on what to do to setup this workspace. Would be much grateful for any help.
Bruce here from Parabol. Thanks for your interest in our app!
For the issue you have seen, can you check:
You have Docker up and running
You run yarn db:start from the root of the repository
Feel free to create an issue in our repo and we will be more than happy to help you!
I did a gcloud components update 2 days ago and started getting this error when i run dev_appserver.py
(venv) myusername#mymachine:~/projects/myproject$ dev_appserver.py ./ --host 0.0.0.0 --port 8002 --enable_console --env_var GCS_TOKEN=ya29........YJDQAnp772B0
INFO 2019-03-13 23:45:31,205 devappserver2.py:278] Skipping SDK update check.
INFO 2019-03-13 23:45:31,268 api_server.py:275] Starting API server at: http://localhost:64587
INFO 2019-03-13 23:45:31,319 dispatcher.py:256] Starting module "default" running at: http://0.0.0.0:8002
INFO 2019-03-13 23:45:31,325 admin_server.py:150] Starting admin server at: http://localhost:8000
/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/mtime_file_watcher.py:182: UserWarning: There are too many files in your application for changes in all of them to be monitored. You may have to restart the development server to see some changes to your files.
'There are too many files in your application for '
INFO 2019-03-13 23:45:35,237 instance.py:294] Instance PID: 29760
appengine_config
requests.__version__ 2.21.0
Appengine config done
4
ERROR 2019-03-13 23:45:35,986 wsgi.py:263]
Traceback (most recent call last):
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/Users/myusername/projects/myproject/main.py", line 34, in <module>
from bp_includes.lib.error_handler import handle_error
File "/Users/myusername/projects/myproject/bp_includes/lib/error_handler.py", line 15, in <module>
from bp_includes.lib import jinja_bootstrap
File "/Users/myusername/projects/myproject/bp_includes/lib/jinja_bootstrap.py", line 7, in <module>
from src.handlers.utils import ordinal
File "/Users/myusername/projects/myproject/src/handlers/utils.py", line 14, in <module>
from lib.pytz.gae import pytz
File "/Users/myusername/projects/myproject/lib/pytz/__init__.py", line 29, in <module>
from pkg_resources import resource_stream
File "/Users/myusername/projects/myproject/lib/pkg_resources/__init__.py", line 1022, in <module>
class Environment(object):
File "/Users/myusername/projects/myproject/lib/pkg_resources/__init__.py", line 1025, in Environment
def __init__(self, search_path=None, platform=get_supported_platform(),
File "/Users/myusername/projects/myproject/lib/pkg_resources/__init__.py", line 263, in get_supported_platform
plat = get_build_platform()
File "/Users/myusername/projects/myproject/lib/pkg_resources/__init__.py", line 472, in get_build_platform
INFO 2019-03-13 23:45:36,002 module.py:861] default: "GET /_ah/warmup HTTP/1.1" 500 -
version = _macosx_vers()
File "/Users/myusername/projects/myproject/lib/pkg_resources/__init__.py", line 439, in _macosx_vers
version = platform.mac_ver()[0]
File "/Users/myusername/projects/myproject/venv/lib/python2.7/platform.py", line 764, in mac_ver
info = _mac_ver_xml()
File "/Users/myusername/projects/myproject/venv/lib/python2.7/platform.py", line 741, in _mac_ver_xml
pl = plistlib.readPlist(fn)
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 75, in readPlist
pathOrFile = open(pathOrFile)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime/stubs.py", line 284, in __init__
raise IOError(errno.EACCES, 'file not accessible', filename)
IOError: [Errno 13] file not accessible: '/System/Library/CoreServices/SystemVersion.plist'
I originally installed gcloud with brew cask install google-cloud-sdk in case that's relevant
It looks like the problem was introduced in gcloud 238.0.0 probably with gcloud app Python Extensions 1.9.84. You can downgrade gcloud to lower version with:
gcloud components update --version 237.0.0
I got it to work by doing the following in appengine_config.py, but I'm hoping that someone has a better solution
try:
from google.appengine.tools.devappserver2.python.runtime.stubs import FakeFile
FakeFile._allowed_dirs.update(['/System/Library/CoreServices/'])
except ImportError:
pass
you can delete the lib folder where you requirements are installed and reinstall it worked for me
pip install -t "lib" -r requirements.txt
I have an Flask app running on Google App Engine. I am trying to configure ereporter as per the instructions in this link.
I get the following error when I try to run my app using dev_appserver.py
Traceback (most recent call last):
File "/Users/xxx/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 82, in <module>
_run_file(__file__, globals())
File "/Users/xxx/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 78, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1001, in <module>
main()
File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 994, in main
dev_server.start(options)
File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 754, in start
options.config_paths)
File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 632, in __init__
module_configuration = ModuleConfiguration(config_path)
File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 97, in __init__
self._config_path)
File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 316, in _parse_configuration
config, files = appinfo_includes.ParseAndReturnIncludePaths(f)
File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/api/appinfo_includes.py", line 81, in ParseAndReturnIncludePaths
appyaml = appinfo.LoadSingleAppInfo(appinfo_file)
File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/api/appinfo.py", line 1873, in LoadSingleAppInfo
listener.Parse(app_info)
File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/api/yaml_listener.py", line 226, in Parse
self._HandleEvents(self._GenerateEventParameters(stream, loader_class))
File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/api/yaml_listener.py", line 177, in _HandleEvents
raise yaml_errors.EventError(e, event_object)
google.appengine.api.yaml_errors.EventError: threadsafe cannot be enabled with CGI handler: $PYTHON_LIB/google/appengine/ext/ereporter/report_generator.py
in "cfc-melbourne/app.yaml", line 51, column 1
app.yaml
# Handlers tell app engine how to route requests to your application.
handlers:
# This handler configures cron.yaml
- url: /_ereporter.*
script: $PYTHON_LIB/google/appengine/ext/ereporter/report_generator.py
login: admin
cron.yaml
cron:
- description: Daily exception report
url: /_ereporter?sender=xxx.xxx#gmail.com&delete=false&date=dd-mmm-yyyy # The sender must be an app admin.
schedule: every day 22:05
main.py
from google.appengine.ext import ereporter
ereporter.register_logger()
What am I missing ?
The problem is not flask, the problem is outdated documentation, because the configuration that is shown is for applications with threadsafe in false. for applications with threadsafe in true the configuration is below
- url: /_ereporter.*
script: google.appengine.ext.ereporter.report_generator.application
login: admin
this information is taken from https://groups.google.com/forum/#!topic/google-appengine/0v9KqB5Q8sQ
When I follow Google-Developers' tutorial for creating a simple application in Go using App Engine SDK for Go, while running the command
goapp serve
I receive the following error:
Traceback (most recent call last):
File "/home/kamal/go_appengine/dev_appserver.py", line 82, in <module>
_run_file(__file__, globals())
File "/home/kamal/go_appengine/dev_appserver.py", line 78, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/home/kamal/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1001, in <module>
main()
File "/home/kamal/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 994, in main
dev_server.start(options)
File "/home/kamal/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 754, in start
options.config_paths)
File "/home/kamal/go_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 632, in __init__
module_configuration = ModuleConfiguration(config_path)
File "/home/kamal/go_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 97, in __init__
self._config_path)
File "/home/kamal/go_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 316, in _parse_configuration
config, files = appinfo_includes.ParseAndReturnIncludePaths(f)
File "/home/kamal/go_appengine/google/appengine/api/appinfo_includes.py", line 81, in ParseAndReturnIncludePaths
appyaml = appinfo.LoadSingleAppInfo(appinfo_file)
File "/home/kamal/go_appengine/google/appengine/api/appinfo.py", line 1873, in LoadSingleAppInfo
listener.Parse(app_info)
File "/home/kamal/go_appengine/google/appengine/api/yaml_listener.py", line 226, in Parse
self._HandleEvents(self._GenerateEventParameters(stream, loader_class))
File "/home/kamal/go_appengine/google/appengine/api/yaml_listener.py", line 177, in _HandleEvents
raise yaml_errors.EventError(e, event_object)
google.appengine.api.yaml_errors.EventError: Unknown url handler type.
URLMap
auth_fail_action=redirect
static_dir=None
secure=default
http_headers=None
url=/.*
static_files=None
expiration=None
upload=None
api_endpoint=None
script=None
application_readable=None
position=None
login=optional
mime_type=None
require_matching_file=None
in "myapp/app.yaml", line 8, column 1
error while running dev_appserver.py: exit status 1
I don't know how to debug it. Just a hint would be sufficient.
Also, can it be because I have no web server installed? Do I have to install Apache or Nginx for goapp serve or go handles the server stuff itself?
The problem was indentation of script in handlers in .yaml file.
I initially did it like this:
handlers:
- url: /.*
script: _go_app
While it should be:
handlers:
- url: /.*
script: _go_app
It works now!
Just to make sure I have the setup right in my current django project, I did the following:
added south to installed_apps
manage.py syncdb (using windows)
manage.py convert_to_south app
I didn't make changes to my database yet but whether or not I do, I run:
manage.py schemamigration app --auto
and I get the following errors:
Traceback (most recent call last):
File "manage.py", line 17, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 443, in execute
_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 196, in run_from_ar
gv
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 232, in execute
output = self.handle(*args, **options)
File "C:\Python27\lib\site-packages\south\management\commands\schemamigration.py", line 98, i
n handle
old_orm = last_migration.orm(),
File "C:\Python27\lib\site-packages\south\utils.py", line 62, in method
value = function(self)
File "C:\Python27\lib\site-packages\south\migration\base.py", line 418, in orm
return FakeORM(self.migration_class(), self.app_label())
File "C:\Python27\lib\site-packages\south\orm.py", line 46, in FakeORM
_orm_cache[args] = _FakeORM(*args)
File "C:\Python27\lib\site-packages\south\orm.py", line 125, in __init__
self.models[name] = self.make_model(app_label, model_name, data)
File "C:\Python27\lib\site-packages\south\orm.py", line 318, in make_model
field = self.eval_in_context(code, app, extra_imports)
File "C:\Python27\lib\site-packages\south\orm.py", line 236, in eval_in_context
return eval(code, globals(), fake_locals)
File "<string>", line 1
SouthFieldClass(default=datetime.datetime(2012, 9, 14, 20, 46, 3, 957000, tzinfo=<UTC>))
^
SyntaxError: invalid syntax
What's going on?
It's not letting me use schemamigration. Been searching a lot of places and deleting and resetting the database and everything, can't seem to find out what the problem is.
Problem resolved:
Didn't know about south_migrationhistory location. I was always wondering about where some extra information was hanging.
Have a look here: http://south.aeracode.org/ticket/1069
Its a bug that is fixed in newer South versions. It seems you are using an obsolete version of South(<=0.7.3)