787b408d84
This patch adds a new "wheel" directory to the pypi mirrors, as an rsync target for our built wheel packages. A rewrite rule has been added in anticipation of serving the wheels from an AFS drive. Since AFS has a practical folder size limit, we are using /a/a /s/sp/split /s/st/style directory structure that should be AFS-tolerant. The rewrite rule creates the necessary mappings that make the packages available to pip. Example: HTTP GET /Babel/ -> /B/Ba/Babel/ Furthermore, a cron job has been added to periodically generate a human-readable index of these mappings, in accordance with PEP503. While frequently regenerated, this index should only change meaningfully if a new package is added to the wheel, as it only represents the package names themselves, rather than the available versions of said package. Change-Id: I743fc3ec629eea225c981d6e870751f33e77d7c6
59 lines
1.3 KiB
Puppet
59 lines
1.3 KiB
Puppet
# == Class: openstack_project::pypi
|
|
#
|
|
class openstack_project::pypi (
|
|
$vhost_name = $::fqdn,
|
|
$sysadmins = [],
|
|
) {
|
|
|
|
class { 'openstack_project::server':
|
|
iptables_public_tcp_ports => [22, 80],
|
|
sysadmins => $sysadmins,
|
|
}
|
|
|
|
$mirror_root = '/srv/static'
|
|
$pypi_root = "${mirror_root}/mirror"
|
|
$www_root = "${pypi_root}/web"
|
|
$wheel_root = "${www_root}/wheel"
|
|
|
|
if ! defined(File[$mirror_root]) {
|
|
file { $mirror_root:
|
|
ensure => directory,
|
|
}
|
|
}
|
|
|
|
class { 'openstack_project::pypi_mirror':
|
|
data_directory => "${pypi_root}",
|
|
require => File[$mirror_root]
|
|
}
|
|
|
|
class { 'openstack_project::wheel_mirror':
|
|
data_directory => "${wheel_root}",
|
|
require => Class['Openstack_project::Pypi_mirror'],
|
|
}
|
|
|
|
include ::httpd
|
|
|
|
if ! defined(Httpd::Mod['rewrite']) {
|
|
httpd::mod { 'rewrite':
|
|
ensure => present,
|
|
}
|
|
}
|
|
|
|
::httpd::vhost { $vhost_name:
|
|
port => 80,
|
|
priority => '50',
|
|
docroot => $www_root,
|
|
require => Class['Openstack_project::Pypi_mirror'],
|
|
template => 'openstack_project/pypi.vhost.erb',
|
|
}
|
|
|
|
file { "${www_root}/robots.txt":
|
|
ensure => present,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0444',
|
|
source => 'puppet:///modules/openstack_project/disallow_robots.txt',
|
|
require => Class['Openstack_project::Pypi_mirror'],
|
|
}
|
|
}
|