Compare commits

..

No commits in common. "7cd44bbe53622c6569eda33aeee8b1dde356ea3f" and "1d8e07bf0468a7440d4c2d26a5e68020983ea9d8" have entirely different histories.

13 changed files with 101 additions and 191 deletions

View file

@ -11,10 +11,6 @@ root_access:
- polyfloyd
nginx_client_max_body_size: 512M
nginx_sites:
- server_name: "music.bitlair.nl"
snippets:
- "music-nginx.j2"
music_domain: music.bitlair.nl
acme_san_domains:

View file

@ -6,5 +6,5 @@
- { role: "acme", tags: [ "acme" ] }
- { role: "deb_forgejo", tags: [ "deb_forgejo" ] }
- { role: "go", tags: [ "go" ] }
- { role: "nginx", tags: [ "nginx" ] }
# - { role: "nginx", tags: [ "nginx" ] }
- { role: "music", tags: [ "music" ] }

View file

@ -1,5 +1,2 @@
music_audio_user: audio
music_audio_group: audio
music_librespot_user: librespot
music_mqtt_mpd_volume: bitlair/music/space/volume

View file

@ -2,25 +2,19 @@
- ansible.builtin.import_tasks:
file: ../../common/handlers/main.yaml
- name: restart mpd
ansible.builtin.systemd:
name: mpd
state: restarted
daemon_reload: true
- name: Restart trollibox
ansible.builtin.systemd:
name: trollibox
state: restarted
daemon_reload: true
- name: rebuild librespot
- name: Rebuild librespot
ansible.builtin.command:
cmd: /root/.cargo/bin/cargo build --release --features pulseaudio-backend
cmd: /root/.cargo/bin/cargo build --release --features jackaudio-backend
args:
chdir: /opt/librespot
- name: restart librespot
- name: Restart librespot
ansible.builtin.systemd:
name: librespot
state: restarted

View file

@ -1,11 +1,8 @@
---
- name: Create librespot user
user:
name: "{{ music_librespot_user }}"
system: true
home: /var/lib/librespot
groups:
- "{{ music_audio_group }}"
- name: Install dependencies
ansible.builtin.apt:
name: libjack-jackd2-dev
state: present
- name: Clone librespot source
ansible.builtin.git:
@ -14,8 +11,8 @@
dest: /opt/librespot
accept_hostkey: yes
notify:
- rebuild librespot
- restart librespot
- Rebuild librespot
- Restart librespot
- name: Install service file
ansible.builtin.template:
@ -24,7 +21,7 @@
owner: root
group: root
mode: 0644
notify: restart librespot
notify: Restart librespot
- name: Enable Librespot
ansible.builtin.systemd:
@ -32,5 +29,3 @@
state: started
enabled: true
daemon_reload: true
- meta: flush_handlers

View file

@ -23,3 +23,12 @@
file: soundboard.yaml
tags:
- music_soundboard
- name: Install nginx config
ansible.builtin.template:
src: nginx-site.conf
dest: /etc/nginx/sites-enabled/trollibox
owner: root
group: root
mode: 0644
notify: Reload nginx

View file

@ -1,32 +1,14 @@
---
- name: Install MPD
ansible.builtin.apt:
name: mpd
name:
- jackd
- mpd
- python3-mpd
- python3-serial
state: present
- name: Add mpd user to the {{ music_audio_group }} group
user:
name: mpd
groups:
- "{{ music_audio_group }}"
notify: restart mpd
- name: Install mpd file
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: 0644
notify: restart mpd
with_items:
- src: mpd.conf
dest: /etc/mpd.conf
- src: mpd.service
dest: /etc/systemd/system/mpd.service
- src: mpd_state
dest: /var/lib/mpd/state.default
- name: Install mpd-volume-to-mqtt script
ansible.builtin.template:
src: mpd-volume-to-mqtt.sh
@ -52,13 +34,6 @@
enabled: true
daemon_reload: true
- name: Install skipbutton depedencies
ansible.builtin.apt:
name:
- python3-mpd
- python3-serial
state: present
- name: Clone skipbutton source
ansible.builtin.git:
repo: https://github.com/bitlair/skipbutton.git

View file

@ -3,15 +3,16 @@
[Unit]
Description=Spotify through Librespot
After=network.target
Requires=jackd.service
[Service]
Type=simple
Restart=always
RestartSec=2s
ExecStart=/opt/librespot/target/release/librespot --name Trollibox --backend pulseaudio --volume-ctrl linear
Environment="PULSE_SERVER=/tmp/pipewire-pulse-socket"
Environment="XDG_RUNTIME_DIR=/run/user/0"
User={{ music_librespot_user }}
ExecStart=/opt/librespot/target/release/librespot --name Trollibox --backend jackaudio
User={{ music_audio_user }}
Group={{ music_audio_user }}
AmbientCapabilities=CAP_IPC_LOCK,CAP_SYS_NICE
[Install]
WantedBy=multi-user.target

