Setup for local development
Prerequisites
Create hosts entries
Add the following to your hosts file:
On linux/macs this is typically located at /etc/hosts
. On Windows it is located at C:\Windows\System32\drivers\etc\hosts
. You will need sudo or administrator privileges to edit this file.
Install git hooks
We use pre-commit to run some checks before committing code.
To install pre-commit
run the following command:
which will install it globally on your python installation. On MacOS you might want to use brew
Then run the following command to install the git hooks:
The hooks will check your code for inconsistencies/errors before committing. If you want to run the checks manually, you can run:
Running the entire stack
To run the entire stack, run the following command:
You should now be able to access the application at http://genepanelbuilder.local:8080. The API is available at http://api.genepanelbuilder.local:8080.
Running individual services within VSCode
If you want to run individual services within VSCode, you can use the Remote - Containers extension. This will allow you to run the services within a Docker container, and will automatically mount the source code from your local machine.
Simply open VSCode in the directory of the service you want to work on. You will be prompted to reopen the folder in a container. Click "Reopen in Container" and the service will be started within a Docker container.
Testing locally
To run the tests locally, run the following command:
Backend unit tests:
BDD tests:
Make sure api types are up to date:
You should see no changes.
Development tips and tricks
Errors on running docker compose
A "catch-all" solution to errors when spinning up the app is:
docker compose down --remove-orphans
sudo rm -rf .gpbuilder-docker-data
docker compose build
docker compose up
Database
The following steps will give you a clean database:
docker compose stop postgres gpbuilder
sudo rm -rf .gpbuilder-docker-data/psql
docker compose up postgres gpbuilder
(or start VSCode devcontainer)
By default, the folder .gpbuilder-docker-data/psql
will be populated with data from the latest dump on dev. If you are making changes to the datamodel, the dump will be out of sync and the following needs to be done:
- Repopulate database:
gpb db populate
- For bdd tests to run in CI, add "bdd-no-dump" to MR title
Set up TAB-TAB autocompletion in CLI
To se up autocompletion of CLI commands by pushing the TAB
-key twice, enter an interactive shell in the gpbuilder
container and run
See also CLI documentation.