Skip to content

fpeyraud/pigebox

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PigeBox

Free continuous recording solution

Components

  • Debian stable system

  • read-only root fs

  • dhcp network configuration

  • zeroconf hostname (avahi)

  • alsa continuous recording daemon (github.com/albanpeignier/alsabackup)

  • http access (nginx)

  • ssh access

Network

The network configuration is retrieved by dhcp at boot. The zeroconf hostname pigebox.local is published on the network.

The box is reachable via :

The record files are available via :

Storage

  • disk storage

  • 15 minutes recording files

  • automatic cleaning of older files

The storage filesystem must have the label pige and be writable for user pige. For example, to create your storage filesystem :

$ ssh [email protected]

# fdisk /dev/sda
...
# mke2fs -L pige -j /dev/sda1
# mount /srv/pige
# chown pige:audio /srv/pige

The alsa.backup daemon will detect automatically the new mount.

Monitoring

Munin

A munin node is started at boot.

Graphs are available on pigebox.local/munin/. These statistics are reset at each reboot.

For persistent statistics, use a external munin manager by adding a node for pigebox.local.

Log

alsa.backup daemon and cron log messages in syslog.

For the moment, it requires an ssh session :

ssh [email protected] tail -f /var/log/syslog

Distribution

  • iso image

  • disk image

Build

To create quickly a first image :

rake setup pigebox:rebuild

The image can be backup and restored to save bootstrap time :

rake pigebox:bootstrap pigebox:backup
# Then as many times as you need :
rake pigebox:restore pigebox:configure pigebox:dist:iso

To build an iso image :

rake pigebox:dist:iso

To build an disk image :

rake pigebox:dist:disk

You can configure the build with using a config file :

ImageBuilder.default_debian_mirror = "http://localhost:9999/debian"
ImageBuilder.ssh_pubkey = ENV['HOME'] + "/.ssh/another_id_rsa.pub"

See +rake -T+ for tasks details :

rake pigebox:backup     # Save the current image directory in tar archive
rake pigebox:bootstrap  # Boostrap debian system in image directory
rake pigebox:clean      # Clean image temporary directory
rake pigebox:configure  # Configure the pigebox image
rake pigebox:dist:iso   # Create an iso file from pigebox image
rake pigebox:dist:disk  # Create a disk image
rake pigebox:restore    # Restore the image directory with existing tar archive
rake setup              # Install some of required tools to create pigebox image

Boot

For the moment, an iso image is builded. You can test it with qemu.

Install qemu and its module:

sudo apt-get install qemu kqemu-source
sudo module-assistant a-i kqemu

Create an empty disk:

qemu-img create -f qcow2 /var/tmp/pigebox/disk.img 3G

You will need to initialize the pige storage after first boot (see Storage section).

Create a tap0 network interface:

sudo tunctl -u $USER -t tap0

Start qemu vm:

./script/boot cdrom  # to use iso distribution
./script/boot disk   # to use disk distribution

Create a bootable USB key with the pigebox distro

let's asume the USB key is mapped on /dev/sdc. Adapt with your own setup by looking
at dmesg right after plugging the key in the USB receptacle. You may need a 2GB key
for the standard setup, but a 512MB key may be enough for basic setup.
#create partitions on the key
sudo fdisk /dev/sdc
#delete every defined partition with 'd'
#Create the base partition
n
p
1
1
+500M
#Create the parameters partition
n
p
2
<enter> #this chooses the first cylinder after the last one allocated to the first partition
+100M
#The create 2 other partitions to handle distro updates (erf, sometime it will become a real product...)
n
p
3
<enter>
+500M
n
p
4
<enter>
<enter> #the last partition will use all the remaining space on the key
# make the base partition bootable
a
1
w #this writes the partition table on the USB key

Now remove and replug the USB key so that the new partition table is used

#let's format the different partitions
sudo mkfs.ext3 -L base -m 0 /dev/sdc1
sudo mkfs.ext3 -L params -m 0 /dev/sdc2
sudo mkfs.ext3 -L update1 -m 0 /dev/sdc3
sudo mkfs.ext3 -L update2 -m 0 /dev/sdc4

Once again, if partitions has not been auto-mounted, remove and replug the USB key
Now we copy the content of the pigebox image into the base partition

sudo cp -a /var/tmp/pigebox/image/* /media/base/

Then we must install grub on the USB key MBR

#first let's make a mark on the USB key
sudo touch /media/base/boot/usbkey

#The grub stuff
sudo grub
grub> find /boot/usbkey
  (hd2,0)
grub> root (hd2,0)
grub> setup (hd2)
grub> quit

There you are, your USB should be bootable now !

About

PigeBox Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • D 100.0%