Oops, actually forgot to add the teamplayer directory

This commit is contained in:
Albert Hopkins 2010-07-21 23:09:09 -04:00
parent c317172525
commit 145dc43c3d
14 changed files with 254 additions and 0 deletions

View File

@ -0,0 +1,17 @@
Servername HOSTNAME
Listen 80
ProxyPass /repo/ http://localhost:8000/repo/
<VirtualHost *>
DocumentRoot TP_HOME/web/
WSGIDaemonProcess TP_USER user=TP_USER group=TP_USER processes=1 threads=5
WSGIScriptAlias / TP_HOME/teamplayer.wsgi
<Location "/">
WSGIProcessGroup TP_USER
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Location>
</VirtualHost>

73
teamplayer/apache2.conf Normal file
View File

@ -0,0 +1,73 @@
# /etc/conf.d/apache2: config file for /etc/init.d/apache2
# When you install a module it is easy to activate or deactivate the modules
# and other features of apache using the APACHE2_OPTS line. Every module should
# install a configuration in /etc/apache2/modules.d. In that file will have an
# <IfDefine NNN> directive where NNN is the option to enable that module.
#
# Here are the options available in the default configuration:
#
# AUTH_DIGEST Enables mod_auth_digest
# AUTHNZ_LDAP Enables authentication through mod_ldap (available if USE=ldap)
# CACHE Enables mod_cache
# DAV Enables mod_dav
# ERRORDOCS Enables default error documents for many languages.
# INFO Enables mod_info, a useful module for debugging
# LANGUAGE Enables content-negotiation based on language and charset.
# LDAP Enables mod_ldap (available if USE=ldap)
# MANUAL Enables /manual/ to be the apache manual (available if USE=docs)
# MEM_CACHE Enables default configuration mod_mem_cache
# PROXY Enables mod_proxy
# SSL Enables SSL (available if USE=ssl)
# SUEXEC Enables running CGI scripts (in USERDIR) through suexec.
# USERDIR Enables /~username mapping to /home/username/public_html
#
#
# The following two options provide the default virtual host for the HTTP and
# HTTPS protocol. YOU NEED TO ENABLE AT LEAST ONE OF THEM, otherwise apache
# will not listen for incomming connections on the approriate port.
#
# DEFAULT_VHOST Enables name-based virtual hosts, with the default
# virtual host being in /var/www/localhost/htdocs
# SSL_DEFAULT_VHOST Enables default vhost for SSL (you should enable this
# when you enable SSL)
#
APACHE2_OPTS="-D INFO -D WSGI -D PROXY"
# Extended options for advanced uses of Apache ONLY
# You don't need to edit these unless you are doing crazy Apache stuff
# As not having them set correctly, or feeding in an incorrect configuration
# via them will result in Apache failing to start
# YOU HAVE BEEN WARNED.
# PID file
#PIDFILE=/var/run/apache2.pid
# timeout for startup/shutdown checks
#TIMEOUT=10
# ServerRoot setting
#SERVERROOT=/usr/lib64/apache2
# Configuration file location
# - If this does NOT start with a '/', then it is treated relative to
# $SERVERROOT by Apache
#CONFIGFILE=/etc/apache2/httpd.conf
# Location to log startup errors to
# They are normally dumped to your terminal.
#STARTUPERRORLOG="/var/log/apache2/startuperror.log"
# A command that outputs a formatted text version of the HTML at the URL
# of the command line. Designed for lynx, however other programs may work.
#LYNX="lynx -dump"
# The URL to your server's mod_status status page.
# Required for status and fullstatus
#STATUSURL="http://localhost/server-status"
# Method to use when reloading the server
# Valid options are 'restart' and 'graceful'
# See http://httpd.apache.org/docs/2.2/stopping.html for information on
# what they do and how they differ.
#RELOAD_TYPE="graceful"

36
teamplayer/critical Normal file
View File

@ -0,0 +1,36 @@
app-editors/nano
net-misc/openssh
net-misc/rsync
net-misc/wget
sys-kernel/gentoo-sources
sys-kernel/linux-headers
sys-devel/gcc
sys-devel/automake
sys-devel/bison
sys-devel/make
sys-devel/flex
sys-devel/automake-wrapper
sys-devel/autoconf-wrapper
sys-devel/autoconf
sys-devel/m4
sys-devel/gcc-config
sys-devel/libtool
sys-devel/binutils
sys-devel/binutils-config
sys-devel/patch
sys-devel/gnuconfig
app-admin/python-updater
app-admin/perl-cleaner
sys-apps/man-pages
sys-apps/man
sys-apps/file
sys-apps/less
sys-apps/texinfo
sys-apps/busybox
sys-apps/debianutils
sys-apps/man-pages-posix
sys-apps/sandbox
sys-apps/which
dev-lang/perl
sys-devel/libperl
sys-apps/portage

8
teamplayer/local.start Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
su -c "TP_HOME/bin/start-teamplayer" TP_USER
tailf TP_HOME/teamplayer.log > /dev/tty7 &
# put some ionice on mpd
sleep 3
ionice -c2 -n0 -p$(cat TP_DB/mpd/mpd.pid)

3
teamplayer/local.stop Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
su -c "TP_HOME/bin/stop-teamplayer" TP_USER

View File

@ -0,0 +1 @@
dev-python/django ~amd64

8
teamplayer/package.use Normal file
View File

