Deployment guide

Swing Music

Overview

Swing Music is a self-hosted music streaming server and player for your own local audio files, like a private streaming service for a collection you own. Point it at a folder of music, and it scans your tracks, reads their tags and cover art, groups them into albums and artists, and streams them to a multi-user web player. The player offers playlists, favourites, listening statistics and a mobile-friendly interface, and your library and listening habits stay on infrastructure you control.

This SecureAnyCloud image runs the Swing Music server as a single self-contained binary that serves both the REST API and the bundled web client. It uses embedded SQLite databases, so no external database or runtime interpreter is required. nginx is the reverse proxy on port 80, and the server itself listens on 127.0.0.1:1970, bound to the loopback interface only.

On the first boot of every deployed VM, a one-shot service starts the server and creates the sole administrator account with a per-instance password. Swing Music ships with no baked-in default, because the first account created becomes the admin. The service also regenerates a fresh per-instance server key and writes the login to /root/swing-music-credentials.txt with mode 0600. nginx is held back until this bootstrap has finished, so port 80 never answers before the administrator exists. Two VMs deployed from the same image never share credentials, and the upstream default admin / admin login never works.

What you get:

  • Swing Music 3.0.0 server (single self-contained binary, bundles the web client, embedded SQLite) at /opt/swingmusic/swingmusic
  • nginx reverse proxy on :80, tuned for streaming, in front of the Swing Music server on loopback :1970
  • ffmpeg for audio transcoding, and the configuration and SQLite databases under /var/lib/swingmusic
  • Per-VM administrator password generated at first boot, in a root-only file, with no default login in the image
  • swingmusic.service, nginx.service and a one-shot swing-music-firstboot.service as systemd units
  • The complete, unmodified upstream AGPL-3.0 source for the shipped version on disk under /opt/swingmusic/SOURCE
  • A fully patched Ubuntu 24.04 LTS security baseline at capture time, with unattended security updates enabled
  • 24/7 SecureAnyCloud support

Prerequisites

  • An active Azure subscription, an SSH key pair, and a VNet and subnet in the target region
  • Standard_B2s (2 vCPU / 4 GiB RAM) as a starting size. Swing Music is lightweight, so scale up only for very large libraries or many concurrent listeners.
  • A data disk or a generous OS disk for your music
  • NSG inbound rules that allow 22/tcp from your management network, and 80/tcp from the networks your listeners use to reach Swing Music. Add 443/tcp once you enable HTTPS.

Step 1 - Deploy from the Azure Marketplace

Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Swing Music by SecureAnyCloud, and select Create. On Basics, pick your subscription, resource group, region and size. Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22) and HTTP (80). Then choose Review + create, followed by Create. First-boot initialization takes a few seconds after the VM starts.

Step 2 - Deploy from the Azure CLI

# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:swing-music-ubuntu-24-04:default:latest
az vm create \
  --resource-group <your-rg> \
  --name swing-music \
  --image sac1647283583153:swing-music-ubuntu-24-04:default:latest \
  --size Standard_B2s \
  --admin-username azureuser \
  --ssh-key-values ~/.ssh/id_ed25519.pub \
  --vnet-name <your-vnet> --subnet <your-subnet> \
  --public-ip-sku Standard
az vm open-port --resource-group <your-rg> --name swing-music --port 80 --priority 1010

Step 3 - Connect to your VM

ssh azureuser@<vm-public-ip>

Step 4 - Verify the Swing Music stack

Confirm that the services are active and that the web app answers through nginx.

systemctl is-active swingmusic nginx curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1/

Both service lines read active and the web app returns 200.

Confirm that the Swing Music server binds to loopback only, with nginx as the sole public listener.

sudo ss -tlnp | grep -E ':80 |:1970 '

Port 80 (nginx) listens on all interfaces. Port 1970 (Swing Music) is bound to 127.0.0.1 only.

Step 5 - Retrieve your administrator login

The administrator login generated on the first boot of your VM is stored in a root-only file. The file lists the Swing Music URL, the administrator username (admin) and the password.

sudo cat /root/swing-music-credentials.txt

Store the password in your password manager and treat the file as sensitive. You can change the password at any time from the web app (top-right profile, then account settings), or from the command line with Swing Music's own reset tool.

printf 'admin\n' | sudo -u swingmusic /opt/swingmusic/swingmusic --password-reset --config /var/lib/swingmusic

Step 6 - Verify authentication

The login API issues a JWT access token for the generated administrator password, and it rejects the upstream default admin / admin. The first request returns a token, and the second reports HTTP 401.

