Files
AudioApp/README.Docker.md

2.7 KiB

Docker Deployment Guide

Quick Start

1. Build the Docker image

docker build -t carplay-audio-server .

Edit docker-compose.yml and update the music library path:

volumes:
  - /path/to/your/music:/data/music:ro  # Change this!

Then start:

docker-compose up -d

3. Run with Docker directly

docker run -d \
  --name carplay-audio \
  -p 4000:4000 \
  -v /path/to/your/music:/data/music:ro \
  -v $(pwd)/data/artwork:/app/artwork \
  -v $(pwd)/data/database:/app \
  carplay-audio-server

Initial Setup

Scan your library

# Using docker-compose
docker-compose exec carplay-audio npm run scan

# Using docker
docker exec carplay-audio npm run scan

Access the admin panel

Open your browser to: http://localhost:4000

Configure Amperfy

  • Server URL: http://YOUR-SERVER-IP:4000
  • Username: admin
  • Password: admin

Configuration

Environment Variables

  • PORT - Server port (default: 4000)
  • NODE_ENV - Environment (production/development)
  • SCAN_ON_START - Set to "true" to scan library on container start

Volumes

  • /data/music - Your music library (read-only)
  • /app/artwork - Extracted album artwork
  • /app/audio_server.db - SQLite database
  • /app/config.json - Server configuration

Management

View logs

docker-compose logs -f carplay-audio

Restart server

docker-compose restart carplay-audio

Stop server

docker-compose down

Update and rebuild

git pull
docker-compose down
docker-compose build
docker-compose up -d

Behind Reverse Proxy

If using nginx or Cloudflare Tunnel, configure it to proxy to http://localhost:4000.

Example nginx config:

location / {
    proxy_pass http://localhost:4000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}

Troubleshooting

Container won't start

Check logs:

docker-compose logs carplay-audio

Music not showing

Rescan the library:

docker-compose exec carplay-audio npm run scan

Permission issues

Ensure the music directory is readable:

chmod -R 755 /path/to/your/music

Production Deployment

  1. Change default credentials in src/routes/subsonic.js
  2. Use HTTPS via reverse proxy
  3. Set up automatic backups of the database
  4. Monitor logs for errors
  5. Set resource limits in docker-compose.yml:
deploy:
  resources:
    limits:
      cpus: '2'
      memory: 1G