Commit d4f0c467 authored by ale's avatar ale
Browse files

rename the project to "autoradio"

parent a22ea526
========
radio.ai
========
=========
autoradio
=========
The RadioAI service aims to provide a reliable, fault-tolerant Icecast
The *autoradio* service aims to provide a reliable, fault-tolerant Icecast
streaming network for audio and video. It provides all the necessary
components to ensure that the traffic from the source to the clients
is uninterrupted, even in face of high load or server crashes. All
......@@ -24,19 +24,19 @@ Installation
The simplest installation method is probably to use the pre-built
Debian packages (only available for amd64 at the moment), by placing
this line in ``/etc/apt/sources.list.d/radioai.list``::
this line in ``/etc/apt/sources.list.d/autoradio.list``::
deb http://www.incal.net/ale/debian radioai/
deb http://www.incal.net/ale/debian autoradio/
And then running::
$ sudo apt-get update
$ sudo apt-get install etcd radioai
$ sudo apt-get install etcd autoradio
This will install and start the necessary jobs (which will initially
fail due to the missing configuration).
Edit ``/etc/default/radioai`` and set, at least, the ``DOMAIN``
Edit ``/etc/default/autoradio`` and set, at least, the ``DOMAIN``
variable to what you've assigned to the cluster. The jobs will
automatically start as soon as the configuration is saved.
......@@ -55,7 +55,7 @@ bootstrap a new streaming cluster:
#. On every server, run the above-mentioned steps to set up the APT
repository and install (do not configure) the ``etcd`` and
``radioai`` packages.
``autoradio`` packages.
#. Pick one of your servers and add a delegation for
*radio.example.com* to it. For instance, with ``bind``::
......@@ -66,7 +66,7 @@ bootstrap a new streaming cluster:
``BOOTSTRAP=1``. Once you save the file, the ``etcd`` daemon will
start with an empty database.
#. On *machine1*, edit ``/etc/default/radioai`` and set
#. On *machine1*, edit ``/etc/default/autoradio`` and set
``DOMAIN=radio.example.com``. This will start the ``radiod`` and
``redirectord`` daemons, and you will be able to serve DNS records
for the *radio.example.com* zone. Check with::
......@@ -77,7 +77,7 @@ bootstrap a new streaming cluster:
#. Set up all other machines, setting
``ETCD_SERVER=etcd.radio.example.com`` in ``/etc/default/etcd`` and
``DOMAIN=radio.example.com`` in ``/etc/default/radioai``.
``DOMAIN=radio.example.com`` in ``/etc/default/autoradio``.
......@@ -93,9 +93,9 @@ an online CA (such as autoca_). This way, enrolling a new machine in
the cluster only requires generating a new client certificate, and no
other configuration.
Install the CA certificate in ``/etc/radioai/etcd_ca.pem``, the client
certificate in ``/etc/radioai/etcd_client.pem`` and its private key in
``/etc/radioai/etcd_client.key``, and the clients will connect to
Install the CA certificate in ``/etc/autoradio/etcd_ca.pem``, the client
certificate in ``/etc/autoradio/etcd_client.pem`` and its private key in
``/etc/autoradio/etcd_client.key``, and the clients will connect to
*etcd* using SSL authentication.
......
package radioai
package autoradio
import (
"bytes"
......@@ -10,7 +10,7 @@ import (
"sync"
"time"
"git.autistici.org/ale/radioai/third_party/github.com/coreos/go-etcd/etcd"
"git.autistici.org/ale/autoradio/third_party/github.com/coreos/go-etcd/etcd"
)
var (
......
......@@ -9,7 +9,7 @@ import (
"path/filepath"
"strings"
"git.autistici.org/ale/radioai"
"git.autistici.org/ale/autoradio"
)
// Describes the syntax of a command.
......@@ -66,9 +66,9 @@ func Run(cl CommandList) {
log.Fatalf("Unknown command '%s'", cmdArg)
}
func getClient() *radioai.RadioAPI {
etc := radioai.NewEtcdClient()
return radioai.NewRadioAPI(etc)
func getClient() *autoradio.RadioAPI {
etc := autoradio.NewEtcdClient()
return autoradio.NewRadioAPI(etc)
}
func deleteMount(args []string) {
......@@ -118,8 +118,8 @@ func createMount(args []string) {
// Create the new mount, randomly generate source authentication.
username := generateUsername(path)
password := radioai.GeneratePassword()
m := &radioai.Mount{
password := autoradio.GeneratePassword()
m := &autoradio.Mount{
Name: path,
Username: username,
Password: password,
......
......@@ -7,8 +7,8 @@ import (
"os/signal"
"syscall"
"git.autistici.org/ale/radioai"
"git.autistici.org/ale/radioai/node"
"git.autistici.org/ale/autoradio"
"git.autistici.org/ale/autoradio/node"
)
var (
......@@ -19,7 +19,7 @@ var (
func main() {
flag.Parse()
client := radioai.NewEtcdClient()
client := autoradio.NewEtcdClient()
n := node.NewRadioNode(*publicIp, client)
// Set up a clean shutdown function on SIGTERM.
......
......@@ -5,8 +5,8 @@ import (
"fmt"
"log"
"git.autistici.org/ale/radioai"
"git.autistici.org/ale/radioai/fe"
"git.autistici.org/ale/autoradio"
"git.autistici.org/ale/autoradio/fe"
)
var (
......@@ -15,8 +15,8 @@ var (
httpPort = flag.Int("http-port", 80, "HTTP port")
publicIp = flag.String("ip", "127.0.0.1", "Public IP for this machine")
staticDir = flag.String("static-dir", "/usr/share/radioai/htdocs/static", "Static content directory")
templateDir = flag.String("template-dir", "/usr/share/radioai/htdocs/templates", "HTML templates directory")
staticDir = flag.String("static-dir", "/usr/share/autoradio/htdocs/static", "Static content directory")
templateDir = flag.String("template-dir", "/usr/share/autoradio/htdocs/templates", "HTML templates directory")
lbPolicy = flag.String("lb-policy", "weighted", "Load balancing policy (weighted, leastloaded)")
......@@ -31,8 +31,8 @@ func main() {
log.Fatal("Must specify --domain")
}
client := radioai.NewEtcdClient()
api := radioai.NewRadioAPI(client)
client := autoradio.NewEtcdClient()
api := autoradio.NewRadioAPI(client)
dnsRed := fe.NewDnsRedirector(api, *domain, *publicIp, dnsTtl)
dnsRed.Run(fmt.Sprintf(":%d", *dnsPort))
......
# Defaults for radioai initscript
# sourced by /etc/init.d/radioai
# installed at /etc/default/radioai by the maintainer scripts
# Defaults for autoradio initscript
# sourced by /etc/init.d/autoradio
# installed at /etc/default/autoradio by the maintainer scripts
#
# This is a POSIX shell fragment
......
radioai (0.2) unstable; urgency=low
autoradio (0.2) unstable; urgency=low
* Update to the etcd 0.2 API.
-- ale <ale@incal.net> Fri, 15 Nov 2013 20:40:06 +0000
radioai (0.1) unstable; urgency=low
autoradio (0.1) unstable; urgency=low
* Initial Release.
......
Source: radioai
Source: autoradio
Section: net
Priority: extra
Maintainer: ale <ale@incal.net>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.4
Homepage: https://git.autistici.org/ale/radioai
Homepage: https://git.autistici.org/ale/autoradio
Package: radioai
Package: autoradio
Architecture: any
Depends: icecast2, runit, libcap2-bin, ${shlibs:Depends}, ${misc:Depends}
Description: Icecast clustering software.
......
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: radioai
Upstream-Name: autoradio
Source: <url://example.com>
Files: *
......
#!/bin/sh
# postinst script for radioai
# postinst script for autoradio
#
# see: dh_installdeb(1)
......
......@@ -16,9 +16,9 @@
# This has to be exported to make some magic below work.
export DH_OPTIONS
GOPKG = git.autistici.org/ale/radioai
GOPKG = git.autistici.org/ale/autoradio
DESTDIR = $(CURDIR)/debian/radioai
DESTDIR = $(CURDIR)/debian/autoradio
SVCDIR = $(DESTDIR)/etc/svc
%:
......@@ -39,20 +39,20 @@ override_dh_install:
rm -fr $$tmpdir)
# Install the static files and templates for the HTTP dashboard.
install -d -m 755 -o root -g root $(DESTDIR)/usr/share/radioai
install -d -m 755 -o root -g root $(DESTDIR)/usr/share/radioai/htdocs/static
install -d -m 755 -o root -g root $(DESTDIR)/usr/share/autoradio
install -d -m 755 -o root -g root $(DESTDIR)/usr/share/autoradio/htdocs/static
(for f in $(CURDIR)/fe/static/* ; do \
install -o root -g root -m 644 $$f $(DESTDIR)/usr/share/radioai/htdocs/static/ ; \
install -o root -g root -m 644 $$f $(DESTDIR)/usr/share/autoradio/htdocs/static/ ; \
done)
install -d -m 755 -o root -g root $(DESTDIR)/usr/share/radioai/htdocs/templates
install -d -m 755 -o root -g root $(DESTDIR)/usr/share/autoradio/htdocs/templates
(for f in $(CURDIR)/fe/templates/*.html ; do \
install -o root -g root -m 644 $$f $(DESTDIR)/usr/share/radioai/htdocs/templates/ ; \
install -o root -g root -m 644 $$f $(DESTDIR)/usr/share/autoradio/htdocs/templates/ ; \
done)
# Install runit service runners.
install -d -m 755 -o root -g root $(SVCDIR)
install -m 644 -o root -g root $(CURDIR)/debian/services/lib.sh \
$(DESTDIR)/usr/share/radioai/lib.sh
$(DESTDIR)/usr/share/autoradio/lib.sh
(for f in radiod redirectord ; do \
install -d -o root -g root $(SVCDIR)/$$f ; \
install -d -o root -g root $(SVCDIR)/$$f/log ; \
......@@ -65,5 +65,5 @@ override_dh_install:
# Icecast2 status XSL template.
install -d -m 755 -o root -g root $(DESTDIR)/usr/share/icecast2/web
install -m 644 -o root -g root $(CURDIR)/debian/radioai.xsl \
$(DESTDIR)/usr/share/icecast2/web/status-radioai.xsl
install -m 644 -o root -g root $(CURDIR)/debian/status.xsl \
$(DESTDIR)/usr/share/icecast2/web/status-autoradio.xsl
# Common functions for the 'radioai' startup scripts.
# Common functions for the 'autoradio' startup scripts.
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:$PATH
export PATH
test -e /etc/default/radioai && . /etc/default/radioai
test -e /etc/default/autoradio && . /etc/default/autoradio
if [ -z "${DOMAIN}" ]; then
echo "You must set DOMAIN in /etc/default/radioai!" 1>&2
echo "You must set DOMAIN in /etc/default/autoradio!" 1>&2
exit 1
fi
......
#!/bin/sh
. /usr/share/radioai/lib.sh
. /usr/share/autoradio/lib.sh
set_public_ip
set_etcd_params
......
#!/bin/sh
. /usr/share/radioai/lib.sh
. /usr/share/autoradio/lib.sh
set_public_ip
set_etcd_params
......
package radioai
package autoradio
import (
"flag"
......@@ -7,7 +7,7 @@ import (
"net"
"strings"
"git.autistici.org/ale/radioai/third_party/github.com/coreos/go-etcd/etcd"
"git.autistici.org/ale/autoradio/third_party/github.com/coreos/go-etcd/etcd"
)
var (
......
......@@ -9,7 +9,7 @@ import (
"strings"
"time"
"git.autistici.org/ale/radioai"
"git.autistici.org/ale/autoradio"
"github.com/miekg/dns"
)
......@@ -29,7 +29,7 @@ var (
// DNS server.
type DnsRedirector struct {
client *radioai.RadioAPI
client *autoradio.RadioAPI
queryStats *expvar.Map
targetStats *expvar.Map
origin string
......@@ -41,7 +41,7 @@ type DnsRedirector struct {
// NewDnsRedirector returns a DNS server for the given origin and
// publicIp. The A records served will have the specified ttl.
func NewDnsRedirector(client *radioai.RadioAPI, origin, publicIp string, ttl int) *DnsRedirector {
func NewDnsRedirector(client *autoradio.RadioAPI, origin, publicIp string, ttl int) *DnsRedirector {
if !strings.HasSuffix(origin, ".") {
origin += "."
}
......
......@@ -17,7 +17,7 @@ import (
_ "net/http/pprof"
"git.autistici.org/ale/radioai"
"git.autistici.org/ale/autoradio"
"github.com/PuerkitoBio/ghost/handlers"
)
......@@ -46,13 +46,13 @@ func statsHandler(h http.Handler, stats *expvar.Map) http.HandlerFunc {
type HttpRedirector struct {
domain string
lb LoadBalancingPolicy
client *radioai.RadioAPI
client *autoradio.RadioAPI
template *template.Template
stats *expvar.Map
targetStats *expvar.Map
}
func NewHttpRedirector(client *radioai.RadioAPI, domain string, lbpolicy string) *HttpRedirector {
func NewHttpRedirector(client *autoradio.RadioAPI, domain string, lbpolicy string) *HttpRedirector {
targetStats := new(expvar.Map).Init()
stats := expvar.NewMap("http")
stats.Set("targets", targetStats)
......@@ -74,7 +74,7 @@ func (h *HttpRedirector) pickActiveNode() string {
}
// Filter nodes where Icecast is reported to be up.
okNodes := make([]*radioai.NodeStatus, 0, len(nodes))
okNodes := make([]*autoradio.NodeStatus, 0, len(nodes))
for _, n := range nodes {
if n.IcecastUp {
okNodes = append(okNodes, n)
......@@ -92,7 +92,7 @@ func (h *HttpRedirector) pickActiveNode() string {
}
// Parse the request and extract the mount path.
func (h *HttpRedirector) getMount(r *http.Request) (*radioai.Mount, error) {
func (h *HttpRedirector) getMount(r *http.Request) (*autoradio.Mount, error) {
path := r.URL.Path
if strings.HasSuffix(path, ".m3u") {
path = path[:len(path)-4]
......@@ -101,7 +101,7 @@ func (h *HttpRedirector) getMount(r *http.Request) (*radioai.Mount, error) {
}
func makeIcecastUrl(server string) string {
return net.JoinHostPort(server, strconv.Itoa(radioai.IcecastPort))
return net.JoinHostPort(server, strconv.Itoa(autoradio.IcecastPort))
}
// Serve a response for a client connection to a relay.
......@@ -220,8 +220,8 @@ func (h *HttpRedirector) serveStatusPage(w http.ResponseWriter, r *http.Request)
mounts, _ := h.client.ListMounts()
ctx := struct {
Domain string
Nodes []*radioai.NodeStatus
Mounts []*radioai.Mount
Nodes []*autoradio.NodeStatus
Mounts []*autoradio.Mount
}{h.domain, nodes, mounts}
var buf bytes.Buffer
......
......@@ -3,21 +3,21 @@ package fe
import (
"log"
"git.autistici.org/ale/radioai"
"git.autistici.org/ale/autoradio"
"github.com/jmcvetta/randutil"
)
// A load balancing policy selects a single node from the pool of
// currently active ones.
type LoadBalancingPolicy interface {
GetNode([]*radioai.NodeStatus) *radioai.NodeStatus
GetNode([]*autoradio.NodeStatus) *autoradio.NodeStatus
}
// Simple load balancing policy that always returns the nodes with the
// least amount of listeners.
type leastListenersPolicy struct{}
func (llp leastListenersPolicy) GetNode(nodes []*radioai.NodeStatus) *radioai.NodeStatus {
func (llp leastListenersPolicy) GetNode(nodes []*autoradio.NodeStatus) *autoradio.NodeStatus {
minIdx := 0
min := 1000000
for i, n := range nodes {
......@@ -34,7 +34,7 @@ func (llp leastListenersPolicy) GetNode(nodes []*radioai.NodeStatus) *radioai.No
// number of active listeners.
type weightedListenersPolicy struct{}
func (wlp weightedListenersPolicy) GetNode(nodes []*radioai.NodeStatus) *radioai.NodeStatus {
func (wlp weightedListenersPolicy) GetNode(nodes []*autoradio.NodeStatus) *autoradio.NodeStatus {
choices := make([]randutil.Choice, 0, len(nodes))
weightBase := 1000000
for _, n := range nodes {
......@@ -45,7 +45,7 @@ func (wlp weightedListenersPolicy) GetNode(nodes []*radioai.NodeStatus) *radioai
if err != nil {
return nil
}
return result.Item.(*radioai.NodeStatus)
return result.Item.(*autoradio.NodeStatus)
}
func getNamedLoadBalancingPolicy(lbpolicy string) LoadBalancingPolicy {
......
......@@ -44,8 +44,8 @@
<div class="footer">
powered by
<a href="https://git.autistici.org/public/ale/radioai">
radioai 0.1
<a href="https://git.autistici.org/ale/autoradio">
autoradio 0.1
</a>
</div>
</div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment