Giter Club home page Giter Club logo

frankenserver's Introduction

☢ F̩̖R͚̬̹̻̲ͅA̳͕̠͝N̠̥̬̳͔͇͞ͅK̤̟̳̮̬̩̙͘E̞̩̬̼͔̫N̙̳̥̲̥̬͎S̰̠̠̭̲E͖R͚͍̜V̱̮E̸R̝ ☢

Introduction

frankenserver (technically, frankenserver's monster) is a fork of the Google App Engine SDK with modifications required by Khan Academy. It is specifically targeted at the Python SDK running on Mac OS X or Linux. Other App Engine runtimes and operating systems should work normally but are not tested or supported.

frankenserver's biggest advantage over the vanilla SDK is in how it watches the files in your app for changes. It does this much more efficiently by 1) using a native FSEvents-based file watcher on Mac OS X and 2) respecting the skip_files directive in your app.yaml.

Installation

For Khan Academy developers: frankenserver is a subrepo of webapp so there's nothing to install (assuming you've run make deps). Simply run make serve to serve webapp using frankenserver.

For others: Just git clone this repository into a convenient location and set up a symlink or shell alias for running python python/dev_appserver.py with your desired dev_appserver.py flags. To enable the FSEvents-based file watcher on Mac OS X you'll also need to run pip install -r requirements.txt (highly recommended).

Extra credit

  • Set up Desmond's Technicolor Yawn to give your request logs some color. (Khan Academy developers: make serve will automatically use this if you have it installed.)

  • Khan Academy developers: use multitail to interleave the logs from frankenserver and kake, our build system, in a single terminal window. (You can run tail -f genfiles/kake-server.log from your webapp directory to get kake's log output.)

Dealing with the upstream codebase

The github repo is typically behind the release tarballs, so we update from upstream using the tarballs.

  1. Install gcloud (if you've run khan-dotfiles this will not be necessary), plus the relevant components: gcloud components install app-engine-python app-engine-python-extras
  2. Find your gcloud install (normally ~/google-cloud-sdk, or ~/khan/devtools/google-cloud-sdk if you used khan-dotfiles for step 1); we're going to want to grab platform/google_appengine from within it.
  3. Create a new branch: git checkout master && git checkout -b <gae version>
  4. Replace the old code with the new: rm -rf python ; cp -R ~/path/to/platform/google_appengine python
  5. Sadly, upstream no longer sets the right file permissions (because gcloud has its own binary wrappers), so revert all the permissions changes with git diff -p -R | grep -E "^(diff|(old|new) mode)" | git apply
  6. git add -A .
  7. git commit -am 'Pristine copy of <gae version>, without patches applied' (You can find the version on the release notes page: https://cloud.google.com/appengine/docs/standard/python/release-notes.)
  8. (Now comes the hard part: cherry-picking the frankenserver changes from a previous branch.)
  9. Run git log to see all the frankenserver changes; stop when you get to the 'Pristine copy of ' log message (or something similar). Note that commit.
  10. Do git log --format=%h --no-merges <commit>..HEAD^. Alternately, if you're curious what these commits are, just do git log --oneline --no-merges <commit>..HEAD^. e.g. git log --oneline --no-merges 526771777..HEAD^
  11. Run git cherry-pick <commit>..HEAD^. (Or, especially in case of conflicts, it may be easier to cherry-pick each commit one at a time.)
  12. Run python/run_tests.py. Or, since it may not actually run successfully, just do whatever testing seems reasonable -- run a few e2e tests against your dev server; load some pages; and test anything else you think suspect. For example, as of Feb 2019, I ran the following (the tests are somewhat arbitrary):
    virtualenv ~/.virtualenv/frankenserver -p python2  # create fresh venv
    source ~/.virtualenv/frankenserver/bin/activate
    pip install mock
    PYTHONPATH=. ./run_tests.py google.appengine.tools.devappserver2.{devappserver2_test,inotify_file_watcher_test,python.runtime.runtime_test}
    
    plus I ran some (arbitrary) e2e tests from webapp as a more end-to-end test of the dev server:
    tools/runtests.py --max-size=large coaches/end_to_end/coach_invitations_e2etest.py assignments/end_to_end/auto_assign_e2etest.py
    

frankenserver's People

Contributors

benjaminjkraft avatar bpollack avatar csilvers avatar dkapadia avatar dmnd avatar itsjohncs avatar jeremywiebe avatar latteier avatar mpolyak avatar timc13 avatar wchargin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

frankenserver's Issues

bad runtime process port

Hi,

Just started using frankenserver as it uses fsevents on OSX, but I keep seeing this error every time I open my app in the browser.

$ frankenserver/python/dev_appserver.py app.yaml
INFO     2016-04-30 12:07:56,491 sdk_update_checker.py:229] Checking for updates to the SDK.
INFO     2016-04-30 12:07:56,822 api_server.py:205] Starting API server at: http://localhost:64582
INFO     2016-04-30 12:07:56,832 dispatcher.py:198] Starting module "default" running at: http://localhost:8080
INFO     2016-04-30 12:07:56,839 admin_server.py:116] Starting admin server at: http://localhost:8000
ERROR    2016-04-30 12:08:05,802 http_runtime.py:391] bad runtime process port ['127.0.0.1\t64614\n']
ERROR    2016-04-30 12:08:05,805 http_runtime.py:391] bad runtime process port ['127.0.0.1\t64615\n']
ERROR    2016-04-30 12:08:05,806 http_proxy.py:116] bad runtime process port ['127.0.0.1\t64615\n']
INFO     2016-04-30 12:08:05,913 module.py:803] default: "GET / HTTP/1.1" 500 47
ERROR    2016-04-30 12:08:06,032 http_proxy.py:116] bad runtime process port ['127.0.0.1\t64614\n']
INFO     2016-04-30 12:08:06,137 module.py:803] default: "GET /favicon.ico HTTP/1.1" 500 47

It seems that http_runtime.py failed to find a port, instead it returns host + port. I'm using OSX 10.11.4, Python 2.7.11 from Homebrew, and my app uses the Go runtime. Is there anything I can do about this? Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.