Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions dev-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ Load environment variables
audius-compose load-env discovery-provider prod
```

# Open Audio Protocol (OAP) nodes

The stack runs four Open Audio Protocol (OAP) validator nodes (openaudio-1–4) when using the `storage` and `discovery` profiles. They use the image `openaudio/go-openaudio:dev` by default (for local development).

- **If you have a local [go-openaudio](https://github.com/OpenAudio/go-openaudio) clone:** Clone it as a sibling of the apps repo (e.g. `../go-openaudio`) or set `GO_OPENAUDIO_ROOT`. When you run `audius-compose up`, the script `dev-tools/scripts/build-openaudio.sh` will run and build `openaudio/go-openaudio:dev` via `make docker-dev` in that repo, so the stack uses your local build.
- **If you don’t:** The stack automatically uses the public image `openaudio/go-openaudio:stable` so `audius-compose up` still works without building.

To force a specific image (e.g. a custom tag), set `OPENAUDIO_IMAGE`:

```bash
OPENAUDIO_IMAGE=openaudio/go-openaudio:stable audius-compose up
```

# Troubleshooting

## Increase Docker Resource Requirements
Expand Down
20 changes: 20 additions & 0 deletions dev-tools/audius-compose
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,25 @@ def up(
),
)

# Build openaudio/go-openaudio:dev from local go-openaudio clone if present
build_openaudio = protocol_dir / "dev-tools/scripts/build-openaudio.sh"
if build_openaudio.exists():
subprocess.run(
[str(build_openaudio)],
env={**os.environ, "PROJECT_ROOT": str(protocol_dir)},
cwd=str(protocol_dir),
check=False,
)
# If :dev image still doesn't exist, use :stable so pull/up succeed
if (
subprocess.run(
["docker", "image", "inspect", "openaudio/go-openaudio:dev"],
capture_output=True,
).returncode
!= 0
):
os.environ["OPENAUDIO_IMAGE"] = "openaudio/go-openaudio:stable"

ctx.invoke(pull)
sys.exit(
subprocess.run(
Expand All @@ -419,6 +438,7 @@ def up(
*args,
*services,
],
env=os.environ,
).returncode
)

Expand Down
38 changes: 38 additions & 0 deletions dev-tools/scripts/build-openaudio.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Build openaudio/go-openaudio:dev from a local go-openaudio clone.
# Used by audius-compose up so the local stack can use a locally built OAP image.
#
# Set GO_OPENAUDIO_ROOT to the path to your go-openaudio repo, or clone it to
# PROJECT_ROOT/../go-openaudio (sibling of apps repo).
# If the image already exists or no clone is found, this is a no-op.

set -e

PROJECT_ROOT="${PROJECT_ROOT:-}"
if [[ -z "$PROJECT_ROOT" ]]; then
# Assume we're in dev-tools/scripts/
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
fi

GO_OPENAUDIO_ROOT="${GO_OPENAUDIO_ROOT:-$PROJECT_ROOT/../go-openaudio}"

if [[ ! -d "$GO_OPENAUDIO_ROOT" ]]; then
echo "go-openaudio clone not found at $GO_OPENAUDIO_ROOT (set GO_OPENAUDIO_ROOT to override). Skipping openaudio dev image build."
exit 0
fi

if [[ ! -f "$GO_OPENAUDIO_ROOT/Makefile" ]]; then
echo "GO_OPENAUDIO_ROOT=$GO_OPENAUDIO_ROOT does not look like go-openaudio (no Makefile). Skipping."
exit 0
fi

# Image already built
if docker image inspect openaudio/go-openaudio:dev &>/dev/null; then
echo "openaudio/go-openaudio:dev already exists. Skipping build."
exit 0
fi

echo "Building openaudio/go-openaudio:dev from $GO_OPENAUDIO_ROOT ..."
( cd "$GO_OPENAUDIO_ROOT" && make docker-dev )
echo "openaudio/go-openaudio:dev built successfully."