Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add Apache support to Vagrant machine

  • Loading branch information...
commit 9c2ba896d52cc84d0f23acca1576e50f7170df3d 1 parent 38b14e2
@codeinthehole codeinthehole authored
View
1  Makefile
@@ -45,6 +45,7 @@ puppet:
rm -rf sites/puppet/modules/*
puppet module install --target-dir sites/puppet/modules/ saz-memcached -v 2.0.2
puppet module install --target-dir sites/puppet/modules/ puppetlabs/mysql
+ puppet module install --target-dir sites/puppet/modules/ puppetlabs/apache
git clone git://github.com/akumria/puppet-postgresql.git sites/puppet/modules/postgresql
git clone git://github.com/uggedal/puppet-module-python.git sites/puppet/modules/python
git clone git://github.com/codeinthehole/puppet-userconfig.git sites/puppet/modules/userconfig
View
1  Vagrantfile
@@ -11,6 +11,7 @@ Vagrant::Config.run do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.forward_port 8000, 8080
+ config.vm.forward_port 80, 8081
#config.vm.boot_mode = :gui
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "sites/puppet/manifests"
View
7 sites/puppet/manifests/site.pp
@@ -26,6 +26,13 @@
include python_dependencies
include userconfig
+ # Apache
+ class {"apache": }
+ class {"apache::mod::wsgi": }
+ file {"/etc/apache2/sites-enabled/vagrant.conf":
+ source => "/vagrant/sites/sandbox/deploy/apache2/vagrant.conf"
+ }
+
# Memcached
class {"memcached": max_memory => 64 }
View
19 sites/sandbox/deploy/apache2/vagrant.conf
@@ -0,0 +1,19 @@
+<VirtualHost *>
+ ServerName vagrant.oscarcommerce.com
+ DocumentRoot /vagrant/sites/sandbox/public
+ CustomLog /var/log/apache2/access.vagrant.oscar.log combined
+ ErrorLog /var/log/apache2/error.vagrant.oscar.log
+ AllowEncodedSlashes On
+
+ WSGIDaemonProcess oscar processes=2 threads=5 display-name=oscar maximum-requests=10000
+ WSGIProcessGroup oscar
+ WSGIApplicationGroup %{GLOBAL}
+ WSGIScriptAlias / /vagrant/sites/sandbox/deploy/wsgi/vagrant.wsgi
+ WSGIPassAuthorization On
+
+ <Directory /vagrant/sites/sandbox/deploy/wsgi/vagrant.wsgi >
+ Order deny,allow
+ Allow from all
+ </Directory>
+
+</Virtualhost>
View
23 sites/sandbox/deploy/wsgi/vagrant.wsgi
@@ -0,0 +1,23 @@
+import os
+import sys
+import site
+import urllib
+
+sys.stdout = sys.stderr
+
+# Project root
+root = '/vagrant/sites/sandbox'
+sys.path.insert(0, root)
+
+# Packages from virtualenv
+activate_this = '/var/www/virtualenv/bin/activate_this.py'
+execfile(activate_this, dict(__file__=activate_this))
+
+# Set environmental variable for Django and fire WSGI handler
+os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
+import django.core.handlers.wsgi
+_application = django.core.handlers.wsgi.WSGIHandler()
+
+def application(environ, start_response):
+ environ['PATH_INFO'] = urllib.unquote(environ['REQUEST_URI'].split('?')[0])
+ return _application(environ, start_response)
Please sign in to comment.
Something went wrong with that request. Please try again.