Added "lodgeit" virtual appliance

This commit is contained in:
Albert Hopkins 2010-07-28 08:48:09 -04:00
parent 403e7df216
commit 3d6bac9c62
11 changed files with 213 additions and 0 deletions

16
lodgeit/10_lodgeit.conf Normal file
View File

@ -0,0 +1,16 @@
Listen 80
WSGIPythonHome /home/lodgeit/lodgeitproject
<VirtualHost *>
Servername localhost
DocumentRoot /home/lodgeit/lodgeitproject/
WSGIDaemonProcess lodgeit user=lodgeit group=lodgeit processes=1 threads=5
WSGIScriptAlias / /home/lodgeit/lodgeitproject/lodgeit/lodgeit.wsgi
<Location "/">
WSGIProcessGroup lodgeit
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Location>
</VirtualHost>

3
lodgeit/README Normal file
View File

@ -0,0 +1,3 @@
Lodgeit is a pastebin service written in the Python programming language
See http://dev.pocoo.org/projects/lodgeit/

73
lodgeit/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"
# 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
lodgeit/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

11
lodgeit/genkey.py Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/python
import os
import sys
AC_FILENAME = "%s/home/lodgeit/lodgeitproject/lodgeit/app_config.py" % sys.argv[1]
key=repr(os.urandom(30))
app_config=open(AC_FILENAME, 'w')
app_config.write('key=%s\n' % repr(key))
app_config.close()

17
lodgeit/lodgeit.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
set -v
cd ~/
virtualenv --no-site-packages lodgeitproject
cd lodgeitproject
source bin/activate
[ -d lodgeit ] || hg clone http://dev.pocoo.org/hg/lodgeit-main lodgeit
pip install pygments
pip install jinja2
pip install werkzeug
pip install sqlalchemy
pip install babel
pip install pil
pip install simplejson
deactivate

12
lodgeit/lodgeit.wsgi Normal file
View File

@ -0,0 +1,12 @@
import sys
from os.path import dirname
app_dir = dirname(__file__)
sys.path.insert(0, app_dir)
from lodgeit import make_app
from app_config import key
application = make_app(
dburi='sqlite:///%s/lodgeit.db' % app_dir,
secret_key=key
)

3
lodgeit/package.use Normal file
View File

@ -0,0 +1,3 @@
app-editors/nano ncurses
dev-lang/python sqlite ssl threads xml
sys-kernel/gentoo-sources symlink

24
lodgeit/postinstall Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh -e
set -v
CHROOT="$1"
HOSTNAME="$2"
APPLIANCE="`dirname $0`"
chroot ${CHROOT} emerge -1n --usepkg mercurial
chroot ${CHROOT} emerge -1n --usepkg dev-python/virtualenv
chroot ${CHROOT} getent group lodgeit || chroot ${CHROOT} groupadd lodgeit
chroot ${CHROOT} getent passwd lodgeit || \
chroot ${CHROOT} useradd -c "Lodgeit Pastebin" -m -g lodgeit lodgeit
cp ${APPLIANCE}/lodgeit.sh ${CHROOT}/tmp
chroot ${CHROOT} su -c /tmp/lodgeit.sh lodgeit
cp ${APPLIANCE}/10_lodgeit.conf ${CHROOT}/etc/apache2/vhosts.d
cp ${APPLIANCE}/apache2.conf ${CHROOT}/etc/conf.d/apache2
python ${APPLIANCE}/genkey.py ${CHROOT}
cp ${APPLIANCE}/lodgeit.wsgi ${CHROOT}/home/lodgeit/lodgeitproject/lodgeit
sed -i 's/Gentoo Virtual Machine/LODGEIT CONSOLE/' ${CHROOT}/etc/issue
chroot ${CHROOT} rc-update add apache2 default
chroot ${CHROOT} emerge -C mercurial
chroot ${CHROOT} emerge -C dev-python/virtualenv
chroot ${CHROOT} emerge --depclean --with-bdeps=n

13
lodgeit/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 LodgeIt
APACHE2_MPMS="prefork"
APACHE2_MODULES="authz_host dir mime"
EOF

5
lodgeit/world Normal file
View File

@ -0,0 +1,5 @@
app-admin/syslog-ng
net-misc/dhcpcd
sys-boot/grub
sys-kernel/gentoo-sources
www-apache/mod_wsgi