If needed, add these lines to your ~/.profile file and restart on MacOS 10.8:

setenv DYLD_LIBRARY_PATH /usr/local/mysql/lib/

setenv VERSIONER_PYTHON_PREFER_64_BIT no

setenv VERSIONER_PYTHON_PREFER_32_BIT yes

In Mac OSX 10.11.1, if you see errors about failing to import MySQLdb or that _mysql.so references an untrusted relative path, then run: sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /Library/Python/2.7/site-packages/_mysql.so

Set up one master SQL database. (You can keep the same sharding options in settings.py that you have configured for production.).

mysql --user=root monorail < schema/framework.sql

mysql --user=root monorail < schema/project.sql

mysql --user=root monorail < schema/tracker.sql

Configure the site defaults in settings.py. You can leave it as-is for now.

Set up the front-end development environment:

Make sure you've run gclient runhooks, which will install the correct versions of node and npm.

Run npm install -g bower to install Bower.

Run the app:

You can use ‘make serve’, or

Run the app with AppEngine dev_appserver.py with the command: ../../../google_appengine/dev_appserver.py --mysql_user=root app.yaml module-besearch.yaml

Browse the app at localhost:8080 your browser.

Optional: Create/modify your Monorail User row in the database and make that user a site admin.

UPDATE User SET is_site_admin = TRUE WHERE email = 'YOUR@EMAIL';

Restart your local dev appserver.

Instructions for deploying Monorail to an existing instance or setting up a new instance are here.

Here's how to run unit tests from the command-line:

Testing

To run all Python unit tests, in the appengine/monorail directory run:

make test

For quick debugging, if you need to run just one test you can do the following. For instance for the test IssueServiceTest.testUpdateIssues_Normal in services/test/issue_svc_test.py:

Troubleshooting

TypeError: connect() argument 6 must be string, not None This occurs when your mysql server is not running. Check if it is running with ps aux | grep mysqld. Start it up with /etc/init.d/mysqld start on linux, or just mysqld.

dev_appserver says OSError: [Errno 24] Too many open files and then lists out all source files dev_appserver wants to reload source files that you have changed in the editor, however that feature does not seem to work well with multiple GAE modules and instances running in different processes. The workaround is to control-C or kill the dev_appserver processes and restart them.