-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stagingyum vhost to web01 for Copr staging repositories
- Loading branch information
Showing
5 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# @summary Set up the yum vhost | ||
# @api private | ||
class web::vhost::stagingyum ( | ||
Stdlib::Fqdn $servername = 'stagingyum.theforeman.org', | ||
Stdlib::Absolutepath $yum_directory = '/var/www/vhosts/stagingyum/htdocs', | ||
String $user = 'yumrepostage', | ||
) { | ||
$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 => '(name = external_ip4 or name = external_ip6)', | ||
script_content => template('web/deploy-stagingyum.sh.erb'), | ||
} | ||
|
||
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 => 'root', | ||
group => 'root', | ||
mode => '0644', | ||
content => file("web/yum/${filename}"), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 %>/rsync_cache/$PROJECT/$RELEASE <%= @yum_directory %>/ 2>&1 >/dev/null ; |