diff --git a/lodgeit/10_lodgeit.conf b/lodgeit/10_lodgeit.conf new file mode 100644 index 0000000..fbf2d6a --- /dev/null +++ b/lodgeit/10_lodgeit.conf @@ -0,0 +1,16 @@ +Listen 80 +WSGIPythonHome /home/lodgeit/lodgeitproject + + Servername localhost + DocumentRoot /home/lodgeit/lodgeitproject/ + WSGIDaemonProcess lodgeit user=lodgeit group=lodgeit processes=1 threads=5 + WSGIScriptAlias / /home/lodgeit/lodgeitproject/lodgeit/lodgeit.wsgi + + + WSGIProcessGroup lodgeit + WSGIApplicationGroup %{GLOBAL} + Order deny,allow + Allow from all + + + diff --git a/lodgeit/README b/lodgeit/README new file mode 100644 index 0000000..d16acca --- /dev/null +++ b/lodgeit/README @@ -0,0 +1,3 @@ +Lodgeit is a pastebin service written in the Python programming language + +See http://dev.pocoo.org/projects/lodgeit/ diff --git a/lodgeit/apache2.conf b/lodgeit/apache2.conf new file mode 100644 index 0000000..a6a15bb --- /dev/null +++ b/lodgeit/apache2.conf @@ -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 +# 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" diff --git a/lodgeit/critical b/lodgeit/critical new file mode 100644 index 0000000..07ffddb --- /dev/null +++ b/lodgeit/critical @@ -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 diff --git a/lodgeit/genkey.py b/lodgeit/genkey.py new file mode 100755 index 0000000..c1c21db --- /dev/null +++ b/lodgeit/genkey.py @@ -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() diff --git a/lodgeit/lodgeit.sh b/lodgeit/lodgeit.sh new file mode 100755 index 0000000..bc0d990 --- /dev/null +++ b/lodgeit/lodgeit.sh @@ -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 diff --git a/lodgeit/lodgeit.wsgi b/lodgeit/lodgeit.wsgi new file mode 100644 index 0000000..6195466 --- /dev/null +++ b/lodgeit/lodgeit.wsgi @@ -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 +) + diff --git a/lodgeit/package.use b/lodgeit/package.use new file mode 100644 index 0000000..1f6d91c --- /dev/null +++ b/lodgeit/package.use @@ -0,0 +1,3 @@ +app-editors/nano ncurses +dev-lang/python sqlite ssl threads xml +sys-kernel/gentoo-sources symlink diff --git a/lodgeit/postinstall b/lodgeit/postinstall new file mode 100755 index 0000000..8e1e5db --- /dev/null +++ b/lodgeit/postinstall @@ -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 diff --git a/lodgeit/preinstall b/lodgeit/preinstall new file mode 100755 index 0000000..38fda21 --- /dev/null +++ b/lodgeit/preinstall @@ -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 + diff --git a/lodgeit/world b/lodgeit/world new file mode 100644 index 0000000..5b7dcb7 --- /dev/null +++ b/lodgeit/world @@ -0,0 +1,5 @@ +app-admin/syslog-ng +net-misc/dhcpcd +sys-boot/grub +sys-kernel/gentoo-sources +www-apache/mod_wsgi