# Compose files

> The compose file, and the additions for several libraries and a VPN.

Page: https://songstress.app/docs/reference/compose/

## The compose file [#the-compose-file]

The compose file in [Install with Docker Compose](/docs/getting-started/install-docker-compose/) runs Songstress on
its own. You rarely need to edit it: your values go in `.env`, and additions go in a file beside it.

## Several libraries [#several-libraries]

Songstress can keep several libraries, each from its own folder, like your main collection and a folder of vinyl
rips.

1. Save this as `compose.override.yaml` beside `compose.yaml`, with your second folder. Docker Compose reads it
   with `compose.yaml` by itself.

   ```yaml title="compose.override.yaml"
   services:
     songstress:
       volumes:
         - /srv/vinyl-rips:/rips
   ```

2. List every library in `.env`, as `Name=/path`, separated by `;`:

   ```sh title=".env"
   MUSIC_LIBRARIES=Main=/music;Rips=/rips
   ```

3. Run `docker compose up -d`.

Songstress adds each new library at the next start. To scan it at once, select its **Rescan** in
**Manage ▸ Library**. Taking one off the list doesn't remove it from Songstress.

## Route downloads through a VPN [#route-downloads-through-a-vpn]

The VPN overlay runs Songstress inside a WireGuard tunnel (with Gluetun), so everything Acquisition downloads goes
through your VPN. The web app stays reachable on your network. You need a WireGuard key from your VPN and Docker
Compose 2.24 or newer.

1. Save this as `compose.vpn.yaml` beside `compose.yaml`:

   ```yaml title="compose.vpn.yaml"
   services:
     gluetun:
       image: qmcgaw/gluetun:v3
       container_name: songstress-gluetun
       cap_add:
         - NET_ADMIN
       devices:
         - /dev/net/tun:/dev/net/tun
       environment:
         - VPN_SERVICE_PROVIDER=${VPN_SERVICE_PROVIDER:-protonvpn}
         - VPN_TYPE=wireguard
         - WIREGUARD_PRIVATE_KEY=${WIREGUARD_PRIVATE_KEY}
         - WIREGUARD_ADDRESSES=${WIREGUARD_ADDRESSES:-10.2.0.2/32}
         - DNS_KEEP_NAMESERVER=on
         - FIREWALL_INPUT_PORTS=8090
         - FIREWALL_OUTBOUND_SUBNETS=${LAN_SUBNET:-172.16.0.0/12}
         - TZ=${TZ:-UTC}
       ports:
         - "${SONGSTRESS_PORT:-8090}:8090"
       volumes:
         - ./gluetun:/gluetun
       restart: unless-stopped
       logging:
         driver: json-file
         options:
           max-size: "50m"
           max-file: "10"
       mem_limit: ${GLUETUN_MEM_LIMIT:-256m}
       cpus: ${GLUETUN_CPUS:-0}

     songstress:
       network_mode: "service:gluetun"
       ports: !reset []
       depends_on:
         gluetun:
           condition: service_started
   ```

2. Add your VPN to `.env`. `LAN_SUBNET` lists the networks that skip the tunnel; add your home network to it:

   ```sh title=".env"
   VPN_SERVICE_PROVIDER=protonvpn
   WIREGUARD_PRIVATE_KEY=your-wireguard-private-key
   WIREGUARD_ADDRESSES=10.2.0.2/32
   LAN_SUBNET=172.16.0.0/12,192.168.1.0/24
   ```

3. Start both:

   ```sh title="Terminal"
   docker compose -f compose.yaml -f compose.vpn.yaml up -d
   ```

Use the same two `-f` files for every `docker compose` command from then on.

<Callout type="warn" title="Jam voice behind the overlay">
The overlay doesn't publish the voice port, so voice can't connect directly, and has only your server's own
connection to travel through. If people in a Jam can't talk, turn voice off in **Manage ▸ Server ▸ Access ▸ Jam
voice**, so the microphone button goes away.
</Callout>

On a NAS whose Docker manager rewrites `network_mode: "service:gluetun"`, use
`network_mode: "container:songstress-gluetun"` instead, and start Gluetun first.
