Skip to content

Deploying Gonic

Introduction

Gonic is a lightweight, Subsonic-compatible music streaming server written in Go. It allows you to stream your personal music collection from anywhere using any Subsonic-compatible client app on desktop, mobile, or web.

Unlike heavier alternatives, Gonic is designed for efficiency. It does not perform any audio transcoding by default (though it supports it optionally), does not generate thumbnails, and has minimal resource requirements. This makes it perfect for low-power devices and containerized deployments.

Key highlights of Gonic:

  • Subsonic API Compatible: Works with all Subsonic and Airsonic clients
  • Lightweight: Minimal CPU and memory usage
  • Fast Scanning: Quick music library indexing
  • Multiple Folders: Support for multiple music directories
  • Podcast Support: Download and manage podcasts
  • Internet Radio: Stream internet radio stations
  • Scrobbling: Last.fm and ListenBrainz integration
  • Transcoding: Optional on-the-fly audio conversion
  • Multi-User: Support for multiple user accounts
  • Jukebox Mode: Control playback on the server
  • Open Source: Licensed under GPL-3.0

This guide walks through deploying Gonic on Klutch.sh using Docker.

Why Deploy Gonic on Klutch.sh

Deploying Gonic on Klutch.sh provides several advantages:

Stream Anywhere: Access your music library from any location with internet.

Persistent Library: Your music metadata survives container updates.

HTTPS by Default: Secure streaming without certificate management.

Low Resources: Efficient design works well with minimal allocation.

Always On: Your music server runs 24/7 without home network hassles.

Prerequisites

Before deploying Gonic on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your configuration
  • Your music library files (to upload to persistent storage)
  • A Subsonic-compatible music player app
  • Basic familiarity with Docker

Understanding Gonic Architecture

Gonic has a simple architecture:

Go HTTP Server: Handles Subsonic API requests and web interface.

SQLite Database: Stores music metadata, users, and playlists.

File Scanner: Indexes music files from configured directories.

Optional FFmpeg: For transcoding when needed.

Preparing Your Repository

Create a GitHub repository with your Gonic configuration.

Repository Structure

gonic-deploy/
├── Dockerfile
└── .dockerignore

Creating the Dockerfile

FROM sentriz/gonic:latest
# Set environment variables
ENV GONIC_MUSIC_PATH=/music
ENV GONIC_PODCAST_PATH=/podcasts
ENV GONIC_CACHE_PATH=/cache
ENV GONIC_DB_PATH=/data/gonic.db
ENV GONIC_LISTEN_ADDR=0.0.0.0:4747
# Create directories
RUN mkdir -p /music /podcasts /cache /data
# Expose web interface
EXPOSE 4747
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:4747/ping || exit 1

Advanced Dockerfile with Transcoding

For transcoding support:

FROM sentriz/gonic:latest
# Install FFmpeg for transcoding
USER root
RUN apk add --no-cache ffmpeg
USER gonic
# Set environment variables
ENV GONIC_MUSIC_PATH=/music
ENV GONIC_PODCAST_PATH=/podcasts
ENV GONIC_CACHE_PATH=/cache
ENV GONIC_DB_PATH=/data/gonic.db
ENV GONIC_LISTEN_ADDR=0.0.0.0:4747
# Create directories
RUN mkdir -p /music /podcasts /cache /data
EXPOSE 4747
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:4747/ping || exit 1

Environment Variables Reference

VariableRequiredDescription
GONIC_MUSIC_PATHYesPath to music library
GONIC_PODCAST_PATHNoPath for podcast downloads
GONIC_CACHE_PATHNoPath for cache files
GONIC_DB_PATHYesPath to SQLite database
GONIC_LISTEN_ADDRNoListen address (default: :4747)
GONIC_SCAN_INTERVALNoLibrary scan interval in minutes
GONIC_JUKEBOX_ENABLEDNoEnable jukebox mode

