You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While developing you may want the containers to rebuild or resync with your source files changing automatically. The following can be placed in a `docker-compose.override.yml` file:
This assumes you have `colocus` and `colocus-ui-vue3` repositories checked out and next to each other in the directory hierarchy.
122
-
123
-
You'll also want the following in your `.env` file:
84
+
#### Sentry
124
85
125
-
```bash
126
-
VITE_HOST=0.0.0.0
127
-
VITE_PORT=5173
128
-
VITE_API_URL=http://django:${UVICORN_PORT}
129
-
```
86
+
Sentry is an error logging aggregator service. You can sign up for a free account at <https://sentry.io/signup/> or download and host it yourself. The system is set up with reasonable defaults, including 404 logging and integration with the WSGI application.
130
87
88
+
You must set the DSN url in `SENTRY_DSN` in your `.env` file.
131
89
132
90
### CSG
133
91
@@ -519,100 +477,17 @@ The fields are:
519
477
520
478
## Development
521
479
522
-
### Bare metal
523
-
524
-
This development setup deploys the colocus server directly to your VM or local machine. For a docker based setup, see below.
525
-
526
-
#### Database setup
527
-
528
-
We use `uv` to manage packages and dependencies. [Follow these instructions](https://docs.astral.sh/uv/getting-started/installation/) to install `uv` on your system.
529
-
530
-
The database can be created by applying relevant migrations, and then loading a pre-packaged dataset (not provided in
531
-
this repo, though subsets of data may be provided in the future).
532
-
533
-
```bash
534
-
$ cd /path/to/colocus
535
-
$ uv sync
536
-
$ mkdir database
537
-
$ uv run python manage.py migrate
538
-
$ uv run python scripts/load_dataset.py <path/to/dataset> # see below for datasets
539
-
```
540
-
541
-
<details>
542
-
<summary><b>Datasets for CSG users</b></summary>
543
-
544
-
There is an existing dataset on our cluster at
545
-
`/net/dumbo/home/welchr/projects/amp-cmd/colocus-pipeline-brotman/data/processed/`. The required files are
546
-
approximately 13GB in total. You can quickly sync the required files to your development environment with:
Then give the path to the `data/processed` directory as the argument to `load_dataset.py`:
561
-
562
-
```bash
563
-
$ uv run python scripts/load_dataset.py /path/on/your/machine/colocus-pipeline-brotman/data/processed/
564
-
```
565
-
</details>
566
-
567
-
568
-
569
-
If you have already tried to load the data previously and want a fresh start, you can delete the database and start over:
570
-
571
-
```bash
572
-
rm -f "./database/local.sqlite3"
573
-
rm -rf "./colocus/media"
574
-
uv run python manage.py migrate
575
-
uv run python scripts/load_dataset.py <path/to/dataset>
576
-
```
480
+
### Data
577
481
578
482
More information on the required types of data can be found below under [required data](#required-data).
579
483
580
-
#### Running the django server
581
-
582
-
This will start uvicorn to serve the django app and REST API. By default, the server runs on port 8000.
583
-
584
-
```bash
585
-
uv run uvicorn config.asgi:application --host 0.0.0.0 --reload
586
-
```
587
-
588
-
#### Running all code checks
589
-
590
-
The project is setup to use [pre-commit](https://pre-commit.com/) to run all checks at once. You can either install
591
-
the pre-commit git hooks, or run pre-commit yourself manually before committing.
592
-
593
-
To run pre-commit manually:
594
-
595
-
```bash
596
-
uv run pre-commit run --all-files -v
597
-
```
598
-
599
-
This is the same command our Github Actions CI will run when you push a commit.
600
-
601
-
#### Running tests
602
-
603
-
```bash
604
-
uv run pytest
605
-
```
606
-
607
-
#### Sentry
608
-
609
-
Sentry is an error logging aggregator service. You can sign up for a free account at <https://sentry.io/signup/> or download and host it yourself. The system is set up with reasonable defaults, including 404 logging and integration with the WSGI application.
610
-
611
-
You must set the DSN url in `SENTRY_DSN` in your `.env` file.
484
+
There is an example test dataset in `colocus/tests/data/` that can be used to test loading data. It is the same dataset used for running test cases.
612
485
613
486
### Docker
614
487
615
-
Make a docker compose override that enables watching files and rebuilding container images as needed:
488
+
Make a `docker-compose.override.yml` that enables watching files and rebuilding container images as needed:
489
+
490
+
While developing you may want the containers to rebuild or resync with your source files changing automatically. The following can be placed in a `docker-compose.override.yml` file:
To use this, you will need the `colocus-ui-vue3` repository checked out next to colocus. For example, your directory tree should look like this:
538
+
This assumes you have `colocus` and `colocus-ui-vue3` repositories checked out and next to each other in the directory hierarchy.
539
+
540
+
For example, your directory tree should look like this:
641
541
642
542
```
643
543
root
644
544
| - colocus-ui-vue3
645
545
| - colocus
646
546
```
647
547
548
+
You'll also want the following in your `.env` file:
549
+
550
+
```bash
551
+
VITE_HOST=0.0.0.0
552
+
VITE_PORT=5173
553
+
VITE_API_URL=http://django:${UVICORN_PORT}
554
+
```
555
+
648
556
Now you can run:
649
557
650
558
```bash
651
559
docker compose up --build --watch
652
560
```
653
561
654
562
This will bring up the containers, building them as needed, and watch to see if source code files change. If any of the source changes, the container image will be rebuilt if necessary, and restarted. In the case of the Django container, it will instead just sync the new source files into the container, and then the uvicorn server will reload them.
563
+
564
+
#### Running all code checks
565
+
566
+
To run code checks, you will need to install `uv` first, and then required packages:
567
+
568
+
```bash
569
+
# Install uv
570
+
curl -LsSf https://astral.sh/uv/install.sh | sh
571
+
572
+
# Install packages
573
+
uv sync
574
+
```
575
+
576
+
The project is setup to use [pre-commit](https://pre-commit.com/) to run all checks at once. You can either install the pre-commit git hooks, or run pre-commit yourself manually before committing.
577
+
578
+
To run pre-commit manually:
579
+
580
+
```bash
581
+
uv run pre-commit run --all-files -v
582
+
```
583
+
584
+
This is the same command our Github Actions CI will run when you push a commit.
0 commit comments