Skip to content

Commit 427c0c2

Browse files
docs: clarify when run-db-and-afp-containers applies vs compose
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent fb6dcb3 commit 427c0c2

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ All contributors (including maintainers) should update `CHANGELOG.md` when creat
8080

8181
- **README**: Docker Compose quick start documents **`ghcr.io`** **`afp`** pulls (**`GHCR_IMAGE_NAMESPACE`**), **`docker login`** (PAT as password—not account password—plus **`docker logout ghcr.io`**), **`~/.docker/config.json`** vs project **`.env`**, optional **`gh auth token`**, and **SSO** for **`unauthorized`** / **`denied`**.
8282

83+
- **CONTRIBUTING**: [Environment setup](CONTRIBUTING.md) clarifies **Compose-only** dev (**skip** **`scripts/run-db-and-afp-containers.sh`** to avoid container name clashes) vs **host `pytest`** + that script (same pattern as [`.github/workflows/test.yml`](.github/workflows/test.yml)); database requirement text matches both paths.
84+
8385
### Removed
8486

8587
- **Scripts**: Removed legacy **`scripts/generate-docker-compose-parts.sh`**; server deploy compose is owned by [**BehindTheMusicTree/infrastructure**](https://github.com/BehindTheMusicTree/infrastructure) (**`generate-docker-compose.sh`** + **`docker-compose.yml.template`**), not partial compose snippets generated from this repository.

CONTRIBUTING.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ cd the-music-tree-api
169169

170170
This is the default local workflow for this repository. It runs API + DB + AFP with the same runtime env contract used by deployment.
171171

172+
**Compose-only tests:** With this stack, Postgres and AFP are already running as Compose services. Run the suite with **`docker compose exec api pytest`** (see [Testing](#testing)). **Do not** run step 6 in that workflow—it starts duplicate **`docker run`** containers and will **clash on names** with the Compose services. Step 5 is optional on the host when you need the same directories for scripts outside the container; the **`api`** image startup also prepares paths inside the container.
173+
172174
5. Set up filesystem:
173175

174176
```bash
@@ -183,18 +185,17 @@ cd the-music-tree-api
183185
- Media files and libraries
184186
- Temporary uploaded files
185187

186-
6. Run database and Audio Fingerprinter containers:
188+
6. **Alternative — DB and AFP only (host `pytest`, same pattern as CI):**
189+
190+
If you install the app with **`pip install -e ".[dev]"`** on the host and run **`pytest`** there (instead of inside the **`api`** container), start Postgres and AFP with:
187191

188192
```bash
189193
bash scripts/run-db-and-afp-containers.sh
190194
```
191195

192-
This starts the required Docker containers:
193-
194-
- PostgreSQL database container
195-
- Audio Fingerprinter (AFP) container
196+
This script **`docker pull`**s images (via **`docker_image_ref_from_repo_tag`** in **`scripts/utils.sh`**, so **`GHCR_IMAGE_NAMESPACE`** must be set for short image repo names) and **`docker run`**s DB + AFP. GitHub Actions **`.github/workflows/test.yml`** uses the same step. For private **`ghcr.io`** images, **`docker login ghcr.io`** on the host first (see [README](README.md) Quick start).
196197

197-
**Note:** Make sure Docker is running before running this script.
198+
**Note:** Docker must be running. Skip this step when you rely solely on step 4’s Compose stack.
198199

199200
#### Environment Variables
200201

@@ -256,7 +257,7 @@ Running the container requires the following environment variables:
256257

257258
#### Database Requirement
258259

259-
The HearTheMusicTree API requires a PostgreSQL database to function. The database runs in a Docker container, which is started by the `run-db-and-afp-containers.sh` script. This ensures a consistent development environment across all contributors.
260+
The HearTheMusicTree API requires a PostgreSQL database to function. With **Docker Compose** (step 4), the database is the Compose **`db`** service. With **host `pytest`** (step 6 / CI), the database is a container started by **`scripts/run-db-and-afp-containers.sh`**.
260261

261262
#### Database migrations
262263

0 commit comments

Comments
 (0)