зеркало из https://github.com/mozilla/treeherder.git
add varnish setup via puppet
This commit is contained in:
Родитель
ea2312c560
Коммит
3b4f103724
|
@ -1,4 +1,4 @@
|
|||
<VirtualHost *:80>
|
||||
<VirtualHost *:8080>
|
||||
ServerName <%= @APP_URL %>
|
||||
ProxyRequests Off
|
||||
<Proxy *>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
backend apache {
|
||||
.host = "127.0.0.1";
|
||||
.port = "8080";
|
||||
}
|
||||
backend socketio {
|
||||
.host = "127.0.0.1";
|
||||
.port = "8005";
|
||||
}
|
||||
sub vcl_pipe {
|
||||
if (req.http.upgrade) {
|
||||
set bereq.http.upgrade = req.http.upgrade;
|
||||
}
|
||||
}
|
||||
sub vcl_recv {
|
||||
if (req.url ~ "socket.io/[0-9]") {
|
||||
set req.backend = socketio;
|
||||
return (pipe);
|
||||
}
|
||||
else {
|
||||
set req.backend = apache;
|
||||
}
|
||||
}
|
|
@ -13,6 +13,11 @@ $apache_service = $operatingsystem ? {
|
|||
default => "httpd",
|
||||
}
|
||||
|
||||
$apache_port_definition_file = $operatingsystem ? {
|
||||
ubuntu => "/etc/apache2/ports.conf",
|
||||
default => "/etc/httpd/conf/httpd.conf",
|
||||
}
|
||||
|
||||
class apache {
|
||||
package { $apache_devel:
|
||||
ensure => present
|
||||
|
@ -29,6 +34,13 @@ class apache {
|
|||
notify => Service[$apache_service],
|
||||
}
|
||||
|
||||
exec { "sed -i '/[: ]80$/ s/80/8080/' ${apache_port_definition_file}":
|
||||
require => [Package[$apache_devel]],
|
||||
before => [
|
||||
Service[$apache_service]
|
||||
]
|
||||
}
|
||||
|
||||
service { $apache_service:
|
||||
ensure => running,
|
||||
enable => true,
|
||||
|
@ -50,5 +62,8 @@ class apache {
|
|||
onlyif => 'test ! -e /etc/apache2/mods-enabled/proxy_http.load',
|
||||
before => Service[$apache_service];
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
define line($file, $line, $ensure = 'present') {
|
||||
case $ensure {
|
||||
default : { err ( "unknown ensure value ${ensure}" ) }
|
||||
present: {
|
||||
exec { "/bin/echo '${line}' >> '${file}'":
|
||||
unless => "/bin/grep -qFx '${line}' '${file}'"
|
||||
}
|
||||
}
|
||||
absent: {
|
||||
exec { "/usr/bin/perl -ni -e 'print unless /^\\Q${line}\\E\$/' '${file}'":
|
||||
onlyif => "/bin/grep -qFx '${line}' '${file}'"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
$varnish_port_file = $operatingsystem ? {
|
||||
ubuntu => "/etc/default/varnish",
|
||||
default => "/etc/sysconfig/varnish",
|
||||
}
|
||||
|
||||
|
||||
class varnish {
|
||||
package { "varnish":
|
||||
ensure => installed;
|
||||
}
|
||||
|
||||
service { "varnish":
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => Package['varnish'],
|
||||
}
|
||||
|
||||
file {"/etc/varnish/default.vcl":
|
||||
content => template("${PROJ_DIR}/puppet/files/varnish/default.vcl"),
|
||||
owner => "root", group => "root", mode => 0644,
|
||||
require => [Package["varnish"]],
|
||||
before => Service["varnish"],
|
||||
notify => Service["varnish"],
|
||||
}
|
||||
|
||||
exec { "sed -i '/^DAEMON_OPTS=\"-a :6081* / s/6081/80/' ${varnish_port_file}":
|
||||
require => [Package[$apache_devel]],
|
||||
before => [
|
||||
Service["varnish"]
|
||||
],
|
||||
notify => Service["varnish"],
|
||||
}
|
||||
|
||||
}
|
|
@ -26,6 +26,12 @@ Exec {
|
|||
path => "/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin",
|
||||
}
|
||||
|
||||
line {"etc-hosts":
|
||||
file => "/etc/hosts",
|
||||
line => "127.0.0.1 local.treeherder.mozilla.org",
|
||||
ensure => "present"
|
||||
}
|
||||
|
||||
file {"/etc/profile.d/treeherder.sh":
|
||||
content => "
|
||||
export TREEHERDER_DATABASE_NAME='${DB_NAME}'
|
||||
|
@ -49,7 +55,8 @@ class vagrant {
|
|||
init: before => Class["mysql"];
|
||||
mysql: before => Class["python"];
|
||||
python: before => Class["apache"];
|
||||
apache: before => Class["treeherder"];
|
||||
apache: before => Class["varnish"];
|
||||
varnish: before => Class["treeherder"];
|
||||
treeherder: before => Class["rabbitmq"];
|
||||
rabbitmq: before => Class["dev"];
|
||||
dev:;
|
||||
|
|
Загрузка…
Ссылка в новой задаче