- Replace mobile placeholder with Expo Router app (tabs, playback, auth, library) - Move Convex backend to @otunes/convex for web and mobile reuse - Update web app imports and API routes to use shared package
113 lines
3.0 KiB
Markdown
113 lines
3.0 KiB
Markdown
# oTunes
|
|
|
|
Your music, my music, _**our**_ music. Self-hosted music streaming app and server.
|
|
|
|
## Monorepo
|
|
|
|
This project uses [pnpm workspaces](https://pnpm.io/workspaces):
|
|
|
|
| Package | Path | Description |
|
|
| --- | --- | --- |
|
|
| `@otunes/web` | `apps/web` | Next.js web app |
|
|
| `@otunes/mobile` | `apps/mobile` | Expo React Native mobile app |
|
|
| `@otunes/convex` | `packages/convex` | Shared Convex backend and client types |
|
|
|
|
### Development
|
|
|
|
Install dependencies from the repository root:
|
|
|
|
```bash
|
|
pnpm install
|
|
```
|
|
|
|
Run the web app:
|
|
|
|
```bash
|
|
pnpm dev
|
|
# or
|
|
pnpm dev:web
|
|
```
|
|
|
|
Run the mobile app:
|
|
|
|
```bash
|
|
pnpm dev:mobile
|
|
```
|
|
|
|
Run the Convex backend (from the shared package):
|
|
|
|
```bash
|
|
pnpm dev:convex
|
|
```
|
|
|
|
Other commands:
|
|
|
|
```bash
|
|
pnpm build # build web app
|
|
pnpm lint # lint all packages
|
|
pnpm typecheck # typecheck all packages
|
|
pnpm format # format with Prettier
|
|
```
|
|
|
|
## Hosting with Docker
|
|
|
|
Here's an example `docker-compose.yml` file to get you started:
|
|
|
|
```yaml
|
|
name: music
|
|
services:
|
|
otunes:
|
|
ports:
|
|
- "3000:3000"
|
|
volumes:
|
|
- /SomeAttachedStorage/Music:/data
|
|
environment:
|
|
- NEXT_PUBLIC_CONVEX_URL=http://127.0.0.1:3210
|
|
- CONVEX_SELF_HOSTED_URL=http://127.0.0.1:3210
|
|
- CONVEX_SELF_HOSTED_ADMIN_KEY=REPLACE_ME
|
|
restart: unless-stopped
|
|
image: otunes
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
args:
|
|
- NEXT_PUBLIC_CONVEX_URL=http://127.0.0.1:3210
|
|
backend:
|
|
stop_grace_period: 10s
|
|
stop_signal: SIGINT
|
|
restart: unless-stopped
|
|
ports:
|
|
- "3210:3210"
|
|
- "3211:3211"
|
|
volumes:
|
|
- ./database:/convex/data
|
|
environment:
|
|
- CONVEX_CLOUD_ORIGIN=http://127.0.0.1:3210
|
|
- CONVEX_SITE_ORIGIN=http://127.0.0.1:3211
|
|
- APPLICATION_MAX_CONCURRENT_MUTATIONS=16
|
|
- APPLICATION_MAX_CONCURRENT_NODE_ACTIONS=16
|
|
- APPLICATION_MAX_CONCURRENT_QUERIES=16
|
|
- APPLICATION_MAX_CONCURRENT_V8_ACTIONS=16
|
|
- DISABLE_BEACON=true
|
|
- DISABLE_METRICS_ENDPOINT=true
|
|
- DOCUMENT_RETENTION_DELAY=172800
|
|
- DO_NOT_REQUIRE_SSL=true
|
|
- REDACT_LOGS_TO_CLIENT=true
|
|
- RUST_LOG=info
|
|
image: ghcr.io/get-convex/convex-backend:latest
|
|
healthcheck:
|
|
test: curl -f http://localhost:3210/version
|
|
interval: 5s
|
|
start_period: 10s
|
|
```
|
|
|
|
First run `docker compose up -d backend` and `docker compose exec backend ./generate_admin_key.sh` to generate the admin key needed for the frontend. Take this key and put it in the `CONVEX_SELF_HOSTED_ADMIN_KEY` environment variable for the `otunes` service.
|
|
|
|
`CONVEX_SELF_HOSTED_URL`, `CONVEX_CLOUD_ORIGIN`, and `NEXT_PUBLIC_CONVEX_URL` should be changed to the same reversed proxied, SSL protected, domain and `CONVEX_SITE_ORIGIN` on a different domain.
|
|
|
|
Then change `/SomeAttachedStorage/Music` to the path where your music is stored and run `docker compose down && docker compose up -d` to start the whole app together.
|
|
|
|
## Downloads
|
|
|
|
Check the releases tab for the latest downloads for apps: [Releases](https://git.abunchofknowitalls.com/joshuafhiggins/otunes/releases)
|