View file

@ -1,40 +0,0 @@
# {{ ansible_managed }}
user "mpd"
group "{{ music_audio_group }}"
bind_to_address "any"
port "6600"
max_connections "20"
zeroconf_enabled "yes"
zeroconf_name "MPD @ %h"
music_directory "/srv/media/music"
auto_update "yes"
filesystem_charset "UTF-8"
playlist_directory "/var/lib/mpd/playlists"
db_file "/var/lib/mpd/tag_cache"
state_file "/var/lib/mpd/state"
sticker_file "/var/lib/mpd/sticker.sql"
input {
plugin "curl" # Required for web streams.
}
decoder {
plugin "hybrid_dsd"
enabled "no"
}
decoder {
plugin "wildmidi"
enabled "no"
}
audio_output {
type "pulse"
name "Pulse"
server "/tmp/pipewire-pulse-socket"
}

View file

@ -1,21 +0,0 @@
# {{ ansible_managed }}
[Unit]
Description=Music Player Daemon
After=network.target
[Service]
Type=simple
ExecStartPre=/bin/mkdir -p /run/mpd
ExecStartPre=/bin/chown -R mpd:nogroup /run/mpd
ExecStartPre=/bin/touch /var/log/mpd.log
ExecStartPre=/bin/chown mpd:nogroup /var/log/mpd.log
ExecStartPre=/usr/bin/cp /var/lib/mpd/state.default /var/lib/mpd/state
ExecStart=/usr/bin/mpd --no-daemon /etc/mpd.conf
# MDP will fork itself to the user defined in its config
User=root
LimitMEMLOCK=infinity
LimitRTPRIO=99
[Install]
WantedBy=multi-user.target

View file

@ -1,17 +0,0 @@
sw_volume: 20
audio_device_state:1:Pulse
state: play
current: 0
time: 0
random: 0
repeat: 0
single: 0
consume: 0
crossfade: 0
mixrampdb: 0.000000
mixrampdelay: -1.000000
playlist_begin
song_begin: http://ice4.somafm.com/groovesalad-256-mp3
Name: SomaFM Groove Salad
song_end
playlist_end

View file

@ -0,0 +1,70 @@
# {{ ansible_managed }}
server {
listen 80 default_server;
listen [::]:80 default_server;
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
server_name {{ music_domain }};
{% if acme_bootstrap_certs %}
include "snippets/snakeoil.conf";
{% else %}
ssl_certificate "/var/lib/dehydrated/certs/{{ music_domain }}/fullchain.pem";
ssl_certificate_key "/var/lib/dehydrated/certs/{{ music_domain }}/privkey.pem";
{% endif %}
{% for range in trusted_ranges %}
allow {{ range.cidr }};
{% endfor %}
deny all;
location / {
rewrite ^/(.*) https://{{ music_domain }}/trollibox/player/space?;
}
location /trollibox/ {
proxy_pass http://[::1]:3000/;
client_max_body_size 512M;
include proxy_params;
}
location ~ ^/trollibox/(.+/events)$ {
proxy_pass http://[::1]:3000/$1;
include proxy_params;
proxy_http_version 1.1;
chunked_transfer_encoding off;
add_header X-Test "123";
proxy_set_header Connection '';
proxy_buffering off;
proxy_read_timeout 7d;
}
location ~ ^/trollibox/(.+/listen)$ {
proxy_pass http://[::1]:3000/$1;
include proxy_params;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 7d;
}
location /bobdsp/ {
proxy_pass http://[::1]:8081/;
include proxy_params;
}
location /vis/ {
allow all;
proxy_pass http://[::1]:13378/;
include proxy_params;
}
location = /vis/ {
rewrite ^(.*)$ /vis/index.html;
include proxy_params;
}
include "snippets/acme.conf";
}

View file

@ -1,49 +0,0 @@
{% for range in trusted_ranges %}
allow {{ range.cidr }};
{% endfor %}
deny all;
location / {
rewrite ^/(.*) https://{{ music_domain }}/trollibox/player/space?;
}
location /trollibox/ {
proxy_pass http://[::1]:3000/;
include proxy_params;
}
location ~ ^/trollibox/(.+/events)$ {
proxy_pass http://[::1]:3000/$1;
include proxy_params;
proxy_http_version 1.1;
chunked_transfer_encoding off;
add_header X-Test "123";
proxy_set_header Connection '';
proxy_buffering off;
proxy_read_timeout 7d;
}
location ~ ^/trollibox/(.+/listen)$ {
proxy_pass http://[::1]:3000/$1;
include proxy_params;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 7d;
}
location /bobdsp/ {
proxy_pass http://[::1]:8081/;
include proxy_params;
}
location /vis/ {
allow all;
proxy_pass http://[::1]:13378/;
include proxy_params;
}
location = /vis/ {
rewrite ^(.*)$ /vis/index.html;
include proxy_params;
}