Thursday, 15 March 2012

google app engine - How can I debug a Dart AppEngine app -



google app engine - How can I debug a Dart AppEngine app -

i'm able run dart app using

class="lang-bash prettyprint-override">gcloud --verbosity debug preview app run app.yaml

and deploy , run on appengine

class="lang-bash prettyprint-override">gcloud --verbosity debug preview app deploy app.yaml

but haven't found way connect debugger dart app running on development server.

i found http://dartbug.com/21067 still couldn't find way create work.

see https://groups.google.com/a/dartlang.org/forum/#!topic/cloud/ok1njtg7ajq

update 2015-02-27

the app can run without docker , debugged dart command line application: source. https://groups.google.com/a/dartlang.org/d/msg/cloud/zrxgohfz_la/q5cdllqpbagj

the api server part of app engine sdk, , using running tests in appengine package. if @ https://github.com/dart-lang/appengine/blob/master/tool/run_tests.sh see expects environment variable appengine_api_server.

the api server in /platform/google_appengine/api_server.py

and takes number of arguments. tested running this:

$ $cloud_sdk/platform/google_appengine/api_server.py \ -a dev~test-application \ --api_port 4444 \ --high_replication \ --datastore_path /tmp/datastore

to run app engine application outside normal development server requires number of environment variables set. worked application:

$ gae_long_app_id=test-application \ gae_module_name=default \ gae_module_version=version \ gae_partition=dev \ api_port=4444 \ api_host=127.0.0.1 \ dart bin/server.dart

in dart editor cannot set environment variables each launch configuration, have set globally before starting dart editor. in webstorm possible have run configuration specific environment variables.

this simple setup of cause not back upwards normal development server support. of issues are:

only 1 application @ time listening on port 8080 (can made configurable) * users api (mocking shouldn't difficult) * modules api * no health-checks (should not problem) * http headers direct client (no x-appengine- headers) * admin web interface not available * other stuff well

this experimental, 1 solution simpler developer setup, of cause not match deployment environment closely development server.

running api server using docker possible image google/cloud-sdk cloud sdk on hub.docker.com.

use next dockerfile

from google/cloud-sdk expose 4444 entrypoint ["/google-cloud-sdk/platform/google_appengine/api_server.py", \ "-a", "dev~test-application", \ "--api_port", "4444", \ "--high_replication", \ "--datastore_path", "/tmp/datastore"]

build , run

$ docker build -t api_server . $ docker run -d -p 4444:4444 api_server

change api_host above 192.166.59.103 (of wherever docker containers are) , run.

regards, søren gjesse

update 2014-11-27

debugging darteditors debugger started working bleeding dart build 1.8.0.edge_042017. assume next dev build (probably 1.9.0-dev1.0) include related fixes well?

detailed steps how works can found here: https://groups.google.com/a/dartlang.org/d/msg/cloud/ok1njtg7ajq/u-gzudi-0vij

build custom docker image latest dart dev build 1.8.0-dev.4.6. dart team preparing easy way (see https://github.com/dart-lang/dart_docker)

installe latest bleeding_edge on host scheme (using script https://gist.github.com/zoechi/d240f56a32ed5649797f or manual download http://gsdview.appspot.com/dart-archive/channels/be/raw/latest/editor/darteditor-linux-x64.zip)

add app.yaml file

class="lang-yaml prettyprint-override">env_variables: dbg_enable: 'true' # disable health-checking because annoying during debugging vm_health_check: enable_health_check: false

see how disable health checking `gcloud preview app run` more details customizing health checking.

launch server code of app glcoud --verbosity debug app run app.yaml or glcoud --verbosity debug app run app.yaml index.yaml

wait until docker container ready (check docker ps if command column shows value starting /dart_runtime/dart_

open darteditor

open menu run > remote connection...

connect to: command-line vm

host: localhost if dont useboot2dockeror ip address returned commandboot2docker ip`

port: 5005

select folder... select directory contains source code of project.

click ok

set breakpoints , go on usual.

old

a first step using observatory includes browser based debugger ui.

to create work add together next lines app.yaml file

class="lang-yaml prettyprint-override">network: forwarded_ports: ["8181"]

this might useful create server.dart wait until had chance set breakpoints using observatory.

class="lang-dart prettyprint-override">env_variables: dart_vm_options: '--pause-isolates-on-start'

boot2docker gives docker ip (192.168.59.103) , after starting gcloud preview app run app.yaml can connect http://192.168.59.103:8181 should open observatory gui.

google-app-engine dart

No comments:

Post a Comment