# AzuraCast Docker Setup for AI Radio

This project is designed to integrate with AzuraCast for radio streaming and playlist management.
AzuraCast should be installed separately using its official Docker installer, then connected with this Laravel app via environment variables.

## Recommended setup

- Use Docker Desktop with WSL2 on Windows, or a Linux host with Docker Engine and Docker Compose.
- Install AzuraCast in its own directory, not inside this Laravel application directory.

## Install AzuraCast with Docker

1. Open a shell on the host machine (WSL terminal on Windows is recommended).
2. Create and use the AzuraCast directory:

```bash
sudo mkdir -p /var/azuracast
cd /var/azuracast
```

3. Download the AzuraCast Docker install script:

```bash
curl -fsSL https://raw.githubusercontent.com/AzuraCast/AzuraCast/main/docker.sh > docker.sh
chmod a+x docker.sh
```

4. Run the installer:

```bash
./docker.sh install
```

5. For unattended installation:

```bash
yes '' | ./docker.sh install
```

6. After installation completes, open the AzuraCast web UI in your browser.
   - Default URL: `http://localhost`
   - If installed on a remote server, use that server IP or hostname.

7. Create the AzuraCast super administrator account in the UI.

## Connect this Laravel app to AzuraCast

Update your Laravel `.env` with the AzuraCast connection values:

```dotenv
AZURACAST_URL=http://localhost
AZURACAST_API_KEY=your_azuracast_api_key
AZURACAST_STATION_ID=1
```

Replace `http://localhost` with the actual access URL if AzuraCast is running on a different host.

If the Laravel app runs inside Docker, use `host.docker.internal` for Windows Docker Desktop or the host gateway address:

```dotenv
AZURACAST_URL=http://host.docker.internal
```

## Notes for this repository

- The Laravel app already reads AzuraCast settings from `config/services.php` and `config/streaming.php`.
- AzuraCast integration is used by `App\Services\AzuraCastService` and the admin AzuraCast pages.
- Do not try to merge the official AzuraCast Docker stack into this app's `docker-compose.yml`; AzuraCast uses its own multi-container install and upgrade process.

## Troubleshooting

- If the Laravel app cannot connect, verify AzuraCast is reachable from the app container.
- Use `docker ps` in the AzuraCast install directory to confirm AzuraCast containers are running.
- If your app is in Docker and AzuraCast is on the host, use `host.docker.internal` as the URL.
