7ace3799f1
The npm mirror was removed with Id539d336814cce2ce18898526e561b8b6977f62f. This change is "inspired" by a proposed puppet-nodejs update in Ia7966fb9578d0d79f3a7f9480e3a956555737dc8. Rather than fixing it up for the new version, remove it (also, puppet is failing trying to access /afs/.openstack.org/mirror/npm). I believe the npmrc.erb file is actually a vestige of prior release methods and is also no longer required. Change-Id: I6fa48e4700779d2c90194f0129c770bf2d6d865f
332 lines
7.1 KiB
Puppet
332 lines
7.1 KiB
Puppet
# == Class: openstack_project::mirror
|
|
#
|
|
class openstack_project::mirror (
|
|
$vhost_name = $::fqdn,
|
|
) {
|
|
|
|
# Some hosts are mirror01, but we need the host to respond to
|
|
# "mirror." Re-evaluate this if we end up doing multiple
|
|
# mirrors/load balancing etc.
|
|
$alias_name = regsubst($vhost_name, 'mirror\d*\.', 'mirror.')
|
|
if $alias_name != $vhost_name {
|
|
$serveraliases = [$alias_name]
|
|
} else {
|
|
$serveraliases = undef
|
|
}
|
|
|
|
$mirror_root = '/afs/openstack.org/mirror'
|
|
$pypi_root = "${mirror_root}/pypi"
|
|
$wheel_root = "${mirror_root}/wheel"
|
|
$ceph_deb_hammer_root = "${mirror_root}/ceph-deb-hammer"
|
|
$ceph_deb_jewel_root = "${mirror_root}/ceph-deb-jewel"
|
|
$ceph_deb_luminous_root = "${mirror_root}/ceph-deb-luminous"
|
|
$gem_root = "${mirror_root}/gem"
|
|
|
|
$www_base = '/var/www'
|
|
$www_root = "${www_base}/mirror"
|
|
|
|
#####################################################
|
|
# Build Apache Webroot
|
|
file { "${www_base}":
|
|
ensure => directory,
|
|
owner => root,
|
|
group => root,
|
|
}
|
|
|
|
file { "${www_root}":
|
|
ensure => directory,
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_base}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to pypi.
|
|
file { "${www_root}/pypi":
|
|
ensure => link,
|
|
target => "${pypi_root}/web",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to wheel.
|
|
file { "${www_root}/wheel":
|
|
ensure => link,
|
|
target => "${wheel_root}",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to centos
|
|
file { "${www_root}/centos":
|
|
ensure => link,
|
|
target => "${mirror_root}/centos",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to debian
|
|
file { "${www_root}/debian":
|
|
ensure => link,
|
|
target => "${mirror_root}/debian",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to Debian OpenStack Packaging Team reprepro.
|
|
file { "${www_root}/debian-openstack":
|
|
ensure => link,
|
|
target => "${mirror_root}/debian-openstack",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to rdo
|
|
file { "${www_root}/rdo":
|
|
ensure => absent,
|
|
}
|
|
|
|
# Create the symlink to epel
|
|
file { "${www_root}/epel":
|
|
ensure => link,
|
|
target => "${mirror_root}/epel",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to fedora
|
|
file { "${www_root}/fedora":
|
|
ensure => link,
|
|
target => "${mirror_root}/fedora",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to openSUSE
|
|
file { "${www_root}/opensuse":
|
|
ensure => link,
|
|
target => "${mirror_root}/opensuse",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to apt.
|
|
file { "${www_root}/ubuntu":
|
|
ensure => link,
|
|
target => "${mirror_root}/ubuntu",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to ceph-deb-hammer.
|
|
file { "${www_root}/ceph-deb-hammer":
|
|
ensure => link,
|
|
target => "${ceph_deb_hammer_root}",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to ceph-deb-jewel.
|
|
file { "${www_root}/ceph-deb-jewel":
|
|
ensure => link,
|
|
target => "${ceph_deb_jewel_root}",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to ceph-deb-luminous.
|
|
file { "${www_root}/ceph-deb-luminous":
|
|
ensure => link,
|
|
target => "${ceph_deb_luminous_root}",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to Ubuntu Cloud Archive.
|
|
file { "${www_root}/ubuntu-cloud-archive":
|
|
ensure => link,
|
|
target => "${mirror_root}/ubuntu-cloud-archive",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to Ubuntu MariaDB.
|
|
file { "${www_root}/ubuntu-mariadb":
|
|
ensure => link,
|
|
target => "${mirror_root}/ubuntu-mariadb",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Create the symlink to deb-docker.
|
|
file { "${www_root}/deb-docker":
|
|
ensure => link,
|
|
target => "${mirror_root}/deb-docker",
|
|
owner => root,
|
|
group => root,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# TODO(pabelanger): We can remove this after puppet runs a few times.
|
|
file { "${www_root}/mariadb":
|
|
ensure => absent,
|
|
}
|
|
|
|
file { "${www_root}/gem":
|
|
ensure => link,
|
|
target => "${gem_root}",
|
|
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
|
|
|
|
file { '/opt/apache_cache':
|
|
ensure => absent,
|
|
force => true,
|
|
}
|
|
|
|
file { '/var/cache/apache2/proxy':
|
|
ensure => directory,
|
|
owner => 'www-data',
|
|
group => 'www-data',
|
|
mode => '0755',
|
|
require => Class['httpd']
|
|
}
|
|
|
|
if ! defined(Httpd::Mod['rewrite']) {
|
|
httpd::mod { 'rewrite':
|
|
ensure => present,
|
|
}
|
|
}
|
|
|
|
if ! defined(Httpd::Mod['substitute']) {
|
|
httpd::mod { 'substitute':
|
|
ensure => present,
|
|
}
|
|
}
|
|
|
|
if ! defined(Httpd::Mod['cache']) {
|
|
httpd::mod { 'cache':
|
|
ensure => present,
|
|
}
|
|
}
|
|
|
|
if ! defined(Httpd::Mod['cache_disk']) {
|
|
httpd::mod { 'cache_disk':
|
|
ensure => present,
|
|
}
|
|
}
|
|
|
|
if ! defined(Httpd::Mod['proxy']) {
|
|
httpd::mod { 'proxy':
|
|
ensure => present,
|
|
}
|
|
}
|
|
|
|
if ! defined(Httpd::Mod['proxy_http']) {
|
|
httpd::mod { 'proxy_http':
|
|
ensure => present,
|
|
}
|
|
}
|
|
|
|
::httpd::vhost { $vhost_name:
|
|
port => 80,
|
|
priority => '50',
|
|
docroot => "${www_root}",
|
|
template => 'openstack_project/mirror.vhost.erb',
|
|
serveraliases => $serveraliases,
|
|
require => [
|
|
File["${www_root}"],
|
|
]
|
|
}
|
|
|
|
# Cache cleanup
|
|
package { 'apache2-utils':
|
|
ensure => present,
|
|
}
|
|
|
|
cron { 'apache-cache-cleanup':
|
|
# Clean apache cache once an hour, keep size down to 50GiB.
|
|
minute => '0',
|
|
hour => '*',
|
|
command => 'flock -n /var/run/htcacheclean.lock htcacheclean -n -p /var/cache/apache2/proxy -t -l 40960M > /dev/null',
|
|
environment => 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin',
|
|
require => [
|
|
File['/var/cache/apache2/proxy'],
|
|
Package['apache2-utils'],
|
|
],
|
|
}
|
|
|
|
class { '::httpd::logrotate':
|
|
options => [
|
|
'daily',
|
|
'missingok',
|
|
'rotate 7',
|
|
'compress',
|
|
'delaycompress',
|
|
'notifempty',
|
|
'create 640 root adm',
|
|
],
|
|
}
|
|
}
|