diff --git a/base/debian/Dockerfile b/base/debian/Dockerfile new file mode 100644 index 0000000..c2b4dd9 --- /dev/null +++ b/base/debian/Dockerfile @@ -0,0 +1,9 @@ +FROM debian:wheezy + +ENV DEBIAN_FRONTEND noninteractive +ENV LANG en_US.UTF-8 + +RUN apt-get update -q -o Acquire::Pdiffs=false +RUN apt-get install -qy locales +RUN echo en_US.UTF-8 UTF-8 > /etc/locale.gen +RUN dpkg-reconfigure locales diff --git a/base/ubuntu/Dockerfile b/base/ubuntu/Dockerfile new file mode 100644 index 0000000..04b307c --- /dev/null +++ b/base/ubuntu/Dockerfile @@ -0,0 +1,9 @@ +FROM ubuntu:precise + +ENV DEBIAN_FRONTEND noninteractive +ENV LANG en_US.UTF-8 + +RUN apt-get update -q +RUN apt-get install -qy locales +RUN echo en_US.UTF-8 UTF-8 > /etc/locale.gen +RUN dpkg-reconfigure locales diff --git a/clients/mysql-client/Dockerfile b/clients/mysql-client/Dockerfile new file mode 100644 index 0000000..371b475 --- /dev/null +++ b/clients/mysql-client/Dockerfile @@ -0,0 +1,7 @@ +FROM aostanin/debian + +RUN apt-get install -qy mysql-client python3 + +ADD start.py /start.py + +ENTRYPOINT ["/start.py"] diff --git a/clients/mysql-client/start.py b/clients/mysql-client/start.py new file mode 100755 index 0000000..533f25b --- /dev/null +++ b/clients/mysql-client/start.py @@ -0,0 +1,112 @@ +#! /usr/bin/env python3 + +import argparse +import os +import random +import string +import subprocess + + +def parse_args(): + parser = argparse.ArgumentParser() + + subparsers = parser.add_subparsers(help="commands") + + parser_add = subparsers.add_parser("add") + parser_add.set_defaults(func=add) + parser_add.add_argument("name", help="name of the database") + parser_add.add_argument("-u", "--username", + help="username (defaults to database name)") + parser_add.add_argument("-p", "--password", + help="password (defaults to a random password)") + + parser_bash = subparsers.add_parser("bash") + parser_bash.set_defaults(func=bash) + + parser_mysql = subparsers.add_parser("mysql") + parser_mysql.set_defaults(func=mysql) + parser_mysql.add_argument("-u", "--username", + help="username (defaults to root)") + parser_mysql.add_argument("-p", "--password", + help="password (defaults root's password from the container)") + + return parser.parse_args() + + +def get_server_details(username=None, password=None): + server = dict() + server["username"] = username or "root" + server["password"] = password + + try: + if server["password"] is None: + with open("/data/.root_password", "r") as f: + server["password"] = f.read().strip() + server["host"] = os.environ["DB_PORT_3306_TCP_ADDR"] + server["port"] = os.environ["DB_PORT_3306_TCP_PORT"] + except IOError: + raise Exception("Root password not found. Did you add the MySQL " + "container's volumes with \"-volumes-from mariadb\"") + except KeyError: + raise Exception("Database server address or port not found. " + "Did you link the MySQL with \"-link mariadb:db\"?") + + return server + + +def add(args): + server = get_server_details() + database = args.name + username = args.username + if username is None: + username = database + password = args.password + if password is None: + password = "".join([random.choice(string.ascii_letters + string.digits) + for n in range(32)]) + + mysql_commands = ( + "CREATE DATABASE `{database}` " + "DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;" + "CREATE USER '{username}'@'%' IDENTIFIED BY '{password}';" + "GRANT ALL PRIVILEGES ON `{database}`.* to '{username}'@'%' " + "WITH GRANT OPTION;" + ).format(database=database, username=username, password=password) + + retval = subprocess.call(["mysql", + "--user={0}".format(server["username"]), + "--password={0}".format(server["password"]), + "--host={0}".format(server["host"]), + "--port={0}".format(server["port"]), + "--execute={0}".format(mysql_commands) + ]) + + if retval is not 0: + raise Exception("Failed to add database or user. " + "Do they already exist?") + + print("Added new database and user") + print("Database: {database}\nUsername: {username}\nPassword: {password}" + .format(database=database, username=username, password=password)) + + +def bash(args): + subprocess.call("bash") + + +def mysql(args): + server = get_server_details(username=args.username, password=args.password) + subprocess.call(["mysql", + "--user={0}".format(server["username"]), + "--password={0}".format(server["password"]), + "--host={0}".format(server["host"]), + "--port={0}".format(server["port"]) + ]) + + +def main(): + args = parse_args() + args.func(args) + +if __name__ == "__main__": + main() diff --git a/services/bitlbee/Dockerfile b/services/bitlbee/Dockerfile new file mode 100644 index 0000000..98d4e30 --- /dev/null +++ b/services/bitlbee/Dockerfile @@ -0,0 +1,15 @@ +FROM aostanin/debian + +RUN echo 'deb http://code.bitlbee.org/debian/devel/wheezy/amd64/ ./' > /etc/apt/sources.list.d/bitlbee.list +ADD bitlbee.key /bitlbee.key +RUN apt-key add /bitlbee.key +RUN apt-get update -q + +RUN apt-get install -qy bitlbee bitlbee-plugin-skype + +ADD start.sh /start.sh + +VOLUME ["/data"] +EXPOSE 6667 + +CMD ["/start.sh"] diff --git a/services/bitlbee/bitlbee.key b/services/bitlbee/bitlbee.key new file mode 100644 index 0000000..7027079 --- /dev/null +++ b/services/bitlbee/bitlbee.key @@ -0,0 +1,19 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.10 (GNU/Linux) + +mQGiBEv++B4RBACR8PCXpBRByIPMY2DxbqUP8LfVNRfgg7X2P4Z0e+zeYHujB0hJ +P6vOW/QmeYSuDzFVH3oOJsC+kaTExf2Rl0/Bm3X4GRkw6XJME/3HR7P0rNCCvqgD +QYOlhmP4qYEi0z6q9WslhqeYzilB/opsQTR/11zUjw5TGp1P/4rcCa0/6wCg87c/ +BOP6XR64zQBD5rBcCzNeL0cD/iFE97JFAYIRHOiYjpgq0/pZ/PoMrULpiyq6+BPo +8YdcuRYdFYDC5Ghmmk0VDIf5knDdsSIA5+tJTHTiKpuHZ7JKx3aJ/HzuAHlG3RaV +eLTl0HvkxWis/ORsjyvztlVtbHy0vVVRaWriVq76MicpdIqY1tcRvmm38j7X+Ois +mcO1A/wNYgJyr0pHvj52T2iosKUHu2TFqVf9sWV0n+kFI1g/aG4oHWbevcrsnbtW ++3t80BNbWAA5zlN6Bdv1MRrFJzogyJK5ao1/Y2uF4wvD64EEKgA91riHKnOSuKo2 +wCccja/CqLovaAN6dvNQ5OapuH+xuc+4IsPxPNCOUQ4TL0V6vbQ9Qml0bEJlZSBu +aWdodGx5IGJ1aWxkcyAuZGVicyBzaWduaW5nIGtleSA8YnVpbGRkQGJpdGxiZWUu +b3JnPohgBBMRAgAgAhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AFAk/B55cACgkQ +lO6h8sflBDZMOgCfc+ayGdn90HWe8hDm+xiUcjnQgeEAn1Y0iF3Tu9a+kcPq1L83 +4Izk4INeiEYEEBECAAYFAkv++0YACgkQeYWXmuMwQFExdQCdHbhFwQJ44HUdjxPZ +lPOt3iH9MZ8AoKm88QvS4dCuYmMt9KZ6oDKyCD5l +=LQ+N +-----END PGP PUBLIC KEY BLOCK----- diff --git a/services/bitlbee/start.sh b/services/bitlbee/start.sh new file mode 100755 index 0000000..e48d2b5 --- /dev/null +++ b/services/bitlbee/start.sh @@ -0,0 +1,13 @@ +#! /bin/sh + +set -e + +mkdir -p /data/users + +if [ ! -f /data/bitlbee/bitlbee.conf ]; then + cp -r /etc/bitlbee /data/bitlbee +fi + +chown -R bitlbee:bitlbee /data + +bitlbee -n -v -D -c /data/bitlbee/bitlbee.conf -d /data/users diff --git a/services/btsync/Dockerfile b/services/btsync/Dockerfile new file mode 100644 index 0000000..70faf5c --- /dev/null +++ b/services/btsync/Dockerfile @@ -0,0 +1,15 @@ +FROM aostanin/debian + +ADD http://download-lb.utorrent.com/endpoint/btsync/os/linux-glibc23-x64/track/stable /btsync.tar.gz +RUN tar xvzf /btsync.tar.gz && rm /btsync.tar.gz + +ADD start.sh /start.sh +ADD btsync.conf /btsync.conf + +VOLUME ["/data"] +VOLUME ["/sync"] +EXPOSE 3369 +EXPOSE 3369/udp +EXPOSE 8888 + +CMD ["/start.sh"] diff --git a/services/btsync/btsync.conf b/services/btsync/btsync.conf new file mode 100644 index 0000000..822695d --- /dev/null +++ b/services/btsync/btsync.conf @@ -0,0 +1,9 @@ +{ + "storage_path" : "/data", + "listening_port" : 3369, + "use_upnp" : false, + "webui" : + { + "listen" : "0.0.0.0:8888" + } +} diff --git a/services/btsync/start.sh b/services/btsync/start.sh new file mode 100755 index 0000000..4e95a17 --- /dev/null +++ b/services/btsync/start.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +set -e + +mkdir -p /data + +if [ ! -f /data/btsync.conf ]; then + cp /btsync.conf /data/btsync.conf +fi + +/btsync --nodaemon --config /data/btsync.conf diff --git a/services/couchpotato/Dockerfile b/services/couchpotato/Dockerfile new file mode 100644 index 0000000..01f50af --- /dev/null +++ b/services/couchpotato/Dockerfile @@ -0,0 +1,17 @@ +FROM aostanin/debian + +RUN apt-get install -qy git-core python2.7 +RUN git clone https://github.com/RuudBurger/CouchPotatoServer.git /couchpotato + +ADD start.sh /start.sh + +VOLUME ["/data"] +# Torrent watch directory +VOLUME ["/torrents"] +# Incoming downloads +VOLUME ["/downloads"] +# Movie library +VOLUME ["/movies"] +EXPOSE 5050 + +CMD ["/start.sh"] diff --git a/services/couchpotato/start.sh b/services/couchpotato/start.sh new file mode 100755 index 0000000..d121033 --- /dev/null +++ b/services/couchpotato/start.sh @@ -0,0 +1,7 @@ +#! /bin/sh + +set -e + +(cd /couchpotato && git pull) +python2.7 /couchpotato/CouchPotato.py --daemon --console_log --data_dir=/data --config_file=/data/couchpotato.ini +tail -f /data/logs/*.log diff --git a/services/deluge/Dockerfile b/services/deluge/Dockerfile new file mode 100644 index 0000000..e01649b --- /dev/null +++ b/services/deluge/Dockerfile @@ -0,0 +1,21 @@ +FROM aostanin/debian + +RUN echo 'deb http://ppa.launchpad.net/deluge-team/ppa/ubuntu precise main' > /etc/apt/sources.list.d/deluge.list +RUN apt-key adv --recv-keys --keyserver pgp.surfnet.nl 249AD24C +RUN apt-get update -q + +RUN apt-get install -t precise -qy deluged deluge-web + +ADD start.sh /start.sh + +VOLUME ["/data"] +VOLUME ["/downloads"] +# Torrent port +EXPOSE 53160 +EXPOSE 53160/udp +# WebUI +EXPOSE 8112 +# Daemon +EXPOSE 58846 + +CMD ["/start.sh"] diff --git a/services/deluge/start.sh b/services/deluge/start.sh new file mode 100755 index 0000000..5a6270d --- /dev/null +++ b/services/deluge/start.sh @@ -0,0 +1,8 @@ +#! /bin/sh + +set -e + +rm -f /data/deluged.pid + +deluged -c /data -L info -l /data/deluged.log +deluge-web -c /data diff --git a/services/ghost/Dockerfile b/services/ghost/Dockerfile new file mode 100644 index 0000000..26ba373 --- /dev/null +++ b/services/ghost/Dockerfile @@ -0,0 +1,19 @@ +FROM aostanin/ubuntu + +RUN echo 'deb http://ppa.launchpad.net/chris-lea/node.js/ubuntu precise main' > /etc/apt/sources.list.d/nodejs.list +RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C7917B12 +RUN apt-get update -q + +RUN apt-get install -qy nodejs unzip + +ADD https://ghost.org/zip/ghost-0.4.1.zip /tmp/ghost.zip +RUN unzip -q /tmp/ghost.zip -d /ghost && rm /tmp/ghost.zip +RUN sed -i "s/host:\s*'127.0.0.1'/host: '0.0.0.0'/" /ghost/config.example.js +RUN cd /ghost && npm install --production + +ADD start.sh /start.sh + +VOLUME ["/data"] +EXPOSE 2368 + +CMD ["/start.sh"] diff --git a/services/ghost/start.sh b/services/ghost/start.sh new file mode 100755 index 0000000..4b2e5fe --- /dev/null +++ b/services/ghost/start.sh @@ -0,0 +1,22 @@ +#! /bin/sh + +set -e + +mkdir -p /data + +if [ ! -f /data/config.js ]; then + cp /ghost/config.example.js /data/config.js +fi + +if [ ! -d /content.default ]; then + mv /ghost/content /content.default +fi + +if [ ! -d /data/content ]; then + cp -r /content.default /data/content +fi + +ln -sf /data/content /ghost/content +ln -sf /data/config.js /ghost/config.js + +cd /ghost && npm start --production diff --git a/services/gitlab/Dockerfile b/services/gitlab/Dockerfile new file mode 100644 index 0000000..ab92b36 --- /dev/null +++ b/services/gitlab/Dockerfile @@ -0,0 +1,48 @@ +FROM aostanin/debian + +RUN apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate +RUN apt-get install -y python2.7 python-docutils git-core sudo libmysqlclient-dev nginx mysql-client + +ADD http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.bz2 /tmp/ruby.tar.bz2 +RUN cd /tmp && \ + tar xjvf ruby.tar.bz2 && \ + cd ruby-2.0.0-p353 && \ + ./configure --disable-install-rdoc && \ + make && \ + make install && \ + cd && \ + rm -rf /tmp/ruby-2.0.0-p353 +RUN gem install bundler --no-ri --no-rdoc + +RUN adduser --disabled-login --gecos 'GitLab' git + +RUN cd /home/git && \ + sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.8.0 + +RUN cd /home/git && \ + sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-6-stable gitlab && \ + cd gitlab && \ + chown -R git log tmp && \ + sudo -u git -H mkdir /home/git/gitlab-satellites tmp/pids tmp/sockets public/uploads && \ + chmod -R u+rwX log tmp public/uploads && \ + sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb && \ + sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb && \ + sudo -u git -H git config --global user.name "GitLab" && \ + sudo -u git -H git config --global user.email "gitlab@localhost" && \ + sudo -u git -H git config --global core.autocrlf input && \ + cp lib/support/init.d/gitlab /etc/init.d/gitlab && \ + cp lib/support/init.d/gitlab.default.example /etc/default/gitlab && \ + cp lib/support/nginx/gitlab /etc/nginx/sites-available/default + +RUN cd /home/git/gitlab && \ + sudo -u git -H bundle install --deployment --without development test postgres aws + +ADD start.sh /start.sh + +VOLUME ["/data"] +VOLUME ["/repositories"] +EXPOSE 80 +EXPOSE 22 + +WORKDIR /home/git/gitlab +CMD ["/start.sh"] diff --git a/services/gitlab/start.sh b/services/gitlab/start.sh new file mode 100755 index 0000000..3aee04d --- /dev/null +++ b/services/gitlab/start.sh @@ -0,0 +1,114 @@ +#! /bin/sh + +set -e + +GITLAB_HOST=${GITLAB_HOST:-localhost} +GITLAB_EMAIL=${GITLAB_EMAIL:-gitlab@${GITLAB_HOST}} +SUPPORT_EMAIL=${SUPPORT_EMAIL:-support@${GITLAB_HOST}} +UNICORN_WORKERS=${UNICORN_WORKERS:-1} +DB_HOST=$DB_PORT_3306_TCP_ADDR +DB_PORT=$DB_PORT_3306_TCP_PORT +DB_DATABASE=${DB_DATABASE:-gitlab} +DB_USERNAME=${DB_USERNAME:-gitlab} +DB_PASSWORD=${DB_PASSWORD:-} + +mkdir -p /data/git /data/gitlab/initializers /data/gitlab-shell + +# SSH config +if [ ! -d /etc/ssh.default ]; then + mv /etc/ssh /etc/ssh.default +fi +if [ ! -d /data/ssh ]; then + cp -r /etc/ssh.default /data/ssh +fi +ln -snf /data/ssh /etc/ssh + +# Git user's authorized_keys +touch /data/git/authorized_keys +sudo -u git -H mkdir -p /home/git/.ssh +ln -sf /data/git/authorized_keys /home/git/.ssh/authorized_keys + +# Gitlab-Shell config +if [ ! -f /data/gitlab-shell/config.yml ]; then + cp /home/git/gitlab-shell/config.yml.example /data/gitlab-shell/config.yml +fi +ln -sf /data/gitlab-shell/config.yml /home/git/gitlab-shell/config.yml +sed -i "s/^\(gitlab_url:\s*\"\)[^\"]*/\1http:\/\/127.0.0.1\//" /data/gitlab-shell/config.yml +sed -i "s/^\(repos_path:\s*\"\)[^\"]*/\1\/repositories/" /data/gitlab-shell/config.yml + +# Gitlab config +if [ ! -f /data/gitlab/gitlab.yml ]; then + cp /home/git/gitlab/config/gitlab.yml.example /data/gitlab/gitlab.yml +fi +ln -sf /data/gitlab/gitlab.yml /home/git/gitlab/config/gitlab.yml +sed -i "s/^\(\s*host:\s*\).*$/\1${GITLAB_HOST}/" /data/gitlab/gitlab.yml +sed -i "s/^\(\s*email_from:\s*\).*$/\1${GITLAB_EMAIL}/" /data/gitlab/gitlab.yml +sed -i "s/^\(\s*support_email:\s*\).*$/\1${SUPPORT_EMAIL}/" /data/gitlab/gitlab.yml +sed -i "s/^\(\s*repos_path:\s*\).*$/\1\/repositories\//" /data/gitlab/gitlab.yml + +# SMTP Settings Initializer +if [ ! -f /data/gitlab/initializers/smtp_settings.rb ]; then + cp /home/git/gitlab/config/initializers/smtp_settings.rb.sample /data/gitlab/initializers/smtp_settings.rb +fi +ln -sf /data/gitlab/initializers/smtp_settings.rb /home/git/gitlab/config/initializers/smtp_settings.rb + +# Unicorn config +if [ ! -f /data/gitlab/unicorn.rb ]; then + cp /home/git/gitlab/config/unicorn.rb.example /data/gitlab/unicorn.rb +fi +ln -sf /data/gitlab/unicorn.rb /home/git/gitlab/config/unicorn.rb +sed -i "s/^\(worker_processes\s*\)[0-9]*/\1${UNICORN_WORKERS}/" /data/gitlab/unicorn.rb + +# Generate database config +cat > /data/gitlab/database.yml < /etc/apt/sources.list.d/mariadb.list +RUN apt-get update -q + +RUN apt-get install -qy mariadb-server + +ADD start.sh /start.sh + +VOLUME ["/data"] +EXPOSE 3306 + +CMD ["/start.sh"] diff --git a/services/mariadb/start.sh b/services/mariadb/start.sh new file mode 100755 index 0000000..78fdd82 --- /dev/null +++ b/services/mariadb/start.sh @@ -0,0 +1,42 @@ +#! /bin/sh + +set -e + +if [ ! -f /etc/mysql/my.cnf.default ]; then + mv /etc/mysql/my.cnf /etc/mysql/my.cnf.default + sed -i '/^bind-address*/ s/^/#/' /etc/mysql/my.cnf.default +fi + +if [ ! -f /data/my.cnf ]; then + cp /etc/mysql/my.cnf.default /data/my.cnf +fi + +if [ ! -d /var/lib/mysql.default ]; then + mv /var/lib/mysql /var/lib/mysql.default +fi + +if [ ! -d /data/db ]; then + cp -rp /var/lib/mysql.default /data/db + sed -i 's/^datadir\s.*/datadir = \/data\/db/g' /data/my.cnf +fi + +ln -sf /data/my.cnf /etc/mysql/my.cnf +chown mysql:mysql /data + +bash + +service mysql start + +if [ ! -f /data/.root_password ]; then + MARIADB_PASSWORD=$( /dev/null 2>&1 || head -c 32)) + + mysqladmin -u root password $MARIADB_PASSWORD + mysql -u root -p$MARIADB_PASSWORD -e "UPDATE mysql.user SET host='%' WHERE user='root' AND host='localhost'; FLUSH PRIVILEGES;" + + echo $MARIADB_PASSWORD > /data/.root_password + chmod 600 /data/.root_password + + echo Set root password to $MARIADB_PASSWORD +fi + +tail -f /var/log/mysql.err diff --git a/services/nginx/Dockerfile b/services/nginx/Dockerfile new file mode 100644 index 0000000..1863ff0 --- /dev/null +++ b/services/nginx/Dockerfile @@ -0,0 +1,10 @@ +FROM aostanin/debian + +RUN apt-get install -qy nginx + +ADD start.sh /start.sh + +VOLUME ["/data"] +EXPOSE 80 + +CMD ["/start.sh"] diff --git a/services/nginx/start.sh b/services/nginx/start.sh new file mode 100755 index 0000000..9ed3249 --- /dev/null +++ b/services/nginx/start.sh @@ -0,0 +1,18 @@ +#! /bin/sh + +set -e + +mkdir -p /data + +if [ ! -L /etc/nginx ]; then + mv /etc/nginx /etc/nginx.default + ln -s /data/nginx /etc/nginx +fi + +if [ ! -f /data/nginx/nginx.conf ]; then + mv /etc/nginx.default /data/nginx +fi + +service nginx start + +tail -f /var/log/nginx/*.log diff --git a/services/nzbdrone/Dockerfile b/services/nzbdrone/Dockerfile new file mode 100644 index 0000000..8b1238d --- /dev/null +++ b/services/nzbdrone/Dockerfile @@ -0,0 +1,18 @@ +FROM aostanin/debian + +RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FDA5DFFC +RUN echo 'deb http://update.nzbdrone.com/repos/apt/debian master main' >> /etc/apt/sources.list.d/nzbdrone.list +RUN apt-get update -q + +RUN apt-get install -qy nzbdrone + +ADD start.sh /start.sh + +VOLUME ["/data"] +# Incoming downloads +VOLUME ["/downloads"] +# TV library +VOLUME ["/tv"] +EXPOSE 8989 + +CMD ["/start.sh"] diff --git a/services/nzbdrone/start.sh b/services/nzbdrone/start.sh new file mode 100755 index 0000000..f456490 --- /dev/null +++ b/services/nzbdrone/start.sh @@ -0,0 +1,8 @@ +#! /bin/sh + +set -e + +mkdir -p /data +mkdir -p /root/.config +[ ! -L /root/.config/NzbDrone ] && ln -s /data /root/.config/NzbDrone +mono /opt/NzbDrone/NzbDrone.exe diff --git a/services/nzbget/Dockerfile b/services/nzbget/Dockerfile new file mode 100644 index 0000000..4f08c43 --- /dev/null +++ b/services/nzbget/Dockerfile @@ -0,0 +1,35 @@ +FROM aostanin/debian + +RUN sed -i 's/main$/main non-free/' /etc/apt/sources.list +RUN apt-get update -q + +RUN apt-get install -qy build-essential pkg-config libxml2-dev libncurses5-dev libsigc++-2.0-dev libpar2-0-dev libssl-dev +RUN apt-get install -qy p7zip unrar + +ADD http://downloads.sourceforge.net/project/parchive/libpar2/0.2/libpar2-0.2.tar.gz /tmp/libpar2.tar.gz +RUN tar xzf /tmp/libpar2.tar.gz && \ + rm /tmp/libpar2.tar.gz + +ADD http://downloads.sourceforge.net/project/nzbget/nzbget-stable/11.0/nzbget-11.0.tar.gz /tmp/nzbget.tar.gz +RUN tar xzf /tmp/nzbget.tar.gz && \ + rm /tmp/nzbget.tar.gz + +RUN cd /libpar2-0.2 && \ + patch < /nzbget-11.0/libpar2-0.2-bugfixes.patch && \ + patch < /nzbget-11.0/libpar2-0.2-cancel.patch && \ + ./configure && \ + make && \ + make install + +RUN cd /nzbget-11.0 && \ + ./configure && \ + make && \ + make install + +ADD start.sh /start.sh + +VOLUME ["/data"] +VOLUME ["/downloads"] +EXPOSE 6789 + +CMD ["/start.sh"] diff --git a/services/nzbget/start.sh b/services/nzbget/start.sh new file mode 100755 index 0000000..f5b6f71 --- /dev/null +++ b/services/nzbget/start.sh @@ -0,0 +1,9 @@ +#! /bin/sh + +set -e + +if [ ! -f /data/nzbget.conf ]; then + cp /usr/local/share/nzbget/nzbget.conf /data/nzbget.conf +fi + +nzbget --configfile /data/nzbget.conf --daemon diff --git a/services/nzbget/znc.conf b/services/nzbget/znc.conf new file mode 100644 index 0000000..0811b77 --- /dev/null +++ b/services/nzbget/znc.conf @@ -0,0 +1,22 @@ +Version = 1.2 + + Port = 6667 + IPv4 = true + IPv6 = false + SSL = false + +LoadModule = partyline +LoadModule = webadmin + + + Pass = sha256#a9a7a6af913c13d02d310e703e7d72a06942a98a9ae7d87fc40885633b65631a#lPmU,(xMi*GyM-NavEa5# + Admin = true + Nick = znc + AltNick = znc_ + Ident = znc + RealName = Got ZNC? + Buffer = 50 + AutoClearChanBuffer = true + ChanModes = +stn + + diff --git a/services/nzbmegasearch/Dockerfile b/services/nzbmegasearch/Dockerfile new file mode 100644 index 0000000..6811ceb --- /dev/null +++ b/services/nzbmegasearch/Dockerfile @@ -0,0 +1,12 @@ +FROM aostanin/debian + +RUN apt-get install -qy git-core python2.7 +RUN apt-get install -qy python-openssl +RUN git clone https://github.com/pillone/usntssearch.git /nzbmegasearch + +ADD start.sh /start.sh + +VOLUME ["/data"] +EXPOSE 5000 + +CMD ["/start.sh"] diff --git a/services/nzbmegasearch/start.sh b/services/nzbmegasearch/start.sh new file mode 100755 index 0000000..a957a89 --- /dev/null +++ b/services/nzbmegasearch/start.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +set -e + +touch /data/custom_params.ini +ln -sf /data/custom_params.ini /nzbmegasearch/NZBmegasearch/custom_params.ini +touch /nzbmegasearch/NZBmegasearch/logs/nzbmegasearch.log + +(cd /nzbmegasearch && git pull) +python2.7 /nzbmegasearch/NZBmegasearch/mega2.py daemon +tail -f /nzbmegasearch/NZBmegasearch/logs/*.log diff --git a/services/plexmediaserver/Dockerfile b/services/plexmediaserver/Dockerfile new file mode 100644 index 0000000..370192b --- /dev/null +++ b/services/plexmediaserver/Dockerfile @@ -0,0 +1,17 @@ +FROM aostanin/debian + +RUN apt-get install -qy gdebi-core + +ADD http://downloads.plexapp.com/plex-media-server/0.9.9.5.411-da1d892/plexmediaserver_0.9.9.5.411-da1d892_amd64.deb /tmp/plexmediaserver.deb +RUN gdebi -qn /tmp/plexmediaserver.deb && rm /tmp/plexmediaserver.deb + +ADD start.sh /start.sh + +VOLUME ["/data"] +# Music library +VOLUME ["/music"] +# Video library +VOLUME ["/videos"] +EXPOSE 32400 + +CMD ["/start.sh"] diff --git a/services/plexmediaserver/README.md b/services/plexmediaserver/README.md new file mode 100644 index 0000000..7824754 --- /dev/null +++ b/services/plexmediaserver/README.md @@ -0,0 +1,62 @@ +# docker-plexmediaserver + +## Description + +This is a Dockerfile to set up [Plex Media Server](http://www.plexapp.com/). + +## Usage + +### Building + +Build the image with `docker build -t plexmediaserver .` in this directory. + + +### Running + +Plex depends on Avahi and it's own GDM network discovery protocol to work so while there may be ways around this, the easiest way is probably to run the container on the same subnet as your LAN. + +Since Docker is currently quite inflexible in its network setup, I personally resort to some ugly hacks to get around this. You might have better luck using something like [Pipework](http://github.com/jpetazzo/pipework) to set up networking. + +#### Set Up a Bridge on the Host + +I used Ubuntu's [KVM networking guide](http://help.ubuntu.com/community/KVM/Networking) to create a `br0` interface which is bridged to `eth0` and uses DHCP. If you want a similar setup, add the following to `/etc/network/interfaces`: + +``` +auto br0 +iface br0 inet dhcp + bridge_ports eth0 + bridge_stp off + bridge_fd 0 + bridge_maxwait 0 +``` + +Now just restart networking (`service networking restart`) or reboot. + +#### Running the Container Using the Bridge + +Docker allows you to overwrite the container's LXC configuration using `-lxc-conf`. While this is an ugly hack, I took advantage of it to set up networking manually in the container. I completely disabled Docker's network management on the container with `-n=false`. The container stores all the Plex configuration in the `/data` directory, so it may be a good idea to create a bind mount with the host with `-v` for persistent storage. + +#### Example + +The following starts the plexmediaserver container with: + +- The host's `/srv/media/videos` mounted inside the container's `/videos` +- The host's `/srv/media/music` mounted inside the container's `/music` +- The host's `/tank/virt/data/plexmediaserver` mounted inside the container's `/data` for persistent configuration storage. +- No network management from docker (`-n=false`) +- Bridged networking using the `br0` bridge with an IP address of `192.168.1.10` and gateway of `192.168.1.1` + +``` +docker run -d -n=false \ + -v /srv/media/videos:/videos \ + -v /srv/media/music:/music \ + -v /tank/virt/data/plexmediaserver:/data \ + -lxc-conf="lxc.network.type = veth" \ + -lxc-conf="lxc.network.flags = up" \ + -lxc-conf="lxc.network.link = br0" \ + -lxc-conf="lxc.network.ipv4 = 192.168.1.10" \ + -lxc-conf="lxc.network.ipv4.gateway=192.168.1.1" \ + plexmediaserver +``` + +Now just navigate to [http://192.168.1.10:32400/web/](http://192.168.1.10:32400/web/) to set up Plex. diff --git a/services/plexmediaserver/start.sh b/services/plexmediaserver/start.sh new file mode 100755 index 0000000..8cad932 --- /dev/null +++ b/services/plexmediaserver/start.sh @@ -0,0 +1,10 @@ +#! /bin/sh + +set -e + +rm -f "/data/Library/Application Support/Plex Media Server/plexmediaserver.pid" + +service dbus start +service avahi-daemon start + +HOME=/data start_pms diff --git a/services/ps3netsrv/Dockerfile b/services/ps3netsrv/Dockerfile new file mode 100644 index 0000000..04efa1e --- /dev/null +++ b/services/ps3netsrv/Dockerfile @@ -0,0 +1,14 @@ +FROM aostanin/ubuntu + +RUN apt-get install -qy unzip + +ADD http://www.deanbg.com/ps3netsrv.zip /tmp/ps3netsrv.zip +RUN unzip -q /tmp/ps3netsrv.zip -d /ps3netsrv && \ + rm /tmp/ps3netsrv.zip +RUN chmod +x /ps3netsrv/linux/* + +# ps3netsrv doesn't have any config files, so no need for /data +VOLUME ["/ps3"] +EXPOSE 38008 + +CMD ["/ps3netsrv/linux/ps3netsrv64", "/ps3"] diff --git a/services/pyload/Dockerfile b/services/pyload/Dockerfile new file mode 100644 index 0000000..e723475 --- /dev/null +++ b/services/pyload/Dockerfile @@ -0,0 +1,16 @@ +FROM aostanin/debian + +RUN apt-get install -qy gdebi-core + +ADD http://get.pyload.org/get/ubuntu /tmp/pyload.deb +RUN gdebi -qn /tmp/pyload.deb && rm /tmp/pyload.deb + +RUN apt-get install -qy python-openssl spidermonkey-bin + +ADD start.sh /start.sh + +VOLUME ["/data"] +VOLUME ["/downloads"] +EXPOSE 8001 + +CMD ["/start.sh"] diff --git a/services/pyload/start.sh b/services/pyload/start.sh new file mode 100755 index 0000000..9c39e94 --- /dev/null +++ b/services/pyload/start.sh @@ -0,0 +1,14 @@ +#! /bin/sh + +set -e + +rm -f /data/pyload.pid + +(echo /data; echo) | pyLoadCore --changedir + +if [ ! -f /data/pyload.conf ]; then + cp /.pyload/pyload.conf /data/pyload.conf +fi + +pyLoadCore --daemon +tail -f /data/Logs/log.txt diff --git a/services/sabnzbdplus/Dockerfile b/services/sabnzbdplus/Dockerfile new file mode 100644 index 0000000..4135f79 --- /dev/null +++ b/services/sabnzbdplus/Dockerfile @@ -0,0 +1,18 @@ +FROM aostanin/debian + +RUN apt-get install -qy git-core python2.7 +RUN apt-get install -qy python-cheetah +RUN git clone https://github.com/sabnzbd/sabnzbd.git /sabnzbdplus + +RUN sed -i 's/main$/main non-free/' /etc/apt/sources.list +RUN apt-get update -q + +RUN apt-get install -qy python-configobj python-feedparser python-dbus python-openssl python-support python-yenc par2 unrar unzip + +ADD start.sh /start.sh + +VOLUME ["/data"] +VOLUME ["/downloads"] +EXPOSE 8080 + +CMD ["/start.sh"] diff --git a/services/sabnzbdplus/start.sh b/services/sabnzbdplus/start.sh new file mode 100755 index 0000000..ec31b4c --- /dev/null +++ b/services/sabnzbdplus/start.sh @@ -0,0 +1,7 @@ +#! /bin/sh + +set -e + +(cd /sabnzbdplus && git pull) +python2.7 /sabnzbdplus/SABnzbd.py --daemon --config-file /data/sabnzbdplus.ini --server 0.0.0.0:8080 +tail -f /data/logs/*.log diff --git a/services/sickbeard/Dockerfile b/services/sickbeard/Dockerfile new file mode 100644 index 0000000..ad9b0cc --- /dev/null +++ b/services/sickbeard/Dockerfile @@ -0,0 +1,18 @@ +FROM aostanin/debian + +RUN apt-get install -qy git-core python2.7 +RUN apt-get install -qy python-cheetah +RUN git clone https://github.com/midgetspy/Sick-Beard.git /sickbeard + +ADD start.sh /start.sh + +VOLUME ["/data"] +# Torrent watch directory +VOLUME ["/torrents"] +# Incoming downloads +VOLUME ["/downloads"] +# TV library +VOLUME ["/tv"] +EXPOSE 8081 + +CMD ["/start.sh"] diff --git a/services/sickbeard/start.sh b/services/sickbeard/start.sh new file mode 100755 index 0000000..f280352 --- /dev/null +++ b/services/sickbeard/start.sh @@ -0,0 +1,7 @@ +#! /bin/sh + +set -e + +(cd /sickbeard && git pull) +python2.7 /sickbeard/SickBeard.py --nolaunch --daemon --datadir=/data --config=/data/sickbeard.ini +tail -f /data/Logs/*.log diff --git a/services/subsonic/Dockerfile b/services/subsonic/Dockerfile new file mode 100644 index 0000000..b802d95 --- /dev/null +++ b/services/subsonic/Dockerfile @@ -0,0 +1,13 @@ +FROM aostanin/debian + +RUN apt-get install -qy openjdk-6-jre +ADD http://downloads.sourceforge.net/project/subsonic/subsonic/4.9/subsonic-4.9.deb /tmp/subsonic.deb +RUN dpkg -i /tmp/subsonic.deb && rm /tmp/subsonic.deb + +ADD start.sh /start.sh + +VOLUME ["/data"] +VOLUME ["/music"] +EXPOSE 4040 + +CMD ["/start.sh"] diff --git a/services/subsonic/start.sh b/services/subsonic/start.sh new file mode 100755 index 0000000..b4c8def --- /dev/null +++ b/services/subsonic/start.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +set -e + +mkdir -p /data/db /data/lucene /data/thumbs +ln -sf /data/db /var/subsonic/db +ln -sf /data/lucene /var/subsonic/lucene +ln -sf /data/thumbs /var/subsonic/thumbs + +service subsonic start +tail -f /var/subsonic/*.log diff --git a/services/utorrent/Dockerfile b/services/utorrent/Dockerfile new file mode 100644 index 0000000..1e65de7 --- /dev/null +++ b/services/utorrent/Dockerfile @@ -0,0 +1,26 @@ +FROM debian:squeeze + +ENV DEBIAN_FRONTEND noninteractive +ENV LANG en_US.UTF-8 + +RUN apt-get update -q +RUN apt-get install -qy locales +RUN echo en_US.UTF-8 UTF-8 > /etc/locale.gen +RUN dpkg-reconfigure locales + +RUN apt-get install -qy unzip curl + +ADD http://download-new.utorrent.com/endpoint/utserver/os/linux-x64-debian-6-0/track/beta /tmp/utorrent.tar.gz +RUN tar xzf /tmp/utorrent.tar.gz && \ + rm /tmp/utorrent.tar.gz + +ADD start.sh /start.sh + +VOLUME ["/data"] +VOLUME ["/downloads"] +# Torrent port +EXPOSE 53160 +# WebUI +EXPOSE 8080 + +CMD ["/start.sh"] diff --git a/services/utorrent/start.sh b/services/utorrent/start.sh new file mode 100755 index 0000000..3a1a400 --- /dev/null +++ b/services/utorrent/start.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +set -e + +mkdir -p /data/settings +touch /data/utorrent.config +touch /data/utorrent.log +unzip -oq /utorrent*/webui.zip -d /data/settings/webui + +/utorrent*/utserver -settingspath /data/settings -logfile /data/utorrent.log -configfile /data/utorrent.config -daemon +tail -f /data/utorrent.log diff --git a/services/wordpress/Dockerfile b/services/wordpress/Dockerfile new file mode 100644 index 0000000..e885343 --- /dev/null +++ b/services/wordpress/Dockerfile @@ -0,0 +1,15 @@ +FROM aostanin/debian + +RUN apt-get install -qy nginx php5-fpm php5-mysql + +ADD http://wordpress.org/latest.tar.gz /tmp/wordpress.tar.gz +RUN tar xzf /tmp/wordpress.tar.gz && rm /tmp/wordpress.tar.gz + +ADD default /etc/nginx/sites-enabled/default + +ADD start.sh /start.sh + +VOLUME ["/data"] +EXPOSE 80 + +CMD ["/start.sh"] diff --git a/services/wordpress/default b/services/wordpress/default new file mode 100644 index 0000000..1db3b01 --- /dev/null +++ b/services/wordpress/default @@ -0,0 +1,17 @@ +server { + root /wordpress; + index index.php index.html index.htm; + + if (!-e $request_filename) { + rewrite ^(.+)$ /index.php?q=$1 last; + } + + location ~ \.php$ { + fastcgi_pass unix:/var/run/php5-fpm.sock; + include fastcgi_params; + } + + location ~ /\.ht { + deny all; + } +} diff --git a/services/wordpress/start.sh b/services/wordpress/start.sh new file mode 100755 index 0000000..dbb5ed4 --- /dev/null +++ b/services/wordpress/start.sh @@ -0,0 +1,27 @@ +#! /bin/sh + +set -e + +if [ ! -d /wp-content.default ]; then + mv /wordpress/wp-content /wp-content.default +fi + +if [ ! -d /data/wp-content ]; then + cp -r /wp-content.default /data/wp-content +fi + +if [ ! -f /data/wp-config.php ]; then + cp /wordpress/wp-config-sample.php /data/wp-config.php +fi + +ln -sf /data/wp-content /wordpress/wp-content +ln -sf /data/wp-config.php /wordpress/wp-config.php + +chown -R www-data:www-data /wordpress /data/wp-content + +sed -i "s/'DB_HOST',\s*'[^']*'/'DB_HOST', '"$DB_PORT_3306_TCP_ADDR:$DB_PORT_3306_TCP_PORT"'/" /data/wp-config.php + +service php5-fpm start +service nginx start + +tail -f /var/log/nginx/* diff --git a/services/znc/Dockerfile b/services/znc/Dockerfile new file mode 100644 index 0000000..2feb8ea --- /dev/null +++ b/services/znc/Dockerfile @@ -0,0 +1,29 @@ +FROM aostanin/debian + +ENV ZNC_VERSION 1.2 + +RUN apt-get install -qy --force-yes build-essential libperl-dev libssl-dev + +ADD http://znc.in/releases/znc-$ZNC_VERSION.tar.gz /tmp/znc.tar.gz +RUN tar xzf /tmp/znc.tar.gz && \ + rm /tmp/znc.tar.gz + +# Push module (https://github.com/jreese/znc-push) +ADD https://raw.github.com/jreese/znc-push/master/push.cpp /znc-$ZNC_VERSION/modules/push.cpp +# Colloquy push modules (https://github.com/wired/colloquypush) +ADD https://raw.github.com/wired/colloquypush/master/znc/colloquy.cpp /znc-$ZNC_VERSION/modules/colloquy.cpp + +RUN cd /znc-$ZNC_VERSION && \ + ./configure && \ + make && \ + make install +RUN useradd --system --user-group --home-dir /data --no-create-home znc + +ADD znc.conf /znc.conf.default + +ADD start.sh /start.sh + +VOLUME ["/data"] +EXPOSE 6667 + +CMD ["/start.sh"] diff --git a/services/znc/start.sh b/services/znc/start.sh new file mode 100755 index 0000000..5ca29d7 --- /dev/null +++ b/services/znc/start.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +set -e + +if [ ! -f /data/.znc/configs/znc.conf ]; then + mkdir -p /data/.znc/configs + cp /znc.conf.default /data/.znc/configs/znc.conf +fi + +chown -R znc:znc /data + +su -c "znc --foreground" znc diff --git a/services/znc/znc.conf b/services/znc/znc.conf new file mode 100644 index 0000000..0811b77 --- /dev/null +++ b/services/znc/znc.conf @@ -0,0 +1,22 @@ +Version = 1.2 + + Port = 6667 + IPv4 = true + IPv6 = false + SSL = false + +LoadModule = partyline +LoadModule = webadmin + + + Pass = sha256#a9a7a6af913c13d02d310e703e7d72a06942a98a9ae7d87fc40885633b65631a#lPmU,(xMi*GyM-NavEa5# + Admin = true + Nick = znc + AltNick = znc_ + Ident = znc + RealName = Got ZNC? + Buffer = 50 + AutoClearChanBuffer = true + ChanModes = +stn + +