Import some files and transform to working containers for:

* mysql
* lighttpd (with php and mysql)
* transmission
* sabnzbd
* sickbeard
* couchpotato
* headphones
* btsync
This commit is contained in:
2015-01-14 15:17:36 +00:00
parent ecb0bb0815
commit a307062d5b
81 changed files with 635 additions and 94 deletions

View File

@@ -0,0 +1,26 @@
#!/bin/bash
set -e
source /build/config
set -x
## Environment
export_env AUTOMYSQLBACKUP_VERSION_MAJOR 3.0
export_env AUTOMYSQLBACKUP_VERSION_MINOR rc6
export_env AUTOMYSQLBACKUP_VERSION v${AUTOMYSQLBACKUP_VERSION_MAJOR}_${AUTOMYSQLBACKUP_VERSION_MINOR}
export_env AUTOMYSQLBACKUP_CONFIG /etc/automysqlbackup/automysqlbackup.conf
export_env AUTOMYSQLBACKUP_DATA /host/var/backup/db
## AutoMySQLBackup
apt_get_install_permanent mysql-client
cd /opt
wget "http://downloads.sourceforge.net/project/automysqlbackup/AutoMySQLBackup/AutoMySQLBackup VER $AUTOMYSQLBACKUP_VERSION_MAJOR/automysqlbackup-$AUTOMYSQLBACKUP_VERSION.tar.gz"
mkdir automysqlbackup
tar xzf automysqlbackup-$AUTOMYSQLBACKUP_VERSION.tar.gz -C automysqlbackup
mkdir -p `dirname $AUTOMYSQLBACKUP_CONFIG`
cp /opt/automysqlbackup/automysqlbackup.conf $AUTOMYSQLBACKUP_CONFIG
## Configuration
sed -i "s,^#\(CONFIG_mysql_dump_username=\).*$,\1'backup'," $AUTOMYSQLBACKUP_CONFIG
sed -i "s,^#\(CONFIG_mysql_dump_host=\).*$,\1'mysql'," $AUTOMYSQLBACKUP_CONFIG
sed -i "s,^#\(CONFIG_backup_dir=\).*$,\1'/host/var/backup/db'," $AUTOMYSQLBACKUP_CONFIG
sed -i "s,^#\(CONFIG_db_exclude=\).*$,\1( 'mysql' 'information_schema' 'performance_schema' )," $AUTOMYSQLBACKUP_CONFIG

View File

@@ -3,19 +3,16 @@ set -e
source /build/config
set -x
## Redis
## Configuration
export_env BTSYNC_CONFIG /host/etc/btsync.conf
export_env BTSYNC_DATA /host/var/btsync
## BTsync
cd opt
wget -O btsync.tar.gz http://download-lb.utorrent.com/endpoint/btsync/os/linux-x64/track/stable
tar xzf btsync.tar.gz
rm btsync.tar.gz
export BTSYNC_CONFIG=/host/etc/btsync.conf
export BTSYNC_DATA=/host/var/btsync
## Runit script
mkdir /etc/service/btsync
mv /build/runit/btsync /etc/service/btsync/run
## Environment variables
echo -n $BTSYNC_CONFIG > /etc/container_environment/BTSYNC_CONFIG
echo -n $BTSYNC_DATA > /etc/container_environment/BTSYNC_DATA
## Remove installation files
if [ $MODE == "minimal" ]; then
rm btsync.tar.gz
fi

View File

@@ -5,7 +5,7 @@ set -x
## Remove temporary packages for minimal builds
if [ $MODE == "minimal" ]; then
cat /build/temporary | xargs apt-get -y --purge autoremove
cat /build/temporary | xargs apt_remove
fi
## Clean apt files

View File

@@ -0,0 +1,12 @@
#!/bin/bash
set -e
source /build/config
set -x
## Environment
export_env COUCHPOTATO_CONFIG /host/etc/couchpotato/config.ini
export_env COUCHPOTATO_DATA /host/var/lib/couchpotato
## CouchPotato
cd /opt
git clone https://github.com/RuudBurger/CouchPotatoServer.git

View File

@@ -0,0 +1,18 @@
#!/bin/bash
set -e
source /build/config
set -x
## Environment
export_env HEADPHONES_CONFIG /host/etc/headphones/config.ini
export_env HEADPHONES_CONFIG_DEFAULT /opt/headphones/config.ini
export_env HEADPHONES_DATA /host/var/lib/headphones
## Headphones
cd /opt
git clone https://github.com/rembo10/headphones.git
## Encoders
echo "deb http://ppa.launchpad.net/jon-severinsson/ffmpeg/ubuntu $(lsb_release -c -s) main" | sudo tee -a /etc/apt/sources.list
apt-get update
apt_get_install_permanent --force-yes ffmpeg libmp3lame0 ffmpeg libavcodec-extra-54

View File

@@ -4,7 +4,7 @@ source /build/config
set -x
## Hosts file hack
LD_LIBRARY_PATH=/root/lib
export_env LD_LIBRARY_PATH /root/lib
mkdir -p $LD_LIBRARY_PATH
cp /lib/x86_64-linux-gnu/libnss_files.so.2 $LD_LIBRARY_PATH
sed -i 's,/etc/hosts,/tmp/hosts,' $LD_LIBRARY_PATH/libnss_files.so.2

View File

@@ -3,6 +3,22 @@ set -e
source /build/config
set -x
## Enable configuration PHP in Lighttpd
ln -s /etc/lighttpd/conf-available/10-fastcgi.conf /etc/lighttpd/conf-enabled/10-fastcgi.conf
ln -s /etc/lighttpd/conf-available/15-fastcgi-php.conf /etc/lighttpd/conf-enabled/15-fastcgi-php.conf
## Environment
export_env PHP_CGI_PORT 5555
export_env PHP_CONFIG /host/etc/php.ini
## Enable configuration of PHP in Lighttpd
ln -s /etc/lighttpd/conf-available/10-fastcgi.conf /etc/lighttpd/conf-enabled/
cat << EOF > /etc/lighttpd/conf-enabled/15-fastcgi-php.conf
fastcgi.server += (
".php" => (
"localhost" =>(
"host" => "127.0.0.1",
"port" => $PHP_CGI_PORT
)
)
)
EOF
## Workaround for PHP socket
# sed -i "s,\(\"socket\"\s*=>\s*\"\).*$,\1/tmp/php.socket\"\,," /etc/lighttpd/conf-enabled/15-fastcgi-php.conf

View File

@@ -3,16 +3,29 @@ set -e
source /build/config
set -x
## Lighthttpd
apt_get_install_permanent lighttpd
## Environment
export_env LIGHTTPD_VERSION_MAJOR 1.4
export_env LIGHTTPD_VERSION_MINOR 35
export_env LIGHTTPD_VERSION $LIGHTTPD_VERSION_MAJOR.$LIGHTTPD_VERSION_MINOR
export_env LIGHTTPD_CONFIG /etc/lighttpd/lighttpd.conf
export_env LIGHTTPD_DOMAINS /host/etc/lighttpd
export_env LIGHTTPD_LOG /host/var/log/lighttpd/error.log
export_env LIGHTTPD_DATA /host/var/www/global
## Lighthttpd
apt_get_install_permanent lighttpd
apt-get build-dep -y lighttpd
apt_get_install_temporary automake
cd /opt
wget http://download.lighttpd.net/lighttpd/releases-$LIGHTTPD_VERSION_MAJOR.x/lighttpd-$LIGHTTPD_VERSION.tar.gz
tar xzf lighttpd-$LIGHTTPD_VERSION.tar.gz && \
cd lighttpd-$LIGHTTPD_VERSION/src
sed -i "s,\(pwd->pw_uid\s==\s\)0,\1-1," server.c
sed -i "s,\(grp->gr_gid\s==\s\)0,\1-1," server.c
cd ..
./configure
make
make install
## Configuration
sed -i "s,^\(server.errorlog\s*=\s*\).*$,\1\"$LIGHTTPD_LOG\"," $LIGHTTPD_CONFIG
sed -i "s,^\(server.document-root\s*=\s*\).*$,\1\"$LIGHTTPD_DATA\"," $LIGHTTPD_CONFIG
echo "include_shell \"cat $LIGHTTPD_DOMAINS/*.conf\"" >> $LIGHTTPD_CONFIG
sed -i "s,^\(server.username\s*=\s*\).*$,\1\"root\"," $LIGHTTPD_CONFIG
sed -i "s,^\(server.groupname\s*=\s*\).*$,\1\"root\"," $LIGHTTPD_CONFIG

View File

@@ -17,3 +17,9 @@ export_env MYSQL_DATA /host/var/lib/mysql
sed -i "s,^\(log_error\s*=\s*\).*$,\1$MYSQL_LOG," $MYSQL_CONFIG
sed -i "s,^\(datadir\s*=\s*\).*$,\1$MYSQL_DATA," $MYSQL_CONFIG
sed -i "s,^\(bind-address\s*=\s*\).*$,\10.0.0.0," $MYSQL_CONFIG
tee -a $MYSQL_CONFIG <<EOF
[mysqld]
skip-grant-tables
EOF
# mysql -u root -pdummy -e "GRANT ALL ON *.* to root@'%' IDENTIFIED BY 'dummy';"

View File

@@ -11,8 +11,6 @@ export_env PHP_TIMEZONE Europe/Amsterdam
## PHP
apt_get_install_temporary gcc make
cd /opt
#wget http://ftp.us.debian.org/debian/pool/main/l/linux/linux-libc-dev_3.2.54-2_amd64.deb
#dpkg -i linux-libc-dev_3.2.54-2_amd64.deb
apt_get_install_permanent libxml2-dev libcurl4-openssl-dev libbz2-dev libjpeg-dev libpng12-dev libmcrypt-dev
wget http://uk1.php.net/get/php-$PHP_VERSION.tar.gz/from/this/mirror -O php-$PHP_VERSION.tar.gz && \
tar xzf php-$PHP_VERSION.tar.gz && \
@@ -21,6 +19,13 @@ cd php-$PHP_VERSION
make
make install
## Remove installation files
if [ $MODE == "minimal" ]; then
cd ..
rm -r php-$PHP_VERSION
rm php-$PHP_VERSION.tar.gz
fi
## Configuration
cp /opt/php-$PHP_VERSION/php.ini-production $PHP_CONFIG
sed -i "s,^;\(date\.timezone\s*=\s*\)$,\1 $PHP_TIMEZONE," $PHP_CONFIG

View File

@@ -0,0 +1,31 @@
#!/bin/bash
set -e
source /build/config
set -x
## phpMyAdmin
export_env PMA_VERSION 4.3.6
export_env PMA_CONFIG /var/www/config.inc.php
cd /opt
wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/$PMA_VERSION/phpMyAdmin-$PMA_VERSION-all-languages.tar.gz -O phpMyAdmin-$PMA_VERSION.tar.gz
tar xzf phpMyAdmin-$PMA_VERSION.tar.gz
mv phpMyAdmin-$PMA_VERSION-* phpMyAdmin-$PMA_VERSION
rm -r /var/www
ln -s /opt/phpMyAdmin-$PMA_VERSION /var/www
## Remove installation files
if [ $MODE == "minimal" ]; then
rm phpMyAdmin-$PMA_VERSION.tar.gz
fi
## Configuration
cat << EOF > $PMA_CONFIG
<?php
\$cfg['blowfish_secret'] = 'random';
\$cfg['Servers'][1]['auth_type'] = 'cookie';
\$cfg['Servers'][1]['connect_type'] = 'tcp';
\$cfg['Servers'][1]['host'] = 'mysql';
\$cfg['Servers'][1]['compress'] = false;
\$cfg['Servers'][1]['extension'] = 'mysqli';
\$cfg['Servers'][1]['AllowNoPassword'] = true;
EOF

View File

@@ -3,15 +3,17 @@ set -e
source /build/config
set -x
## Create directories
mkdir /etc/container_environment
mkdir /opt/init.d
## Temporarily disable dpkg fsync to make building faster.
echo force-unsafe-io > /etc/dpkg/dpkg.cfg.d/02apt-speedup
## Prevent initramfs updates from trying to run grub and lilo.
## https://journal.paul.querna.org/articles/2013/10/15/docker-ubuntu-on-rackspace/
## http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594189
export INITRD=no
mkdir -p /etc/container_environment
echo -n no > /etc/container_environment/INITRD
export_env INITRD no
## Enable Ubuntu Universe and Multiverse.
sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list
@@ -42,7 +44,4 @@ apt-get dist-upgrade -y --no-install-recommends
## Fix locale
apt_get_install_permanent language-pack-en
locale-gen en_US
## Create directory for boot scripts
mkdir /opt/init.d/
locale-gen en_US

View File

@@ -22,3 +22,24 @@ mv /build/runit/redis /etc/service/redis/run
echo -n $REDIS_CONFIG > /etc/container_environment/REDIS_CONFIG
echo -n $REDIS_LOG > /etc/container_environment/REDIS_LOG
echo -n $REDIS_DATA > /etc/container_environment/REDIS_DATA
## TODO
# ENV REDIS_VERSION stable
# RUN cd /opt && \
# wget http://download.redis.io/releases/redis-$REDIS_VERSION.tar.gz && \
# tar xzf redis-$REDIS_VERSION.tar.gz && \
# cd redis-$REDIS_VERSION && \
# make
# RUN chmod +x /opt/redis-$REDIS_VERSION/src/redis-server
# ENV REDIS_CONFIG /etc/redis/redis-server.conf
# ENV REDIS_LOG /host/var/log/redis/redis-server.log
# ENV REDIS_DATA /host/var/lib/redis
# RUN mkdir -p `dirname $REDIS_CONFIG`
# RUN cp /opt/redis-$REDIS_VERSION/redis.conf $REDIS_CONFIG
# RUN sed -i "s,^\(logfile\s*\).*$,\1$REDIS_LOG," $REDIS_CONFIG
# RUN sed -i "s,^\(dir\s*\).*$,\1$REDIS_DATA," $REDIS_CONFIG

24
build/scripts/sabnzbd.sh Normal file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
set -e
source /build/config
set -x
## Environment
export_env RAR_VERSION 4.1.1
export_env SABNZBD_CONFIG /host/etc/sabnzbd/sabnzbd.ini
export_env SABNZBD_DATA /host/var/lib/sabnzbd
## SABnzbd
echo "deb http://ppa.launchpad.net/jcfp/ppa/ubuntu $(lsb_release -c -s) main" | sudo tee -a /etc/apt/sources.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:11371 --recv-keys 0x98703123E0F52B2BE16D586EF13930B14BB9F05F
apt-get update
apt_get_install_permanent sabnzbdplus
## Utilities
apt_get_install_permanent unzip par2 python-openssl python-yenc
## Rar
cd /opt
wget http://www.rarlab.com/rar/rarlinux-x64-$RAR_VERSION.tar.gz
tar xzf rarlinux-x64-$RAR_VERSION.tar.gz
ln -s /opt/rar/rar /usr/bin

View File

@@ -0,0 +1,13 @@
#!/bin/bash
set -e
source /build/config
set -x
## Environment
export_env SICKBEARD_CONFIG /host/etc/sickbeard/config.ini
export_env SICKBEARD_DATA /host/var/lib/sickbeard
## SickBeard
apt_get_install_permanent python-cheetah
cd /opt
git clone https://github.com/midgetspy/Sick-Beard.git

View File

@@ -0,0 +1,18 @@
#!/bin/bash
set -e
source /build/config
set -x
## Subliminal
pip install git+git://github.com/Diaoul/subliminal.git
cat << EOF > /opt/subliminal
#!/bin/bash
echo Filename to process. $1
echo Original filename... $2
echo Show TVDB id........ $3
echo Season number....... $4
echo Episode number...... $5
echo Episode air date.... $6
echo ... pass the episode info to Subliminal and fetch the subtitle
/usr/local/bin/subliminal -l en -- "$1"
EOF

View File

@@ -0,0 +1,14 @@
#!/bin/bash
set -e
source /build/config
set -x
## Transmission
apt_get_install_permanent transmission-daemon jq
## Environment
export_env TRANSMISSION_CONFIG /host/etc/transmission
export_env TRANSMISSION_TORRENTS /host/srv/torrents
export_env TRANSMISSION_DOWNLOAD /host/tmp/downloads
export_env TRANSMISSION_COMPLETE /host/srv/downloads
export_env TRANSMISSION_LOG /host/var/log/transmission/error.log

View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -e
source /build/config
set -x
## Environment
import_env LIGHTTPD_CONFIG
export_env LIGHTTPD_DOMAINS /host/etc/lighttpd
## Configuration
echo "include_shell \"cat $LIGHTTPD_DOMAINS/*.conf\"" >> $LIGHTTPD_CONFIG