@ -0,0 +1,8 @@
app-editors/nano ncurses
dev-lang/python sqlite ssl threads xml
sys-kernel/gentoo-sources symlink
media-sound/mpd audiofile ffmpeg flac id3 lame network ogg vorbis mad sqlite
media-video/ffmpeg mmx mxext mp3 network x264
media-libs/flac ogg
dev-python/django sqlite
dev-db/sqlite threadsafe

41
teamplayer/postinstall Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh -e
CHROOT="$1"
HOSTNAME="$2"
APPLIANCE="`dirname $0`"
HG_REPO="/home/percy/Hg/teamplayer"
TP_USER="teamplayer"
TP_HOME="/opt/teamplayer"
TP_DB="/var/db/teamplayer"
INSTALL="/usr/bin/install"
M4="/usr/bin/m4"
M4_DEFS="-D HOSTNAME=${HOSTNAME} -D TP_USER=${TP_USER} -D TP_HOME=${TP_HOME}"
M4_DEFS="${M4_DEFS} -D TP_DB=${TP_DB}"
M4C="${M4} ${M4_DEFS}"
chroot ${CHROOT} getent passwd ${TP_USER} || \
chroot ${CHROOT} useradd -c "Teamplayer Server" -U -d ${TP_HOME} \
${TP_USER}
rm -rf ${TP_HOME}
hg clone --pull ${HG_REPO} ${CHROOT}/${TP_HOME}
cp ${APPLIANCE}/teamplayer.wsgi ${CHROOT}${TP_HOME}/teamplayer.wsgi
${M4C} ${APPLIANCE}/settings_local.py > ${CHROOT}${TP_HOME}/web/settings_local.py
mkdir -p ${CHROOT}${TP_HOME}/bin
${M4C} ${APPLIANCE}/start-teamplayer > ${CHROOT}${TP_HOME}/bin/start-teamplayer
chmod +x ${CHROOT}${TP_HOME}/bin/start-teamplayer
${M4C} ${APPLIANCE}/stop-teamplayer > ${CHROOT}${TP_HOME}/bin/stop-teamplayer
chmod +x ${CHROOT}${TP_HOME}/bin/stop-teamplayer
chroot ${CHROOT} ${INSTALL} -d -o ${TP_USER} -g ${TP_USER} ${TP_DB}
chroot ${CHROOT} ${INSTALL} -d -o ${TP_USER} -g ${TP_USER} ${TP_DB}/songs
chroot ${CHROOT} rm -rf ${TP_HOME}/web/media/songs
chroot ${CHROOT} ln -s ${TP_DB}/songs ${TP_HOME}/web/media/songs
chroot ${CHROOT} ${INSTALL} -d -o ${TP_USER} -g ${TP_USER} ${TP_DB}/mpd
chroot ${CHROOT} chown -R ${TP_USER}:${TP_USER} ${TP_HOME}
${M4C} ${APPLIANCE}/10_teamplayer.conf > ${CHROOT}/etc/apache2/vhosts.d/10_teamplayer.conf
cp ${APPLIANCE}/apache2.conf ${CHROOT}/etc/conf.d/apache2
${M4C} ${APPLIANCE}/local.start > ${CHROOT}/etc/conf.d/local.start
${M4C} ${APPLIANCE}/local.stop > ${CHROOT}/etc/conf.d/local.stop
sed -i 's/Gentoo Virtual Machine/TEAMPLAYER CONSOLE/' ${CHROOT}/etc/issue
chroot ${CHROOT} rc-update add apache2 default

13
teamplayer/preinstall Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh -ev
CHROOT="$1"
APPLIANCE="`dirname $0`"
# set up apache modules in make.conf
cat >> ${CHROOT}/etc/make.conf << EOF
# Apache config for TeamPlayer
APACHE2_MPMS="prefork"
APACHE2_MODULES="authz_host dir mime proxy proxy_http"
EOF

View File

@ -0,0 +1,13 @@
TEMPLATE_DIRS = (
'TP_HOME/web/templates',
)
TP_STREAM_URL = '/stream.mp3'
`TP_HOME' = 'TP_HOME'
DEBUG = False
TEMPLATE_DEBUG = DEBUG
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = 'TP_DB/teamplayer.db'
#SONG_STORAGE = 'TP_DB/songs'
TP_MPD_HOME = 'TP_DB/mpd'
TP_REPO_URL = '/repo/'

15
teamplayer/start-teamplayer Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
# this should be run as the TP_USER user
cd ~
hg serve -p 8000 --prefix /repo/ > $HOME/hgserve.log 2>&1 &
cd ~/web
if [ ! -f "TP_DB/teamplayer.db" ] ; then
python manage.py syncdb
fi
# spin!
python manage.py spin --verbosity=2 > "$HOME/teamplayer.log" 2>&1 &
echo $! > "$HOME/tps.pid"

7
teamplayer/stop-teamplayer Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
# this should be run as the TP_USER user
cd ~/web
[ -f "$HOME/tps.pid" ] && kill $(cat "$HOME/tps.pid")
python manage.py stop_stream > "$HOME/teamplayer.log"

View File

@ -0,0 +1,10 @@
import os
import sys
path = os.path.dirname(__file__)
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'web.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

9
teamplayer/world Normal file
View File

@ -0,0 +1,9 @@
media-sound/mpd
media-sound/mpc
dev-python/python-mpd
dev-python/django
www-servers/apache
www-apache/mod_wsgi
net-misc/dhcpcd
media-libs/mutagen
dev-vcs/mercurial