Merge "Added pypi hosting for AFS mirror slave"
This commit is contained in:
commit
f2830ed5b9
@ -5,5 +5,54 @@ class openstack_project::mirror (
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
$mirror_root = '/afs/openstack.org/mirror'
|
$mirror_root = '/afs/openstack.org/mirror'
|
||||||
|
$pypi_root = "${mirror_root}/pypi"
|
||||||
|
$www_root = '/var/www/mirror'
|
||||||
|
|
||||||
|
#####################################################
|
||||||
|
# Build Apache Webroot
|
||||||
|
file { "${www_root}":
|
||||||
|
ensure => directory,
|
||||||
|
owner => root,
|
||||||
|
group => root,
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create the symlink to pypi.
|
||||||
|
file { "${www_root}/pypi":
|
||||||
|
ensure => link,
|
||||||
|
target => "${pypi_root}/web",
|
||||||
|
owner => root,
|
||||||
|
group => root,
|
||||||
|
require => [
|
||||||
|
File["${www_root}"],
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
file { "${www_root}/robots.txt":
|
||||||
|
ensure => present,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0444',
|
||||||
|
source => 'puppet:///modules/openstack_project/disallow_robots.txt',
|
||||||
|
require => File["${www_root}"],
|
||||||
|
}
|
||||||
|
|
||||||
|
#####################################################
|
||||||
|
# Build VHost
|
||||||
|
include ::httpd
|
||||||
|
|
||||||
|
if ! defined(Httpd::Mod['rewrite']) {
|
||||||
|
httpd::mod { 'rewrite':
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::httpd::vhost { $vhost_name:
|
||||||
|
port => 80,
|
||||||
|
priority => '50',
|
||||||
|
docroot => "${www_root}",
|
||||||
|
template => 'openstack_project/mirror.vhost.erb',
|
||||||
|
require => [
|
||||||
|
File["${www_root}"],
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
37
modules/openstack_project/templates/mirror.vhost.erb
Normal file
37
modules/openstack_project/templates/mirror.vhost.erb
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# ************************************
|
||||||
|
# Managed by Puppet
|
||||||
|
# ************************************
|
||||||
|
|
||||||
|
NameVirtualHost <%= @vhost_name %>:<%= @port %>
|
||||||
|
<VirtualHost <%= @vhost_name %>:<%= @port %>>
|
||||||
|
ServerName <%= @srvname %>
|
||||||
|
<% if @serveraliases.is_a? Array -%>
|
||||||
|
<% @serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%>
|
||||||
|
<% elsif @serveraliases != nil -%>
|
||||||
|
<%= " ServerAlias #{@serveraliases}" -%>
|
||||||
|
<% end -%>
|
||||||
|
DocumentRoot <%= @docroot %>
|
||||||
|
<Directory <%= @docroot %>>
|
||||||
|
Options <%= @options %>
|
||||||
|
AllowOverride None
|
||||||
|
Order allow,deny
|
||||||
|
allow from all
|
||||||
|
Satisfy any
|
||||||
|
<IfVersion >= 2.4>
|
||||||
|
Require all granted
|
||||||
|
</IfVersion>
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
# Pypi URL's are:
|
||||||
|
# /pypi/simple/a/a/a-etc.whl
|
||||||
|
# /pypi/simple/a/abcd/abcd-etc.whl
|
||||||
|
# /pypi/simple/a/abcde/abcde-etc.whl
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteRule ^/pypi/simple/([^/])([^/]*)$ /pypi/simple/$1/$1$2 [L]
|
||||||
|
RewriteRule ^/pypi/simple/([^/])([^/]*)/(.*)$ /pypi/simple/$1/$1$2/$3 [L]
|
||||||
|
|
||||||
|
ErrorLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= @name %>_error.log
|
||||||
|
LogLevel warn
|
||||||
|
CustomLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= @name %>_access.log combined
|
||||||
|
ServerSignature Off
|
||||||
|
</VirtualHost>
|
Loading…
x
Reference in New Issue
Block a user