Skip to content

Commit 4b48517

Browse files
committed
More instructions for Docker
1 parent 8fd57f7 commit 4b48517

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,39 @@ chmod g+rX -R /path/to/data
2929
Now you can start the docker compose stack:
3030

3131
```bash
32-
docker compose up -d
32+
# This will build images and enable docker compose watch (see docker-compose.override.yml instructions below.)
33+
docker compose up -d --build --watch
3334
```
3435

3536
When the `colocus-django` container starts, it will begin applying django migrations and then load the data located at the `DATA_PATH` specified in your `.env` file.
3637

3738
In the future, if you wish to start over and load a new dataset, do the following:
3839

3940
```bash
41+
# If loading data from a new path:
42+
# Change your `DATA_PATH` in your `.env` file to match the location of your dataset
43+
# Then restart to force docker to remount DATA_PATH inside the container
44+
# It's best to recreate the container and build so that your new migrations are included (if any)
45+
docker compose up -d --build --force-recreate django
46+
47+
# If you're just reloading an existing dataset in the same DATA_PATH as before, you can start here:
4048
docker compose exec db bash -c 'psql -U colocus -c "DROP DATABASE core WITH (FORCE)"'
4149
docker compose exec db bash /docker-entrypoint-initdb.d/init-db.sh
4250
docker compose exec django bash -c 'source .venv/bin/activate && python3 manage.py migrate --database=core'
4351
docker compose exec django bash -c 'source .venv/bin/activate && python3 scripts/load_dataset.py /data'
4452
```
4553

54+
For debugging a new dataset load:
55+
56+
```bash
57+
# Get a shell in container
58+
docker compose exec django bash
59+
60+
# From inside container
61+
source .venv/bin/activate
62+
python3 -m pdb scripts/load_dataset.py /data
63+
```
64+
4665
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:
4766

4867
```yml
@@ -55,6 +74,12 @@ services:
5574
- action: sync
5675
path: ./colocus
5776
target: /opt/colocus/colocus
77+
- action: sync
78+
path: ./colocus/core/migrations
79+
target: /opt/colocus/colocus/core/migrations
80+
- action: sync
81+
path: ./scripts
82+
target: /opt/colocus/scripts
5883
- action: rebuild
5984
path: ./Dockerfile
6085

0 commit comments

Comments
 (0)