source: gutenbach/debian/lib/README @ 9f0c46e

debianmacno-cupsnodebathenaweb
Last change on this file since 9f0c46e was 12722bc, checked in by Jessica B. Hamrick <jhamrick@…>, 14 years ago

Added a few comments to the README

  • Property mode set to 100644
File size: 11.1 KB
Line 
1sipbmp3
2    The SIPB MP3 Music Spooler
3
4We would love you forever if you took this README/INSTALL document and made
5a Debian package out of it.  That would be uber-awesome.  But otherwise, we're
6assuming that you just want to get sipbmp3 up and running on your own
7system.  Well, maybe we shouldn't assume that.
8
9
10What does sipbmp3 do?
11---------------------
12
13sipbmp3 is a music spooler.  As it turns out, streaming music is a hard
14problem, with lots of proprietary protocols, client and server software.
15All of these jiggety bits are kind of a pain to get working correctly,
16so, we built sipbmp3 on top of... a printer system.  It's very simple:
17you print an mp3 file to a special "printer", and it gets played on
18whatever speakers you're hooked up to.
19
20
21Prerequisites
22-------------
23
24You'll need a server hooked up to an audio system that you want to use, with
25Debathena installed on top of it.  Ubuntu Server Edition tends to work
26well.
27
28
29Installing sipbmp3
30------------------
31
32
331. Configuring your sound
34
35If you're installing sipbmp3 on a server environment, it's highly likely
36that you have a bare bones audio setup and everything is muted.  Make sure
37your sound works!  One common problem is that the daemon user (the user which
38will be actually playing the songs, or the user that your lpd, the print server,
39will be running under), isn't in the group audio, and thus can't play
40anything. If you're on Ubuntu Desktop, you'll probably have pulse-audio
41installed, in which case you should add lpd to the pulse-audio group
42as well, and make pulse-audio a single, system-wide instance. See
43this URL for detailed instructions:
44
45    http://www.pulseaudio.org/wiki/SystemWideInstance
46
47
482. Install some prerequisite software
49
50On a vanilla Ubuntu server install, sipbmp3 will also need the following
51packages to work properly:
52
53    * mplayer
54    * libimage-exiftool-perl
55
56mpg123 can also be useful for testing, but is not strictly necessary.
57
58
593. Setup sipbmp3
60
61The Git repository for sipbmp3 is located in:
62
63    /afs/sipb/project/sipbmp3/sipbmp3.git
64
65Place this in /root/sipbmp3; the remctl scripts will assume that the
66scripts can be found in this location.
67
68
694. Configure sipbmp3
70
71sipbmp3 will send zephyrs during playback start and end.  Since you don't
72want to be spamming sipb-auto (which is the default zephyr class these
73are sent to), you should create a configuration file:
74
75    /etc/sipbmp3-filter-config.pl
76
77That looks like:
78
79    $zephyr_class = "my-auto-class"
80    $host = "hostname"
81    $queue = "printername"
82
83XXX: Auto-detect hostname and invent a sane default zephyr class off of it.
84
85
865. Configure sipbmp3 init scripts
87
88sipbmp3 will attempt to drop some information into /var/run/sipbmp3, which
89needs to exist and you can't simply mkdir since /var/run on Ubuntu is
90a tempfs. Thus, add the following lines to a new file, /etc/init.d/sipbmp3:
91
92#!/bin/sh
93mkdir /var/run/sipbmp3
94touch /var/run/sipbmp3/status
95chmod 0777 /var/run/sipbmp3/status
96
97You should also run these commands yourself. :-)
98
99XXX: Note from jhamrick: I would recomment actually setting this up as a nice startup script, with a switch case for {start|stop|restart} (where with stop you just remove the directory, and with restart you remove the directory and then recreate it).  Also, sipbmp3 won't actually run on startup unless there are scripts in the /etc/rc*.d directory, so we need to do:
100
101> ln -s ../init.d/sipbmp3 /etc/rc2.d/S61sipbmp3
102> ln -s ../init.d/sipbmp3 /etc/rc3.d/S61sipbmp3
103> ln -s ../init.d/sipbmp3 /etc/rc4.d/S61sipbmp3
104> ln -s ../init.d/sipbmp3 /etc/rc5.d/S61sipbmp3
105> ln -s ../init.d/sipbmp3 /etc/rc0.d/K39sipbmp3
106> ln -s ../init.d/sipbmp3 /etc/rc1.d/K39sipbmp3
107> ln -s ../init.d/sipbmp3 /etc/rc6.d/K39sipbmp3
108
109XXX: We need better permissions for status. Also, quentin wants to put this
110file in AFS.
111
112
1136. Configure lpd
114
115You'll need to setup a printcap file so that your machine will be actually
116running a printer! The magic lines are:
117
118    :if=|/path/to/sipbmp3-filter
119    :lp=/dev/null
120
121Which mean that we pipe the mp3 files through sipbmp3-filter (which does
122the actual playing), and then dump the rest of the output into /dev/null,
123since we don't actually care about it.
124
125A standard printcap entry looks like this:
126
127printername
128  :server
129  :cm=Human Readable Printer Name
130  :lp=/dev/null
131  :if=|/path/to/sipbmp3-filter
132  :sd=/var/spool/lpd/printername
133  :ml=0:mx=0:sh:sf
134  :create_files
135
136printcap is located in /etc/printcap, but you can also edit the symlink
137in /etc/lprng/printcap.
138
139In /etc/lprng/lpd.conf:
140
141    printcap_path=...
142
143add /etc/lprng/printcap to the beginning of the pathlist, so it looks like:
144
145    printcap_path=/etc/lprng/printcap:|/usr/lib/get_hesiod_pcap
146
147/etc/printcap will also work, assuming lprng doesn't do something funky
148in the future.
149
150WARNING: On a cluster machine, get_hesiod_pcap will clobber sipbmp3
151because it sets all:all=someotherprinter, making lpr not see sipbmp3.
152There are two ways of fixing this:
153
1541. Patch /usr/lib/get_hesiod_pcap to return a full pcap line instead
155of all when it gets "all" from stdin.
156
1572. Remove get_hesiod_pcap from the list.
158
159To check your modifications, and create the necessary files and folders,
160you should run:
161
162    checkpc -V -f
163
164(As root, of course). You might get a failure on a directory
165/var/spool/lpd/%P doesn't exist; simply mkdir it and run checkpc -V -f
166
167With recent versions of lprng, you will also need to make lpd less paranoid
168about accepting connections.  This usually means the following two changes:
169
170In /etc/lprng/lpd.perms:
171
172    REJECT NOT SERVER
173
174should be commented out, as:
175
176    #REJECT NOT SERVER
177
178You will also need to add this line in lpd.conf:
179
180    lpd_listen_port=515
181
182By default, printers don't allow other users to remove other people's print
183jobs.  For an MP3 spooler, however, this may be a desirable trait, especially
184if someone trys to rickroll you.  You can let everyone lprm jobs by
185commenting out the line:
186
187    REJECT SERVICE=M
188
189XXX: On scourge, ACCEPT SERVICE=M SAMEHOST SAMEUSER doesn't seem to work
190properly, so removing the REJECT line is a must!
191
192XXXXXX: sipbmp3 accepts no responsibility for social faux pas that may
193be committed with this system.  It is consider good etiquette, however,
194to clear the status file if you're on zsr.
195
196XXXXXXXX: Another note from jhamrick (09/2009): debathena-lprng does not start up with the system by default.  debathena developers are currently deciding whether to change this, but in the meantine you will want to do:
197
198> ln -s ../etc/init.d/debathena-lprng /etc/rc2.d/S60debathena-lprng
199> ^rc2^rc3
200> ^rc3^rc4
201> ^rc4^rc5
202> ln -s ../etc/init.d/debathena-lprng /etc/rc0.d/K40debathena-lprng
203> ^rc0^rc1
204> ^rc1^rc6
205
2067. Test, round one
207
208The first test you should do to make sure sipbmp3 is configured properly is
209to attempt to play an mp3 file locally, via lpr.  The command you should use
210is:
211
212    mit-lpr -Pprintername@localhost filename.mp3
213
214Note the "mit-" prefix; Debathena defaults to CUPS, which we have not set
215up yet.
216
217See below for troubleshooting tips.
218
219
2208. Test, round two
221
222The second test you should do is try playing an MP3 remotely. The appropriate
223command is:
224
225    mit-lpr -Pprintername@hostname filename.mp3
226
227(Once again, with "mit-").  See below for troubleshooting tips.
228
229
2309. Troubleshooting
231
232So, it didn't work.  How did it fail?
233
234----
235sending job 'ezyang@vivace+800' to asdfasdf@localhost
236 connecting to 'localhost', attempt 1
237 cannot open connection to localhost - No such file or directory
238----
239
240This means that lpd is not accepting connections properly.  Check to see
241if you configured lpd.perms and lpd.conf correctly.  Try rebooting lpd
242by pkill lpd && lpd.  Use nmap to check of port 515 is open, both on the
243local machine and on a remote machine.  Check if networking is working
244on the server.  Use netstat to see what programs are listening to port
245515, and from which hosts.  Check iptables.
246
247----
248lpr: The printer or class was not found.
249----
250
251You're using lpr, not mit-lpr.
252
253----
254(no output, but no sound)
255----
256
257It looks like you managed to send the file over.  To diagnose the problems
258further:
259
260    * Check the zephyr logs of the class sipbmp3 was configured to
261      send messages to:
262
263        - If you see a reasonably full and formatted message, that means
264          that either: 1. your volume is turned off, or 2. mplayer is
265          horribly broken (XXX: it probably isn't, but I don't know what
266          error message it gives in that case)
267
268          By the way, be sure to check both the *hardware* and the
269          *software* volume.
270
271        - If you see a blank zephyr, that means that sipbmp3-filter died
272          trying to get a handle to /var/run/sipbmp3/status and failing.
273          Check if you created the file correctly, and that daemon has
274          permissions to write to it. If you rebooted recently, check if
275          you have the appropriate init.d script setup.
276
277    * Otherwise, check /var/spool/lpd/printername/status.pr (most of all the
278      other files are useless, especially including log):
279
280        - If you see a Perl error, fix it. The most common cause is because
281          exiftools is not installed.
282
283    * Otherwise, double check the userland code in sipbmp3-filter. XXX: There
284      are some edge-cases that don't give nice error messages, for example
285      the failed write to /var/run/sipbmp3/status
286
287
28810. Deploying CUPS
289------------------
290
291The final step is to give your newfangled printer a cups.mit.edu record.
292In order to do this, you will need to ask IS&T for a Moira pcap entry
293request.  Send mail to hesreq@mit.edu, specifying that you are setting
294up a sipbmp3 clone, that you want a Moira pcap entry, the printer name
295and server name of your queue, and that you want hwtype=LOCAL. It wouldn't
296hurt to also tell them where your print queue is, and a contact list.
297
298Once you get the pcap entry, ping sipb-cups@mit.edu to add your machine
299to the public list.
300
301
30211. Setting up keytabs on the machine
303-------------------------------------
304
305Email accounts@mit.edu and ask them for two keytabs: one for your machine,
306and one for "daemon" at your machine.  When you get the keytab, reset their
307passwords by running:
308
309    k5srvutil change -f your.keytab
310    k5srvutil delold -f your.keytab
311
312Now, install the machine-wide keytab in /etc/krb5.keytab, and install the
313daemon keytab as /etc/daemon.keytab.  (The first filename is required; the
314second can be changed.)  Make sure you chown and chgrp it to daemon.
315
316Finally, edit /etc/printcap and give it information about the Kerberos:
317
318sipbmp3: server
319    :cm=SIPB MP3 Spooler
320    ...
321    :auth_forward=kerberos5
322    :use_auth=kerberos5
323    :kerberos_id=daemon/your-machine-name.mit.edu@ATHENA.MIT.EDU
324    :kerberos_keytab=/etc/daemon.keytab
325
326
32712. Setting up remctl commands
328-----------------------------
329
330It's useful to be able to control the volume. Remctl is the way to do
331this without asking people to ssh in, and then alsamix(er).
332
333You will probably need to apt-get install remctl-server. Then, replace
334the /etc/remctl/conf.d directory with a Git checkout of
335/afs/sipb/project/sipbmp3/sipbmp3-remctl.git.
336
337Please note that remctl will NOT work without a keytab setup.
338
339
340X. Deploying sipbmp3web
341------------------------
342
343sipbmp3 web provides a nice and user-friendly interface for some common
344tasks. XXX: It is currently not portable beyond zsr. Stay tuned!
345
Note: See TracBrowser for help on using the repository browser.