commit | ac4a6449a29b55f1314699841037b405234ef6df | [log] [tgz] |
---|---|---|
author | Adrià Vilanova MartÃnez <me@avm99963.com> | Sun May 15 19:05:13 2022 +0200 |
committer | gerritbot <gerritbot@avm99963.com> | Sun May 15 19:43:17 2022 +0200 |
tree | edea24d63961ed429503d4b7af66bdb5a645747f | |
parent | f779fa013a7948106b73568525602c66c658d734 [diff] |
Merge branch 'main' into avm99963-monorail Merged commit 4137ed7879acadbf891e8c471108acb874dae886. GitOrigin-RevId: b6100ffc5b1da355a35f37b13fcaaf746ee8b307
This repo is a fork of the open-source Monorail issue tracker designed to run at bugs.avm99963.com. I've made the code public so it can inspire other developers to host relatively cheap Monorail instances.
Monorail development should generally be contributed upstream, this repo will only accept changes specific to small and relatively cheap instances.
The original README.md file is here below (slightly modified where applicable):
Monorail is the Issue Tracker used by the Chromium project and other related projects. It is hosted at bugs.chromium.org.
If you wish to file a bug against Monorail itself, please do so in our self-hosting tracker. We also discuss development of Monorail at infra-dev@chromium.org
.
For Googlers: Monorail's codebase is open source and can be installed locally on your workstation of choice.
Here's how to run Monorail locally for development on MacOS and Debian stretch/buster or its derivatives.
You need to get the Chrome Infra depot_tools commands to check out the source code and all its related dependencies and to be able to send changes for review.
Check out the Monorail source code
cd /path/to/empty/workdir
fetch infra
(make sure you are not "fetch internal_infra" )cd infra/appengine/monorail
Make sure you have the AppEngine SDK:
gcloud
Install CIPD dependencies:
gclient runhooks
Install MySQL v5.6.
brew install mysql@5.6
Set up SQL database. (You can keep the same sharding options in settings.py that you have configured for production.).
mysql --user=root -e 'CREATE DATABASE monorail;'
mysql --user=root monorail < schema/framework.sql
mysql --user=root monorail < schema/project.sql
mysql --user=root monorail < schema/tracker.sql
exit
Configure the site defaults in settings.py. You can leave it as-is for now.
Set up the front-end development environment:
eval `../../go/env.py`
-- you'll need to run this in any shell you wish to use for developing Monorail. It will add some key directories to your $PATH
.sudo apt-get install build-essential automake
Install node version manager brew install nvm
See the brew instructions on updating your shell's configuration
Install node and npm nvm install 12.13.0
Add the following to the end of your ~/.zshrc
file:
export NVM_DIR="$HOME/.nvm" [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
Install Python and JS dependencies:
pip
. You can verify whether you have it installed with which pip
.pip
using python2
instead of python3
(use python --version
to check the version for 2.7, which python2
to check the path)sudo apt install python2.7 python2.7-dev python-is-python2
curl -O /tmp/get-pip.py https://bootstrap.pypa.io/pip/2.7/get-pip.py
sudo python /tmp/get-pip.py
virtualenv
to keep from modifying system dependencies.pip install virtualenv
python -m virtualenv venv
to set up virtualenv within your monorail directory.source venv/bin/activate
to activate it, needed in each terminal instance of the directory.brew install openssl; export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
make dev_deps
(run in virtual env)make deps
(run in virtual env)Run the app:
make serve
(run in virtual env)brew services restart mysql@5.6
mysqld
Browse the app at localhost:8080 your browser.
Set up your test user account (these steps are a little odd, but just roll with it): 1. Sign in using test@example.com
1. Log back out and log in again as example@example.com
1. Log out and finally log in again as test@example.com
. 1. Everything should work fine now.
Modify your Monorail User row in the database and make that user a site admin. You will need to be a site admin to gain access to create projects through the UI.
mysql --user=root monorail -e "UPDATE User SET is_site_admin = TRUE WHERE email = 'test@example.com';"
Instructions for deploying Monorail to an existing instance or setting up a new instance are here.
To set up FLT/Approvals in Monorail:
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
:
../../test.py test appengine/monorail:services.test.issue_svc_test.IssueServiceTest.testUpdateIssues_Normal --no-coverage
To run the frontend tests for Monorail, you first need to set up your Go environment. From the Monorail directory, run:
eval `../../go/env.py`
Then, to run the frontend tests, run:
make karma
If you want to skip the coverage for karma, run:
make karma_debug
To run only one test or a subset of tests, you can add .only
to the test function you want to isolate:
// Run one test. it.only(() => { ... }); // Run a subset of tests. describe.only(() => { ... });
Just remember to remove them before you upload your CL.
BindError: Unable to bind localhost:8080
This error occurs when port 8080 is already being used by an existing process. Oftentimes, this is a leftover Monorail devserver process from a past run. To quit whatever process is on port 8080, you can run kill $(lsof -ti:8080)
.
RuntimeError: maximum recursion depth exceeded while calling a Python object
If running make serve
gives an output similar to this,
pip install protobuf
gcloud: command not found
Add the following to your ~/.zshrc
file: alias gcloud='/Users/username/google-cloud-sdk/bin/gcloud'
. Replace username
with your Google username.
TypeError: connect() got an unexpected keyword argument 'charset'
This error occurs when dev_appserver
cannot find the MySQLdb library. Try installing it via sudo apt-get install python-mysqldb.
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.
OSError: [Errno 24] Too many open files
and then lists out all source filesdev_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.
IntegrityError: (1364, "Field 'comment_id' doesn't have a default value")
happens when trying to file or update an issueIn some versions of SQL, the STRICT_TRANS_TABLES
option is set by default. You'll have to disable this option to stop this error.
ImportError: No module named six.moves
You may not have six.moves in your virtual environment and you may need to install it.
which python
which pip
sudo `which python` `which pip` install six
enum hash not match
when run make dev_peds
You may run the app using python3 instead of python2.
Determine the python version used in virtual environment python --version
if it's 3.X
deactivate
rm -r venv/
pip uninstall virtualenv
pip uninstall pip
in local environment python --version
make sure to change it to python2
follow previous to instructions to reinstall pip
and virtualenv
mysql_config not found
when run make dev_deps
this may be caused installing the wrong version of six. run pip list
in virtual env make sure it is 1.15.0 if not
deactivate
rm -r venv/
pip uninstall six
pip install six==1.15.0
virtualenv venv
Monorail supports all browsers defined in the Chrome Ops guidelines.
File a browser compatability bug here.
See: Monorail Frontend Code Practices
See: Monorail Triage Guide.
See: Monorail Deployment
For information on how to use Monorail, see the Monorail User Guide.