Skip to content

Commit

Permalink
Add stagingyum vhost to web01 for Copr staging repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Aug 15, 2023
1 parent cb1a9c7 commit 9856e7f
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
11 changes: 11 additions & 0 deletions puppet/modules/web/files/deploy-stagingyum.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Make sure target dir can be created
YUM_PATH=`echo "${SSH_ORIGINAL_COMMAND}" | awk '{ print $NF }'`
PROJECT=`echo $YUM_PATH | /bin/cut -f2 -d/`
RELEASE=`echo $YUM_PATH | /bin/cut -f3 -d/`
mkdir -p <%= @home %>/rsync_cache/$PROJECT/$RELEASE

# Permit transfer
$SSH_ORIGINAL_COMMAND

# Publish the site - stderr/out redirect is required to stop the noninteractive shell from hanging
rsync -rvx --delete-after /home/yumrepo/rsync_cache/$PROJECT/$RELEASE /var/www/vhosts/stagingyum/htdocs/ 2>&1 >/dev/null ;
81 changes: 81 additions & 0 deletions puppet/modules/web/manifests/vhost/stagingyum.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# @summary Set up the yum vhost
# @api private
class web::vhost::stagingyum (
String[1] $stable,
Stdlib::Fqdn $servername = 'stagingyum.theforeman.org',
Stdlib::Absolutepath $yum_directory = '/var/www/vhosts/stagingyum/htdocs',
String $user = 'yumrepo',
) {
$yum_directory_config = [
{
path => $yum_directory,
options => ['Indexes', 'FollowSymLinks', 'MultiViews'],
expires_active => 'on',
expires_default => 'access plus 2 minutes',
},
{
path => '.+\.(bz2|gz|rpm|xz)$',
provider => 'filesmatch',
expires_active => 'on',
expires_default => 'access plus 30 days',
},
{
path => 'repomd.xml',
provider => 'files',
expires_active => 'on',
expires_default => 'access plus 2 minutes',
},
]

secure_ssh::receiver_setup { $user:
user => $user,
foreman_search => 'host ~ node*.jenkins.osuosl.theforeman.org and (name = external_ip4 or name = external_ip6)',
script_content => file('web/deploy-stagingyum.sh'),
}

web::vhost { 'stagingyum':
servername => $servername,
docroot => $yum_directory,
docroot_owner => $user,
docroot_group => $user,
docroot_mode => '0755',
directories => $yum_directory_config,
}

['HEADER.html', 'robots.txt'].each |$filename| {
file { "${yum_directory}/${filename}":
ensure => file,
owner => $user,
group => $user,
mode => '0644',
content => file("web/yum/${filename}"),
}
}

['releases', 'plugins', 'client'].each |$directory| {
file { ["${yum_directory}/${directory}", "${yum_directory}/${directory}/${stable}"]:
ensure => directory,
owner => $user,
group => $user,
mode => '0755',
}

file { "${yum_directory}/${directory}/latest":
ensure => link,
target => $stable,
require => File["${yum_directory}/${directory}/${stable}"],
notify => Exec["fastly-purge-${directory}-latest"],
}
}

file { "${yum_directory}/latest":
ensure => link,
target => 'releases/latest',
require => File["${yum_directory}/releases/latest"],
}

file { "${yum_directory}/releases/nightly":
ensure => link,
target => '../nightly',
}
}

0 comments on commit 9856e7f

Please sign in to comment.