Airsonic
Music streaming.
See Airsonic Docker and Documentation.
Ports
Ports (Airsonic)
Port
Protocol
Type
Purpose
4040
TCP
EXPOSED
Airsonic webservice
Updated: None
Files
Airsonic Files
Location
Purpose
/config
Airsonic configuration directory
/config/airsonic.properties
Global airsonic configuration
/playlists
Playlists data
/podcasts
Podcasts data
/music
Music data
/media
Additional media data (videos; etc)
Updated: None
Docker Creation
You can copy your existing configuration to docker /config
directory
adjusting for paths.
airsonic:
image: linuxserver/airsonic
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000
- JAVA_OPTS=-Xmx256m -Xms256m
- TZ=America/Los_Angeles
volumes:
- /data/services/airsonic/config:/config
- /data/services/airsonic/playlists:/playlists
- /data/media/podcasts:/podcasts:ro
- /data/media/music:/music:ro
- /data/other/media:/media:ro
- /etc/localtime:/etc/localtime:ro
Proxy will forward traffic to the container, so no ports need to be exposed.
Use environment
CONTEXT_PATH=URL_BASE
if airsonic is serving from a subpath.Limit airsonic to 256MB for initial memory size, and heap size. See Java Xmx and Xms options.
Reverse Proxy Setup
Allows you to isolate your containers as well as wrap connections in SSL. See NGINX for more details. See Setup Base Proxy Control for basic proxy configuration.
Enable Forward Headers
Airsonic must be configured to expect requests through a proxy otherwise connections will fail through a reverse proxy. Enable this and restart the service before testing proxy configuration. Start the service to create a new file if it doesn’t exist.
server.use-forward-headers=true
Using Subdomains
server {
listen 443 ssl http2;
server_name airsonic.{DOMAIN} airsonic;
location / {
proxy_bind {NGINX PROXY IP};
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_max_temp_file_size 0;
proxy_pass http://airsonic:4040;
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
add_header X-Content-Type-Options "nosniff";
add_header X-Frame-Options SAMEORIGIN;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
}
}
Using Subpaths
server {
listen 443 ssl http2;
server_name airsonic.{DOMAIN} airsonic;
location /airsonic {
proxy_bind {NGINX PROXY IP};
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_max_temp_file_size 0;
proxy_pass http://airsonic:4040;
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
add_header X-Content-Type-Options "nosniff";
add_header X-Frame-Options SAMEORIGIN;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
}
}
Note
Use environment CONTEXT_PATH=URL_BASE
if airsonic is serving from a
subpath.
Postgres Backend
Postgres may be used to store airsonic data in a centralized location. This assumes that Postgresql is already configured, with an empty database for airsonic to use (see Creating A Database).
networks:
db:
external: True
airsonic:
image: linuxserver/airsonic
networks:
- db
DatabaseConfigType=embed
DatabaseConfigEmbedDriver=org.postgresql.Driver
DatabaseConfigEmbedUsername={USER}
DatabaseConfigEmbedPassword={PASS}
DatabaseConfigEmbedUrl=jdbc:postgresql://{DB IP}:{DB PORT}/airsonic?stringtype=unspecified
DatabaseUsertableQuote="
Note
Launch airsonic and shutdown after it finishes starting up. The initial DB incorrectly defines two postgres datatypes. Correct this by executing the following commands below when Airsonic is shutdown.
ALTER TABLE system_avatar ALTER COLUMN data TYPE bytea USING NULL;
ALTER TABLE custom_avatar ALTER COLUMN data TYPE bytea USING NULL;
Restart Airsonic to complete DB setup.
References