Asher has submitted this change and it was merged. Change subject: New Parsoid Varnish puppetization ......................................................................
New Parsoid Varnish puppetization Not applied yet in site.pp, and won't work out of the box on celsus and constable (pmtpa hosts) until we get SSDs there (if we even do that; it's Tampa so who cares) Also adds a VCL with some support for simple purging and implicit cache refreshes. Since this is a private service where we have full control over all requests we don't need to restrict purge access at all. See http://www.mediawiki.org/wiki/Parsoid/Minimal_performance_strategy_for_July_release and https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/Parsoid.git;a=tree;f=php for some background. Co-authored-by: Gabriel Wicke <gwi...@wikimedia.org> Change-Id: Ic378854f9ad305ff6cacdc2ef0844a3a1d294660 --- M manifests/role/cache.pp A templates/varnish/parsoid-backend.inc.vcl.erb A templates/varnish/parsoid-common.inc.vcl.erb A templates/varnish/parsoid-frontend.inc.vcl.erb 4 files changed, 135 insertions(+), 0 deletions(-) Approvals: Asher: Verified; Looks good to me, approved jenkins-bot: Verified diff --git a/manifests/role/cache.pp b/manifests/role/cache.pp index 629e1de..4f6a4c8 100644 --- a/manifests/role/cache.pp +++ b/manifests/role/cache.pp @@ -181,6 +181,11 @@ "eqiad" => ["cp1041.eqiad.wmnet", "cp1042.eqiad.wmnet", "cp1043.wikimedia.org", "cp1044.wikimedia.org"], "esams" => [] }, + "parsoid" => { + "pmtpa" => ["celsus.pmtpa.wmnet", "constable.pmtpa.wmnet"], + "eqiad" => ["cerium.wikimedia.org", "titanium.wikimedia.org"], + "esams" => [] + } }, 'labs' => { 'api' => { 'pmtpa' => '127.0.0.1', }, @@ -188,6 +193,7 @@ 'mobile' => { 'pmtpa' => '127.0.0.1', }, 'text' => { 'pmtpa' => '127.0.0.1', }, 'upload' => { 'pmtpa' => '127.0.0.1', }, + 'parsoid' => { 'pmtpa' => '127.0.0.1', }, }, } @@ -282,6 +288,11 @@ "eqiad" => [], "esams" => [] }, + "parsoid" => { + "pmtpa" => [], + "eqiad" => [], + "esams" => [] + } } $backends = { @@ -297,6 +308,7 @@ 'pmtpa' => [ "srv193.pmtpa.wmnet" ], 'eqiad' => [ "srv193.pmtpa.wmnet" ], }, + 'parsoid' => $lvs::configuration::lvs_service_ips['production']['parsoid'] }, 'labs' => { 'appservers' => { @@ -319,6 +331,9 @@ }, 'test_appservers' => { 'pmtpa' => [ '10.4.0.166' ], + }, + 'parsoid' => { + 'pmtpa' => [ '10.4.1.121' ], # deployment-parsoid2 } } } @@ -919,4 +934,97 @@ varnish::logging { 'multicast_relay' : listener_address => '208.80.154.73', port => '8419', cli_args => "-m RxRequest:^(?!PURGE\$) -D" } } } + + class parsoid { + include network::constants + include role::cache::configuration + + $cluster = "cache_parsoid" + $nagios_group = "cache_parsoid_${::site}" + + include lvs::configuration, role::cache::configuration + + if ( $::realm == 'production' ) { + class { "lvs::realserver": realserver_ips => $lvs::configuration::lvs_service_ips[$::realm]['parsoidcache'][$::site] } + } + + system_role { "role::cache::parsoid": description => "Parsoid Varnish cache server" } + + include standard, + nrpe + + $storage_backends = $::realm ? { + 'production' => $::hostname ? { + "titanium" => ["sdb1", "sdd1"], + "cerium" => ["sda1", "sdb1"], + default => [] + }, + 'labs' => ["vdb"], + } + varnish::setup_filesystem{ $storage_backends: + before => Varnish::Instance["parsoid-backend"] + } + + class { "varnish::htcppurger": varnish_instances => [ "localhost:80", "localhost:3128" ] } + + # Ganglia monitoring + if ( $::realm == 'production' ) { + class { "varnish::monitoring::ganglia": varnish_instances => [ "", "frontend" ] } + } + + varnish::instance { "parsoid-backend": + name => "", + vcl => "parsoid-backend", + port => 3128, + admin_port => 6083, + storage => $::realm ? { + 'production' => $::hostname ? { + "titanium" => "-s sdb1=persistent,/srv/sdb1/varnish.persist,139G -s sdd1=persistent,/srv/sdd1/varnish.persist,139G", + "cerium" => "-s sda1=persistent,/srv/sda1/varnish.persist,139G -s sdb1=persistent,/srv/sdb1/varnish.persist,139G", + }, + 'labs' => '-s vdb=persistent,/srv/vdb/varnish.persist,19G', + }, + directors => { + "backend" => $role::cache::configuration::backends[$::realm]['parsoid'][$::mw_primary], + }, + director_options => { + 'retries' => 2, + }, + vcl_config => { + 'retry5xx' => 1, + }, + backend_options => [ + { + 'port' => 8000, + 'connect_timeout' => "5s", + 'first_byte_timeout' => "60s", + 'between_bytes_timeout' => "4s", + 'max_connections' => 600, + }], + xff_sources => $network::constants::all_networks + } + + varnish::instance { "parsoid-frontend": + name => "frontend", + vcl => "parsoid-frontend", + port => 80, + admin_port => 6082, + directors => { + "backend" => $::role::cache::configuration::active_nodes[$::realm]['parsoid'][$::site], + }, + director_type => "chash", + vcl_config => { + 'retry5xx' => 0, + }, + backend_options => { + 'port' => 3128, + 'connect_timeout' => "5s", + 'first_byte_timeout' => "60s", + 'between_bytes_timeout' => "2s", + 'max_connections' => 100000, + 'probe' => "varnish", + }, + xff_sources => $network::constants::all_networks, + } + } } diff --git a/templates/varnish/parsoid-backend.inc.vcl.erb b/templates/varnish/parsoid-backend.inc.vcl.erb new file mode 100644 index 0000000..a2006a7 --- /dev/null +++ b/templates/varnish/parsoid-backend.inc.vcl.erb @@ -0,0 +1,4 @@ +# Varnish VCL include file for Parsoid backends + +# Include common Parsoid config shared between front- and backend +include "parsoid-common.inc.vcl.erb"; diff --git a/templates/varnish/parsoid-common.inc.vcl.erb b/templates/varnish/parsoid-common.inc.vcl.erb new file mode 100644 index 0000000..ba7bab5 --- /dev/null +++ b/templates/varnish/parsoid-common.inc.vcl.erb @@ -0,0 +1,19 @@ +# Varnish VCL include file shared between Parsoid front- and backends + +sub vcl_recv { + /* Support HTTP PURGE */ + if (req.request == "PURGE") { + return (lookup); + } + // Enable force-refresh + // See https://www.varnish-cache.org/trac/wiki/VCLExampleEnableForceRefresh + if (req.http.Cache-Control ~ "no-cache") { + set req.hash_always_miss = true; + } +} + +sub vcl_miss { + if (req.http.Cache-Control ~ "only-if-cached") { + error 412 "Entity not in cache"; + } +} diff --git a/templates/varnish/parsoid-frontend.inc.vcl.erb b/templates/varnish/parsoid-frontend.inc.vcl.erb new file mode 100644 index 0000000..1beacce --- /dev/null +++ b/templates/varnish/parsoid-frontend.inc.vcl.erb @@ -0,0 +1,4 @@ +# Varnish VCL include file for Parsoid frontends + +# Include common Parsoid config shared between front- and backend +include "parsoid-common.inc.vcl.erb"; -- To view, visit https://gerrit.wikimedia.org/r/63890 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic378854f9ad305ff6cacdc2ef0844a3a1d294660 Gerrit-PatchSet: 17 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Catrope <roan.katt...@gmail.com> Gerrit-Reviewer: Asher <afeld...@wikimedia.org> Gerrit-Reviewer: Catrope <roan.katt...@gmail.com> Gerrit-Reviewer: Faidon <fai...@wikimedia.org> Gerrit-Reviewer: GWicke <gwi...@wikimedia.org> Gerrit-Reviewer: Mark Bergsma <m...@wikimedia.org> Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: Ryan Lane <rl...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits