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

@@ -1 +1 @@
docker images | grep '<none>' | awk '{print $3}' | xargs docker rmi docker images | grep '<none>' | awk '{print $3}' | xargs docker rmi -f

View File

@@ -3,14 +3,15 @@ HOME = $(DOCKER_HOME)
BASE = $(HOME)/build BASE = $(HOME)/build
FILE = $(BASE)/Dockerfile FILE = $(BASE)/Dockerfile
FROM = ubuntu:trusty FROM = ubuntu:trusty
PORT = 8001 INTERFACE = eth0
MODE = minimal PORT = 8000
ARGS = --rm=true #--no-cache MODE = normal
ARGS = --rm=false# --no-cache
include $(wildcard $(HOME)/build/make/*.mk) include $(wildcard $(HOME)/build/make/*.mk)
define download define download
@echo 'RUN wget -q $(1) $$HOST_ADDR:$$HOST_PORT/$(2) $(3)' >> ${FILE} @$(eval MD5=$(shell md5sum build/$(2) | awk '{print $$1}'))
@echo 'RUN wget -q $(1) $$HOST_ADDR:$$HOST_PORT/$(2) $(3) # $(MD5)' >> ${FILE}
endef endef
define execute define execute
@@ -32,25 +33,20 @@ define script
$(call execute,scripts/$(1).sh) $(call execute,scripts/$(1).sh)
endef endef
define script_force
$(call execute,scripts/$(1).sh?random=$(RANDOM))
endef
all: build bin service clean all: build bin service clean
build: prepare build: prepare base
$(call script,cleanup) $(call script,cleanup)
@echo 'RUN chmod +x /opt/init.d/*' >> ${FILE} @echo 'RUN chmod +x /opt/init.d/*' >> ${FILE}
@echo 'CMD ["/opt/init"]' >> ${FILE} @echo 'CMD ["/opt/init"]' >> ${FILE}
@$(shell cd ${BASE} && python -m SimpleHTTPServer $(PORT) > /dev/null &) @$(shell cd ${BASE} && python -m SimpleHTTPServer $(PORT) > /dev/null &)
@sleep 2
@docker build -t $(NAME):$(VERSION) $(ARGS) ${BASE} @docker build -t $(NAME):$(VERSION) $(ARGS) ${BASE}
@kill -9 $(lsof -i tcp:$(PORT) -t) @kill -9 $(lsof -i tcp:$(PORT) -t)
prepare: prepare:
@echo FROM $(FROM) > ${FILE} @echo FROM $(FROM) > ${FILE}
@echo ENV MODE $(MODE) >> ${FILE} @echo ENV MODE $(MODE) >> ${FILE}
@$(eval HOST_ADDR := $(shell ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{print $$1}')) @$(eval HOST_ADDR := $(shell ifconfig $(INTERFACE) | grep 'inet addr:' | cut -d: -f2 | awk '{print $$1}'))
@echo ENV HOST_ADDR $(HOST_ADDR) >> ${FILE} @echo ENV HOST_ADDR $(HOST_ADDR) >> ${FILE}
@echo ENV HOST_PORT $(PORT) >> ${FILE} @echo ENV HOST_PORT $(PORT) >> ${FILE}
@echo 'RUN apt-get install -y wget' >> ${FILE} @echo 'RUN apt-get install -y wget' >> ${FILE}

View File

@@ -0,0 +1,3 @@
#!/bin/bash
set -e
/opt/automysqlbackup/automysqlbackup $AUTOMYSQLBACKUP_CONFIG

7
build/boot/btsync.sh Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
set -e
if [[ ! -e $BTSYNC_CONFIG ]]; then
mkdir -p `dirname $BTSYNC_CONFIG`
/opt/btsync --dump-sample-config > $BTSYNC_CONFIG
sed -i "s,\(\"listen\"\s*:\).*,\1 \"0.0.0.0:8888\"\,," $BTSYNC_CONFIG
fi

68
build/boot/couchpotato.sh Normal file
View File

@@ -0,0 +1,68 @@
#!/bin/bash
set -e
mkdir -p `dirname $COUCHPOTATO_CONFIG`
if [[ ! -e $COUCHPOTATO_CONFIG ]]; then
cat << EOF > $COUCHPOTATO_CONFIG
[core]
show_wizard = 0
[updater]
enabled = 0
[binsearch]
enabled = 1
[nzbclub]
enabled = 1
[kickasstorrents]
enabled = 1
[thepiratebay]
domain =
enabled = 1
extra_score = 0
seed_time = 40
seed_ratio = 1
[yify]
enabled = 1
[blackhole]
directory = /host/srv/torrents
manual = 0
enabled = 1
use_for = torrent
create_subdir = 0
[sabnzbd]
category = movies
delete_failed = 1
enabled = 1
manual = 0
host = sabnzbd:8083
remove_complete = 1
[transmission]
username = user
manual = 0
enabled = 1
host = transmission:9091
stalled_as_failed = 1
delete_failed = 1
rpc_url = transmission
delete_files = 1
remove_complete = 1
[manage]
cleanup = 1
enabled = 1
library = /host/srv/movies
startup_scan = 1
library_refresh_interval = 0
[renamer]
from = /host/srv/downloads
to = /host/srv/movies
EOF
fi

41
build/boot/headphones.sh Normal file
View File

@@ -0,0 +1,41 @@
#!/bin/bash
set -e
mkdir -p `dirname $HEADPHONES_CONFIG`
mkdir -p `dirname $HEADPHONES_DATA`
if [[ ! -e $HEADPHONES_CONFIG ]]; then
cat << EOF > $HEADPHONES_CONFIG
[General]
cache_dir = /host/var/lib/headphones
music_dir = /host/srv/headphones
destination_dir = /host/srv/headphones
preferred_bitrate = 192
auto_add_artists = 1
correct_metadata = 1
move_files = 1
rename_files = 1
folder_format = $Artist/$Album
file_format = $Artist - $Title
file_underscores = 0
cleanup_files = 1
add_album_art = 1
album_art_format = $Artist - $Album
nzb_downloader = 1
torrent_downloader = 1
download_dir = /host/srv/downloads
autowant_upcoming = 1
torrentblackhole_dir = ""
isohunt = 1
kat = 1
mininova = 1
piratebay = 1
download_torrent_dir = /host/srv/downloads
music_encoder = 1
encoder = ffmpeg
bitrate = 192
samplingfrequency = 44100
[SABnzbd]
sab_host = http://sabnzbd:8080/
[Transmission]
transmission_host = transmission:9091
EOF
fi

View File

@@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -e set -e
echo "127.0.0.1 localhost" >> /tmp/hosts # echo "127.0.0.1 localhost" >> /tmp/hosts
cp /etc/hosts /tmp
echo "$HOST_ADDR host" >> /tmp/hosts echo "$HOST_ADDR host" >> /tmp/hosts

View File

@@ -0,0 +1,5 @@
#!/bin/bash
set -e
if [[ ! -e $PHP_CONFIG ]]; then
cp /usr/local/lib/php.ini $PHP_CONFIG
fi

3
build/boot/phpmyadmin.sh Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
set -e
sed -i "s,\(\['host'\]\s*=\s*\).*$,\1'$MYSQL_PORT_3306_TCP_ADDR';," $PMA_CONFIG

15
build/boot/sabnzbd.sh Normal file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
set -e
mkdir -p `dirname $SABNZBD_CONFIG`
if [[ ! -e $SABNZBD_CONFIG ]]; then
cat << EOF > $SABNZBD_CONFIG
[misc]
log_dir = /host/var/log/sabnzbd
admin_dir = /host/var/lib/sabnzbd/admin
download_dir = /host/tmp/downloads
cache_dir = /host/var/lib/sabnzbd/cache
complete_dir = /host/srv/downloads
auto_browser = 0
[servers]
EOF
fi

28
build/boot/sickbeard.sh Normal file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
set -e
mkdir -p `dirname $SICKBEARD_CONFIG`
if [[ ! -e $SICKBEARD_CONFIG ]]; then
cat << EOF > $SICKBEARD_CONFIG
[General]
config_version = 6
log_dir = /host/var/log/sickbeard
use_nzbs = 1
use_torrents = 1
nzb_method = sabnzbd
flatten_folders_default = 1
root_dirs = 0|/host/srv/shows
tv_download_dir = /host/srv/downloads
process_automatically = 1
rename_episodes = 1
extra_scripts = /opt/subtitles
[Blackhole]
nzb_dir = ""
torrent_dir = /host/srv/torrents
[SABnzbd]
sab_username = ""
sab_password = ""
sab_apikey = ""
sab_category = tv
sab_host = http://sabnzbd:8080/
EOF
fi

View File

@@ -0,0 +1,16 @@
#!/bin/bash
set -e
mkdir -p $TRANSMISSION_CONFIG
if [[ ! -e $TRANSMISSION_CONFIG ]]; then
cat /etc/transmission-daemon/settings.json |
jq ".[\"download-dir\"] = \"$TRANSMISSION_COMPLETE\"" |
jq ".[\"download-limit\"] = \"$DOCKER_HOME\"" |
jq ".+ {
\"rpc-whitelist-enabled\": false,
\"watch-dir\": \"$TRANSMISSION_TORRENTS\",
\"watch-dir-enabled\": true,
\"incomplete-dir\": \"$TRANSMISSION_DOWNLOAD\",
\"incomplete-dir-enabled\": true,
\"port-forwarding-enabled\": true
}" > $TRANSMISSION_CONFIG/settings.json
fi

6
build/boot/webserver.sh Normal file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
set -e
mkdir -p $LIGHTTPD_DOMAINS
if [[ ! -e $LIGHTTPD_DOMAINS ]]; then
touch $LIGHTTPD_DOMAINS/empty.conf
fi

View File

@@ -5,15 +5,27 @@ apt_get_install='apt-get install -y --no-install-recommends'
apt_get_install_permanent() { apt_get_install_permanent() {
echo $@ >> /build/permanent echo $@ >> /build/permanent
$apt_get_install "$@" $apt_get_install "$@"
} }
apt_get_install_temporary() { apt_get_install_temporary() {
echo $@ >> /build/temporary echo $@ >> /build/temporary
$apt_get_install "$@" $apt_get_install "$@"
}
apt_remove() {
apt-get -y --purge autoremove
} }
export_env() { export_env() {
export $1="$2" export $1="$2"
echo -n $2 > /etc/container_environment/$1 echo -n $2 > /etc/container_environment/$1
}
import_env() {
export $1=`cat /etc/container_environment/$1`
}
add_host() {
echo "echo \"\$${1^^}_PORT_3306_TCP_ADDR $1\" >> /tmp/hosts" >> /opt/init.d/*_hosts
} }

View File

@@ -1,5 +1,5 @@
#!/usr/bin/python2 -u #!/usr/bin/python2 -u
# Copyright (c) 2014 Rik Veenboer <rik.veenboer@gmail.com> # Copyright (c) 2015 Rik Veenboer <rik.veenboer@gmail.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@@ -0,0 +1,3 @@
automysqlbackup:
$(call script,$@)
$(call boot,02,$@)

View File

@@ -1,3 +1,3 @@
btsync: btsync:
cp $(BASE)/scripts/*_$@.sh build/scripts $(call script,$@)
cp $(BASE)/runit/$@ build/runit $(call runit,$@)

View File

@@ -0,0 +1,4 @@
couchpotato:
$(call script,$@)
$(call boot,02,$@)
$(call runit,$@)

4
build/make/headphones.mk Normal file
View File

@@ -0,0 +1,4 @@
headphones:
$(call script,$@)
$(call boot,02,$@)
$(call runit,$@)

View File

@@ -1,2 +1,4 @@
lighttpd-php: php lighttpd lighttpd-php: php lighttpd
$(call script_force,$@) $(call script,$@)
$(call boot,02,$@)
$(call runit,$@)

View File

@@ -1,3 +1,3 @@
lighttpd: lighttpd:
$(call script_force,$@) $(call script,$@)
$(call runit,$@) $(call runit,$@)

View File

@@ -1,3 +1,3 @@
mysql: mysql:
$(call script_force,$@) $(call script,$@)
$(call runit,$@) $(call runit,$@)

View File

@@ -1,2 +1,2 @@
php: php:
$(call script_force,$@) $(call script,$@)

3
build/make/phpmyadmin.mk Normal file
View File

@@ -0,0 +1,3 @@
phpmyadmin: lighttpd-php
$(call script,$@)
$(call boot,02,$@)

4
build/make/sabnzbd.mk Normal file
View File

@@ -0,0 +1,4 @@
sabnzbd:
$(call script,$@)
$(call boot,02,$@)
$(call runit,$@)

4
build/make/sickbeard.mk Normal file
View File

@@ -0,0 +1,4 @@
sickbeard: subliminal
$(call script,$@)
$(call boot,02,$@)
$(call runit,$@)

2
build/make/subliminal.mk Normal file
View File

@@ -0,0 +1,2 @@
subliminal:
$(call script,$@)

2
build/make/test.mk Normal file
View File

@@ -0,0 +1,2 @@
test: php
$(call script,$@)

View File

@@ -0,0 +1,4 @@
transmission:
$(call script,$@)
$(call boot,02,$@)
$(call runit,$@)

3
build/make/webserver.mk Normal file
View File

@@ -0,0 +1,3 @@
webserver: phpmyadmin
$(call script,$@)
$(call boot,02,$@)

View File

@@ -1,9 +1,3 @@
#!/bin/sh #!/bin/sh
mkdir -p $BTSYNC_DATA set -e
if [ ! -e $BTSYNC_CONFIG ]; then /opt/btsync --nodaemon --config $BTSYNC_CONFIG
mkdir -p `dirname $BTSYNC_CONFIG`
/opt/btsync --dump-sample-config > $BTSYNC_CONFIG
sed -i 's,\("listening_port"\s*:\)\s*[0-9]\+,\1 5555,' $BTSYNC_CONFIG
sed -i "s,\(\"storage_path\"\s*:\).*,\1 \"$BTSYNC_DATA\"\,," $BTSYNC_CONFIG
fi
/opt/btsync --nodaemon --config $BTSYNC_CONFIG

3
build/runit/couchpotato Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
set -e
/opt/CouchPotatoServer/CouchPotato.py --config_file $COUCHPOTATO_CONFIG --data_dir $COUCHPOTATO_DATA

View File

@@ -1,2 +1,3 @@
#!/bin/sh #!/bin/sh
/usr/sbin/cron -f set -e
/usr/sbin/cron -f

View File

@@ -4,4 +4,4 @@ if [ -z "$GMRENDER_NAME" ]; then
/usr/local/bin/gmediarender /usr/local/bin/gmediarender
else else
/usr/local/bin/gmediarender -f $GMRENDER_NAME /usr/local/bin/gmediarender -f $GMRENDER_NAME
fi fi

View File

@@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
set -e
/opt/logmein-hamachi/bin/hamachid -c $HAMACHI_DATA /opt/logmein-hamachi/bin/hamachid -c $HAMACHI_DATA
strace -qqe '' -p `pgrep hamachid` strace -qqe '' -p `pgrep hamachid`
/host/bin/proxy /host/bin/proxy

3
build/runit/headphones Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
set -e
python /opt/headphones/Headphones.py --config=$HEADPHONES_CONFIG --datadir=$HEADPHONES_DATA

View File

@@ -1,7 +1,4 @@
#!/bin/bash #!/bin/bash
mkdir -p `dirname $LIGHTTPD_LOG` $LIGHTTPD_DOMAINS set -e
chown www-data:www-data `dirname $LIGHTTPD_LOG` mkdir -p `dirname $LIGHTTPD_LOG`
if [[ ! -e $LIGHTTPD_DOMAINS ]]; then /usr/local/sbin/lighttpd -D -f $LIGHTTPD_CONFIG
touch $LIGHTTPD_DOMAINS/empty.conf
fi
/usr/sbin/lighttpd -D -f $LIGHTTPD_CONFIG

3
build/runit/lighttpd-php Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
set -e
/usr/local/bin/php-cgi -b 127.0.0.1:$PHP_CGI_PORT -c $PHP_CONFIG

View File

@@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
set -e
if [ ! -f $MINIDLNA_CONFIG ]; then if [ ! -f $MINIDLNA_CONFIG ]; then
mkdir -p `dirname $$MINIDLNA_CONFIG` mkdir -p `dirname $$MINIDLNA_CONFIG`
cp /opt/minidlna-$MINIDLNA_VERSION/minidlna.conf $MINIDLNA_CONFIG cp /opt/minidlna-$MINIDLNA_VERSION/minidlna.conf $MINIDLNA_CONFIG

View File

@@ -1,18 +1,9 @@
#!/bin/bash #!/bin/bash
set -m set -e
echo "$HOST_ADDR host" >> /tmp/hosts
mkdir -p `dirname $MYSQL_LOG` mkdir -p `dirname $MYSQL_LOG`
if [ ! -d $MYSQL_DATA ]; then if [ ! -d $MYSQL_DATA ]; then
mkdir `dirname $MYSQL_DATA` mkdir `dirname $MYSQL_DATA`
cp /var/lib/mysql/ $MYSQL_DATA -R cp /var/lib/mysql/ $MYSQL_DATA -R
chown mysql:mysql $MYSQL_DATA -R chown mysql:mysql $MYSQL_DATA -R
MYSQL_SETUP=true
fi
/usr/bin/mysqld_safe --skip-syslog &
if [[ -n "$MYSQL_SETUP" ]]; then
until [[ -n $(netstat -an | grep 3306) ]]; do
sleep 1
done
mysqladmin -u root password dummy
fg
fi fi
/usr/bin/mysqld_safe --skip-syslog

View File

@@ -1,3 +1,4 @@
#!/bin/bash #!/bin/bash
set -e
socat TCP-LISTEN:8888,fork TCP:host:8888 & socat TCP-LISTEN:8888,fork TCP:host:8888 &
socat TCP-LISTEN:80,fork,crlf SYSTEM:"echo HTTP/1.0 200; echo Content-Type: text/plain; echo;" & socat TCP-LISTEN:80,fork,crlf SYSTEM:"echo HTTP/1.0 200; echo Content-Type: text/plain; echo;" &

View File

@@ -1,5 +1,6 @@
#!/bin/sh #!/bin/sh
set -e
mkdir -p `dirname $REDIS_LOG` $REDIS_DATA mkdir -p `dirname $REDIS_LOG` $REDIS_DATA
sysctl vm.overcommit_memory=1 sysctl vm.overcommit_memory=1
/usr/bin/redis-server $REDIS_CONFIG /usr/bin/redis-server $REDIS_CONFIG
#/opt/redis-$VERSION/src/redis-server $REDIS_CONFIG #/opt/redis-$VERSION/src/redis-server $REDIS_CONFIG

4
build/runit/sabnzbd Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
set -e
ADDR=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'`
sabnzbdplus -f $SABNZBD_CONFIG -s $ADDR

3
build/runit/sickbeard Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
set -e
/opt/Sick-Beard/SickBeard.py --config=$SICKBEARD_CONFIG --datadir=$SICKBEARD_DATA

View File

@@ -1,2 +1,3 @@
#!/bin/sh #!/bin/sh
/usr/sbin/sshd -D set -e
/usr/sbin/sshd -D

View File

@@ -1,10 +1,6 @@
#!/bin/sh #!/bin/sh
set -e set -e
SYSLOGNG_OPTS=""
[ -r /etc/default/syslog-ng ] && . /etc/default/syslog-ng [ -r /etc/default/syslog-ng ] && . /etc/default/syslog-ng
case "x$CONSOLE_LOG_LEVEL" in case "x$CONSOLE_LOG_LEVEL" in
x[1-8]) x[1-8])
dmesg -n $CONSOLE_LOG_LEVEL dmesg -n $CONSOLE_LOG_LEVEL
@@ -15,10 +11,8 @@ case "x$CONSOLE_LOG_LEVEL" in
echo "CONSOLE_LOG_LEVEL is of unaccepted value." echo "CONSOLE_LOG_LEVEL is of unaccepted value."
;; ;;
esac esac
if [ ! -e /dev/xconsole ] if [ ! -e /dev/xconsole ]
then then
mknod -m 640 /dev/xconsole p mknod -m 640 /dev/xconsole p
fi fi
syslog-ng -F -p /var/run/syslog-ng.pid
syslog-ng -F -p /var/run/syslog-ng.pid $SYSLOGNG_OPTS

4
build/runit/transmission Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
set -e
mkdir -p `dirname $TRANSMISSION_LOG`
transmission-daemon -f -g $TRANSMISSION_CONFIG -e $TRANSMISSION_LOG --log-error

View File

@@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
set -e
if [ ! -f $UPNPPROXY_CONFIG ]; then if [ ! -f $UPNPPROXY_CONFIG ]; then
mkdir -p `dirname $UPNPPROXY_CONFIG` mkdir -p `dirname $UPNPPROXY_CONFIG`
cp /opt/upnpproxy/doc/upnpproxy.conf $UPNPPROXY_CONFIG cp /opt/upnpproxy/doc/upnpproxy.conf $UPNPPROXY_CONFIG

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 source /build/config
set -x set -x
## Redis ## Configuration
export_env BTSYNC_CONFIG /host/etc/btsync.conf
export_env BTSYNC_DATA /host/var/btsync
## BTsync
cd opt cd opt
wget -O btsync.tar.gz http://download-lb.utorrent.com/endpoint/btsync/os/linux-x64/track/stable wget -O btsync.tar.gz http://download-lb.utorrent.com/endpoint/btsync/os/linux-x64/track/stable
tar xzf btsync.tar.gz tar xzf btsync.tar.gz
rm btsync.tar.gz
export BTSYNC_CONFIG=/host/etc/btsync.conf ## Remove installation files
export BTSYNC_DATA=/host/var/btsync if [ $MODE == "minimal" ]; then
rm btsync.tar.gz
## Runit script fi
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

View File

@@ -5,7 +5,7 @@ set -x
## Remove temporary packages for minimal builds ## Remove temporary packages for minimal builds
if [ $MODE == "minimal" ]; then if [ $MODE == "minimal" ]; then
cat /build/temporary | xargs apt-get -y --purge autoremove cat /build/temporary | xargs apt_remove
fi fi
## Clean apt files ## 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 set -x
## Hosts file hack ## Hosts file hack
LD_LIBRARY_PATH=/root/lib export_env LD_LIBRARY_PATH /root/lib
mkdir -p $LD_LIBRARY_PATH mkdir -p $LD_LIBRARY_PATH
cp /lib/x86_64-linux-gnu/libnss_files.so.2 $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 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 source /build/config
set -x set -x
## Enable configuration PHP in Lighttpd ## Environment
ln -s /etc/lighttpd/conf-available/10-fastcgi.conf /etc/lighttpd/conf-enabled/10-fastcgi.conf export_env PHP_CGI_PORT 5555
ln -s /etc/lighttpd/conf-available/15-fastcgi-php.conf /etc/lighttpd/conf-enabled/15-fastcgi-php.conf 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 source /build/config
set -x set -x
## Lighthttpd
apt_get_install_permanent lighttpd
## Environment ## 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_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_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 ## Configuration
sed -i "s,^\(server.errorlog\s*=\s*\).*$,\1\"$LIGHTTPD_LOG\"," $LIGHTTPD_CONFIG 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 sed -i "s,^\(server.username\s*=\s*\).*$,\1\"root\"," $LIGHTTPD_CONFIG
echo "include_shell \"cat $LIGHTTPD_DOMAINS/*.conf\"" >> $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,^\(log_error\s*=\s*\).*$,\1$MYSQL_LOG," $MYSQL_CONFIG
sed -i "s,^\(datadir\s*=\s*\).*$,\1$MYSQL_DATA," $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 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 ## PHP
apt_get_install_temporary gcc make apt_get_install_temporary gcc make
cd /opt 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 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 && \ 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 && \ tar xzf php-$PHP_VERSION.tar.gz && \
@@ -21,6 +19,13 @@ cd php-$PHP_VERSION
make make
make install make install
## Remove installation files
if [ $MODE == "minimal" ]; then
cd ..
rm -r php-$PHP_VERSION
rm php-$PHP_VERSION.tar.gz
fi
## Configuration ## Configuration
cp /opt/php-$PHP_VERSION/php.ini-production $PHP_CONFIG cp /opt/php-$PHP_VERSION/php.ini-production $PHP_CONFIG
sed -i "s,^;\(date\.timezone\s*=\s*\)$,\1 $PHP_TIMEZONE," $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 source /build/config
set -x set -x
## Create directories
mkdir /etc/container_environment
mkdir /opt/init.d
## Temporarily disable dpkg fsync to make building faster. ## Temporarily disable dpkg fsync to make building faster.
echo force-unsafe-io > /etc/dpkg/dpkg.cfg.d/02apt-speedup echo force-unsafe-io > /etc/dpkg/dpkg.cfg.d/02apt-speedup
## Prevent initramfs updates from trying to run grub and lilo. ## Prevent initramfs updates from trying to run grub and lilo.
## https://journal.paul.querna.org/articles/2013/10/15/docker-ubuntu-on-rackspace/ ## https://journal.paul.querna.org/articles/2013/10/15/docker-ubuntu-on-rackspace/
## http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594189 ## http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594189
export INITRD=no export_env INITRD no
mkdir -p /etc/container_environment
echo -n no > /etc/container_environment/INITRD
## Enable Ubuntu Universe and Multiverse. ## Enable Ubuntu Universe and Multiverse.
sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list 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 ## Fix locale
apt_get_install_permanent language-pack-en apt_get_install_permanent language-pack-en
locale-gen en_US locale-gen en_US
## Create directory for boot scripts
mkdir /opt/init.d/

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_CONFIG > /etc/container_environment/REDIS_CONFIG
echo -n $REDIS_LOG > /etc/container_environment/REDIS_LOG echo -n $REDIS_LOG > /etc/container_environment/REDIS_LOG
echo -n $REDIS_DATA > /etc/container_environment/REDIS_DATA 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

View File

@@ -0,0 +1,6 @@
include $(DOCKER_HOME)/build/Makefile
NAME = automysqlbackup
VERSION = latest
build: automysqlbackup

6
images/btsync.mk Normal file
View File

@@ -0,0 +1,6 @@
include $(DOCKER_HOME)/build/Makefile
NAME = btsync
VERSION = latest
build: btsync

6
images/chrome.mk Normal file
View File

@@ -0,0 +1,6 @@
include $(DOCKER_HOME)/build/Makefile
NAME = chrome
VERSION = latest
build: pulseaudio chrome

6
images/couchpotato.mk Normal file
View File

@@ -0,0 +1,6 @@
include $(DOCKER_HOME)/build/Makefile
NAME = couchpotato
VERSION = latest
build: couchpotato

6
images/firefox.mk Normal file
View File

@@ -0,0 +1,6 @@
include $(DOCKER_HOME)/build/Makefile
NAME = firefox
VERSION = latest
build: pulseaudio firefox

6
images/hamachi.mk Normal file
View File

@@ -0,0 +1,6 @@
include $(DOCKER_HOME)/build/Makefile
NAME = hamachi
VERSION = latest
build: hamachi

6
images/headphones.mk Normal file
View File

@@ -0,0 +1,6 @@
include $(DOCKER_HOME)/build/Makefile
NAME = headphones
VERSION = latest
build: headphones

6
images/mpd.mk Normal file
View File

@@ -0,0 +1,6 @@
include $(DOCKER_HOME)/build/Makefile
NAME = mpd
VERSION = latest
build: pulseaudio mpd

View File

@@ -3,4 +3,4 @@ include $(DOCKER_HOME)/build/Makefile
NAME = mysql NAME = mysql
VERSION = latest VERSION = latest
build: base mysql build: mysql

6
images/redis.mk Normal file
View File

@@ -0,0 +1,6 @@
include $(DOCKER_HOME)/build/Makefile
NAME = redis
VERSION = latest
build: redis

6
images/sabnzbd.mk Normal file
View File

@@ -0,0 +1,6 @@
include $(DOCKER_HOME)/build/Makefile
NAME = sabnzbd
VERSION = latest
build: sabnzbd

6
images/sickbeard.mk Normal file
View File

@@ -0,0 +1,6 @@
include $(DOCKER_HOME)/build/Makefile
NAME = sickbeard
VERSION = latest
build: sickbeard

6
images/test.mk Normal file
View File

@@ -0,0 +1,6 @@
include $(DOCKER_HOME)/build/Makefile
NAME = test
VERSION = latest
build: php test

6
images/transmission.mk Normal file
View File

@@ -0,0 +1,6 @@
include $(DOCKER_HOME)/build/Makefile
NAME = transmission
VERSION = latest
build: transmission

View File

@@ -3,4 +3,4 @@ include $(DOCKER_HOME)/build/Makefile
NAME = webserver NAME = webserver
VERSION = latest VERSION = latest
build: base lighttpd-php build: phpmyadmin webserver