Skip to content

Commit

Permalink
[MNT] Created a complete test environment with docker compose (#325)
Browse files Browse the repository at this point in the history
* Added submodules to prettierignore

Co-authored-by: Sebastian Urchs <[email protected]>

* Added `recipes` and `neurobagel_examples` as submodules

* Added docker-compose file

* Set up development docker compose with required services

* Updated README.md with instruction for docker compose

* Updated `dependabot.yml`

* Addressed suggested changes from PR review

---------

Co-authored-by: Sebastian Urchs <[email protected]>
  • Loading branch information
rmanaem and surchs authored Oct 25, 2024
1 parent 660a654 commit 6bd0f1d
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ updates:
directory: '/'
schedule:
interval: 'weekly'
labels:
- "_bot"
- "maint:dependency"
- "type:maintenance"

- package-ecosystem: 'npm'
directory: '/'
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "recipes"]
path = recipes
url = https://github.com/neurobagel/recipes.git
[submodule "neurobagel_examples"]
path = neurobagel_examples
url = https://github.com/neurobagel/neurobagel_examples.git
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ CHANGELOG.md

# Ignore workflow files
.github/

# Ignore our submodules
recipes
neurobagel_examples
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,29 @@ You can verify the tool is running by watching for the` info messages from Vite

Having installed the dependencies, run the following command to enable husky `pre-commit` and `post-merge` hooks:

```
```bash
npx husky install
```

##### Docker compose testing environment for development

Since the query tool relies on other neurobagel tools to function, their presence is often required during development. To facilitate this, a docker compose containing a complete testing environment has been created. To use it follow the steps below:

1. Install `recipes` and `neurobagel_examples` submodules:

```bash
git submodule init
git submodule update
```

2. Bring up the stack using the `test` profile:

```bash
docker compose --profile test up -d
```

_NOTE: Make sure your .env file in the root directory doesn't contain any of the environment variables used in the docker compose file as it will conflict with the configuration, since docker compose will try to use .env by default._

## Usage

To define a cohort, set your inclusion criteria using the following:
Expand Down
51 changes: 51 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
services:
api:
extends:
file: recipes/docker-compose.yml
service: api
profiles:
- 'test'
environment:
NB_GRAPH_USERNAME: 'DBUSER'
NB_RETURN_AGG: false
volumes:
- './recipes/scripts/api_entrypoint.sh:/usr/src/api_entrypoint.sh'
entrypoint:
- '/usr/src/api_entrypoint.sh'
secrets:
- db_user_password

graph:
extends:
file: recipes/docker-compose.yml
service: graph
profiles:
- 'test'
volumes:
- 'graphdb_home:/opt/graphdb/home'
- './recipes/scripts:/usr/src/neurobagel/scripts'
- './recipes/vocab:/usr/src/neurobagel/vocab'
- './neurobagel_examples/data-upload/pheno-bids-derivatives-output:/data'
environment:
NB_GRAPH_USERNAME: 'DBUSER'
secrets:
- db_admin_password
- db_user_password

federation:
extends:
file: recipes/docker-compose.yml
service: federation
profiles:
- 'test'
volumes:
- './recipes/local_nb_nodes.json:/usr/src/local_nb_nodes.json:ro'

secrets:
db_admin_password:
file: ./recipes/secrets/NB_GRAPH_ADMIN_PASSWORD.txt
db_user_password:
file: ./recipes/secrets/NB_GRAPH_PASSWORD.txt

volumes:
graphdb_home:

0 comments on commit 6bd0f1d

Please sign in to comment.