Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Run level 5 behind apache proxy to listen on the correct port.

TODO: would be to run via SSL
  • Loading branch information...
commit bb14488458adb1b0e43f12a2c67fe32e0fd623c9 1 parent 0bdb06e
Dan Jackson authored
21 puppet/modules/stripectf2/manifests/apache2_module.pp
View
@@ -0,0 +1,21 @@
+# Define an apache2 module. Debian packages place the module config
+# into /etc/apache2/mods-available.
+#
+define stripectf2::apache2_module ( $ensure = 'present' ) {
+ $apache2_mods = "/etc/apache2/mods"
+ case $ensure {
+ 'present' : {
+ exec { "/usr/sbin/a2enmod $name":
+ unless => "/bin/readlink -e ${apache2_mods}-enabled/${name}.load",
+ notify => Service["apache2"],
+ }
+ }
+ 'absent': {
+ exec { "/usr/sbin/a2dismod $name":
+ onlyif => "/bin/readlink -e ${apache2_mods}-enabled/${name}.load",
+ notify => Service["apache2"],
+ }
+ }
+ default: { err ( "Unknown ensure value: '$ensure'" ) }
+ }
+}
1  puppet/modules/stripectf2/manifests/level02.pp
View
@@ -46,6 +46,7 @@
$document_root = $destination
file {'/etc/apache2/sites-available/level02':
content => template('stripectf2/apache2_site_config.erb'),
+ notify => Service['apache2']
}
stripectf2::apache2_site {'level02':
28 puppet/modules/stripectf2/manifests/level05.pp
View
@@ -5,8 +5,6 @@
file {$destination:
ensure => 'directory',
recurse => true,
- purge => true,
- force => true,
mode => '0755',
owner => 'vagrant',
group => 'vagrant',
@@ -30,4 +28,30 @@
provider => 'base',
require => File[$destination]
}
+
+ service {'apache2':
+ ensure => 'running',
+ enable => true,
+ hasrestart => true,
+ }
+
+ # Disable the default apache2 site
+ stripectf2::apache2_site {'000-default':
+ ensure => 'absent',
+ }
+
+ stripectf2::apache2_module {['proxy', 'proxy_http']:
+ ensure => 'present',
+ }
+
+ $proxy_url = "http://127.0.0.1:4567/"
+ file {'/etc/apache2/sites-available/level05':
+ content => template('stripectf2/apache2_site_config.erb'),
+ notify => Service['apache2'],
+ }
+
+ stripectf2::apache2_site {'level05':
+ ensure => 'present',
+ require => File['/etc/apache2/sites-available/level05'],
+ }
}
14 puppet/modules/stripectf2/templates/apache2_site_config.erb
View
@@ -1,3 +1,17 @@
<VirtualHost *:80>
+ <% if @document_root %>
DocumentRoot <%= @document_root %>
+ <% end %>
+
+ <% if @proxy_url %>
+ ProxyPreserveHost On
+ ProxyRequests off
+ ProxyPass / <%= @proxy_url %>
+ ProxyPassReverse / <%= @proxy_url %>
+
+ <Proxy *>
+ Order Allow,Deny
+ Allow from all
+ </Proxy>
+ <% end %>
</VirtualHost>
Please sign in to comment.
Something went wrong with that request. Please try again.