PASS=$(sudo grep '^swingmusic.admin.pass=' /root/swing-music-credentials.txt | cut -d= -f2-)
curl -s -X POST http://127.0.0.1/auth/login -H 'Content-Type: application/json' -d "{\"username\":\"admin\",\"password\":\"$PASS\"}" | jq -r '.accesstoken' | cut -c1-24
curl -s -o /dev/null -w '%{http_code}\n' -X POST http://127.0.0.1/auth/login -H 'Content-Type: application/json' -d '{"username":"admin","password":"admin"}'

The first line prints the start of a valid token. The second prints 401, which shows that the shipped image has no working default credential.

Step 7 - Sign in to the web app

Open a web browser and go to http://<vm-public-ip>/. Sign in with the username admin and the password from /root/swing-music-credentials.txt. The web app opens on the Home page, where you can browse your library, folders, favourites, playlists and listening statistics.

Step 8 - Add your music folder

Swing Music streams music you already own. Upload or copy your audio files onto the VM, for example under /srv/music, and make sure the swingmusic service user can read them. Then register the folder so that Swing Music scans it.

In the web app, open the profile menu, then Settings, then Folders, and add the path. Swing Music indexes the folder immediately, reading tags and cover art and grouping tracks into albums and artists.

You can also register a folder over the API with your admin token, then trigger a scan.

TOKEN=$(sudo grep '^swingmusic.admin.pass=' /root/swing-music-credentials.txt | cut -d= -f2- | { read P; curl -s -X POST http://127.0.0.1/auth/login -H 'Content-Type: application/json' -d "{\"username\":\"admin\",\"password\":\"$P\"}" | jq -r '.accesstoken'; })
curl -s -X POST http://127.0.0.1/notsettings/add-root-dirs -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' -d '{"new_dirs":["/srv/music"],"removed":[]}' | jq -r '.root_dirs[]?'
curl -s "http://127.0.0.1/notsettings/trigger-scan" -H "Authorization: Bearer $TOKEN" | jq -r '.msg'

The first command lists your registered root directories, and the scan responds Scan triggered!. Refresh the Albums view to see your library.

Step 9 - Browse and play your music

Open Albums, Artists, Folders or Playlists to browse your collection. Swing Music extracts each album's cover art and themes the page around its colours. Select an album to see its track list, then press Play on any track. Streaming begins immediately, and the player controls at the bottom of the window show the current track, artwork and a seek bar.

Step 10 - Add more users

Swing Music is multi-user, and each account has its own playlists, favourites and listening statistics. As the administrator, open the profile menu, then Settings, then Users, to create additional accounts. You can also create a read-only guest account for shared listening. Every new user signs in at the same URL with their own credentials.

Security baseline

The image is captured with the Ubuntu 24.04 security baseline fully applied, including phased updates. It ships with unattended security upgrades enabled, so your VM keeps patching itself after deployment.

cat /etc/apt/apt.conf.d/20auto-upgrades systemctl is-enabled unattended-upgrades || true

The Swing Music server binds to loopback only, and nginx is the single public listener. The shipped image contains no database and no user account. nginx is gated on the first-boot marker, so port 80 never answers before the per-VM administrator has been created.

ls -la /opt/swingmusic/SOURCE/ grep ConditionPathExists /etc/systemd/system/nginx.service.d/*.conf

Enabling HTTPS

Serve Swing Music over HTTPS so that logins and streaming are encrypted in transit. Point a DNS A record at the VM's public IP address, then install a certificate with Certbot. Replace the domain in the command with your own.

sudo apt-get update && sudo apt-get install -y certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.example.com

After you enable HTTPS, open 443/tcp in the NSG and restrict or close inbound port 80.

Backup and maintenance

All Swing Music state lives under /var/lib/swingmusic/swingmusic. This includes the SQLite databases (users, library index, playlists, favourites, settings) and the per-instance server key. The simplest logical backup is to copy that directory while the service is stopped, or to snapshot the OS disk.

sudo systemctl stop swingmusic
sudo tar czf /var/backups/swingmusic-$(date +%F).tar.gz -C /var/lib/swingmusic swingmusic
sudo systemctl start swingmusic

Apply operating system security updates with sudo apt update && sudo apt upgrade. The services restart cleanly. Restart the server at any time with sudo systemctl restart swingmusic.

License and source

Swing Music is free software licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). To comply with the license, the complete, unmodified upstream source for the exact version shipped in this image is on disk at /opt/swingmusic/SOURCE/swingmusic-v3.0.0-source.tar.gz. A NOTICE file points to the source and to the upstream repository. SecureAnyCloud makes no modifications to the Swing Music program itself.

Support

This image is backed by 24/7 SecureAnyCloud support. Contact us by email or chat for help with deployment, library and folder configuration, TLS termination and multi-user setup.

All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

Deploy on Azure

Launch Swing Music on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure