- Python 3.11+
- Pip
- A running Redis-compatible server
- A running database server (MySQL is known to work)
- A working JDK installation (JDK 17.0.13 is known to work)
See pyproject.toml for more specific requirements.
This section is applicable to the first node.
- Clone repository from GitHub, and cd into it.
- Create a Python virtual environment,
python -mvenv venv
- Activate the virtual environment,
source venv/bin/activate
- Install minimum necessary packages, with
pip install -e .
- Generate a secret key and copy to the clipboard:
python manage.py shell -c "from django.core.management import utils; print(utils.get_random_secret_key())"
. - Copy
env.template
to.env
and edit according to your local configuration (see also Configuration). - Create migration files for the database:
python manage.py makemigrations
- Create database tables:
python manage.py migrate
- Collect static files:
python manage.py collectstatic
- Create an administrative user,
python manage.py createsuperuser
On all remaining nodes, complete steps 1--4, copying the .env
file and make any necessary changes.
On all nodes which will run the worker, complete the following additional steps to install gumtree.
- Activate the virtual environment,
source venv/bin/activate
- Install the gumtree support packages,
pip install -e .[gumtree_support]
. - Initialize GumTree submodules,
git submodule update --init --recursive
. - Navigate to the gumtree directory,
cd gumtree
- Build gumtree,
./gradlew build
- Navigate to the gumtree parser directory (
cd ../gumtree-parser
), and pre-build the tree-sitter parsers by running the following commands:./tree-sitter-parser.py ../test-data/py/arg-type/with.py python
./tree-sitter-parser.py ../test-data/php/arg-definition/with.php php
./tree-sitter-parser.py ../test-data/r/args-default/with.r r
./tree-sitter-parser.py ../test-data/rb/local/with.rb ruby
./tree-sitter-parser.py ../test-data/ts/arg-type/with.ts typescript
This section is applicable to all nodes running the worker service.
- Copy the file
template-typechangebot-worker.service
totypechangebot-worker.service
. - Edit the file, taking special care to set the
WorkingDirectory
setting to the installation directory, and theUser
setting to the user which will the worker will be run as. - Copy
typechangebot-worker.service
to the/etc/systemd/system/
directory. - Reload the systemd daemon with
systemctl daemon-reload
. - Enable and start the service with
systemctl enable --now typechangebot-worker
.
Configure your webserver/WSGI installation following vendor directions. If using Ubuntu and Apache, Digital Ocean's guide may be helpful.
The following environment variable must be configured in a .env
file. This file must be available on all nodes, and all nodes must be
uniformly configured.
SECRET_KEY
Necessary configuration parameter to ensure application security. See above.ALLOWED_HOSTS
Comma-separated list of allowed host names, see also Django documentationURL_ROOT
Path from domain root to app, normally/
, but may be/tcbot
or similar based on your configuration.DATA_DIR
Absolute path to directory containing stored repositories.
The following must be collected from GitHub's application management UI.
GITHUB_APP_KEY
Separate newlines with literal\n
GITHUB_APP_ID
GITHUB_APP_CLIENT_SECRET
GUMTREE_DIR
Location of GumTree binaries. Note, the example configuration will only needTODO
replaced with the path to the installation directory.GUMTREE_TREE_SITTER_DIR
Location of the GumTree treesitter parser. Note, the example configuration will only needTODO
replaced with the path to the installation directory.
DATABASE_URL
adj-database-url
compatible database URL. Make sure to install the relevant database drivers (necessary packages for MySQL are available with themysql
optional dependency set).
CELERY_BROKER_URL
URL for Redis access. See also Celery documentation. It is recommended that you use a database number specific to this project.