Deploying Gonic on Klutch.sh

    Push Your Repository to GitHub

    Commit your Dockerfile to GitHub.

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project named “gonic” or “music-server”.

    Create a New App

    Create a new app and connect your GitHub repository.

    Configure HTTP Traffic

    Set up HTTP traffic:

    • Select HTTP as the traffic type
    • Set the internal port to 4747

    Set Environment Variables

    VariableValue
    GONIC_MUSIC_PATH/music
    GONIC_DB_PATH/data/gonic.db
    GONIC_SCAN_INTERVAL60

    Attach Persistent Volumes

    Mount PathSizePurpose
    /music100+ GBMusic library files
    /data1 GBDatabase and configuration
    /cache10 GBTranscoding cache
    /podcasts10 GBPodcast downloads

    Deploy Your Application

    Click Deploy to build and launch Gonic.

    Upload Your Music

    Transfer your music files to the /music volume.

    Complete Initial Setup

    Access Gonic at your app URL. Create your admin account to get started.

Initial Configuration

Creating Admin Account

  1. Navigate to your Gonic URL
  2. Create the first (admin) user
  3. Set a strong password
  4. This user has full administrative access

Adding Music Folders

Gonic scans from the configured music path:

  1. Upload music to /music directory
  2. Organize by Artist/Album structure
  3. Trigger a scan from the admin interface

Multiple Music Folders

Support multiple source directories:

GONIC_MUSIC_PATH=/music:/music2:/music3

Client Apps

Mobile Apps

Popular Subsonic clients:

Android:

  • Ultrasonic
  • DSub
  • Substreamer
  • Tempo

iOS:

  • play:Sub
  • Substreamer
  • Amperfy

Desktop Apps

  • Sublime Music (Linux/macOS)
  • Submariner (macOS)
  • Sonixd (cross-platform)

Web Players

  • Airsonic Refix
  • Subplayer
  • Jamstash

Configuring Clients

Server Settings

In your Subsonic client:

  • Server URL: https://your-app.klutch.sh
  • Username: Your Gonic username
  • Password: Your Gonic password
  • Enable HTTPS: Yes

Music Library Organization

/music/
├── Artist Name/
│ ├── Album Name (Year)/
│ │ ├── 01 - Track Name.mp3
│ │ ├── 02 - Track Name.mp3
│ │ └── cover.jpg
│ └── Another Album/
└── Another Artist/

Supported Formats

Gonic supports common audio formats:

  • MP3
  • FLAC
  • OGG
  • AAC/M4A
  • WAV
  • OPUS

Transcoding

When to Use Transcoding

Transcoding converts audio on-the-fly:

  • Reduce bandwidth for mobile data
  • Convert FLAC to smaller formats
  • Compatibility with older devices

FFmpeg Configuration

Gonic uses FFmpeg for transcoding. Common profiles:

FormatBitrateUse Case
MP3320kHigh quality
MP3192kGood quality, less data
MP3128kMobile data saving
Opus128kEfficient modern codec

Podcast Support

Adding Podcasts

  1. Go to Settings > Podcasts
  2. Add podcast RSS feed URL
  3. Gonic downloads episodes automatically

Podcast Settings

  • Download interval
  • Episode retention
  • Storage location

Scrobbling

Last.fm Integration

  1. Go to Settings > Last.fm
  2. Link your Last.fm account
  3. Plays are scrobbled automatically

ListenBrainz Integration

  1. Go to Settings > ListenBrainz
  2. Enter your API token
  3. Plays are submitted automatically

Multi-User Setup

Creating Users

  1. Log in as admin
  2. Go to User Management
  3. Create new users
  4. Set permissions

User Permissions

  • Admin: Full access
  • User: Stream and create playlists
  • Guest: Stream only

Performance Tips

Library Scanning

  • Initial scan may take time for large libraries
  • Subsequent scans are incremental
  • Set scan interval based on library changes

Resource Usage

  • Disable transcoding if not needed
  • Use appropriate cache size
  • Monitor memory during scans

Troubleshooting

Music Not Appearing

  • Verify files are in correct path
  • Check file format is supported
  • Trigger manual scan
  • Review scan logs

Playback Issues

  • Check client settings
  • Verify network connectivity
  • Test with different client

Transcoding Errors

  • Verify FFmpeg is installed
  • Check transcoding profiles
  • Review error logs

Additional Resources

Conclusion

Deploying Gonic on Klutch.sh provides a lightweight, efficient music streaming solution for your personal library. With Subsonic compatibility, you can use your preferred client app on any device to access your music from anywhere.

The combination of Gonic’s minimal resource usage and Klutch.sh’s reliable hosting creates an ideal platform for personal music streaming.