From: Grant Slater Date: Sat, 11 Oct 2014 16:04:11 +0000 (+0100) Subject: Move mediawiki + wiki cookbook to public repo X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/4f10eb951399adea7cd598b2d763969c735bc888 Move mediawiki + wiki cookbook to public repo --- diff --git a/cookbooks/mediawiki/README.rdoc b/cookbooks/mediawiki/README.rdoc new file mode 100644 index 000000000..3de2ec7a3 --- /dev/null +++ b/cookbooks/mediawiki/README.rdoc @@ -0,0 +1,8 @@ += DESCRIPTION: + += REQUIREMENTS: + += ATTRIBUTES: + += USAGE: + diff --git a/cookbooks/mediawiki/attributes/default.rb b/cookbooks/mediawiki/attributes/default.rb new file mode 100644 index 000000000..59f020120 --- /dev/null +++ b/cookbooks/mediawiki/attributes/default.rb @@ -0,0 +1,11 @@ +# Default to enabling the "wiki" role +default[:accounts][:users][:wiki][:status] = :role + +# Use prefork as PHP is to dumb for anything else +default[:apache][:mpm] = "prefork" + +# Set mediawiki defaults +default[:mediawiki][:user] = "wiki" +default[:mediawiki][:group] = "wiki" +default[:mediawiki][:sites] = {} + diff --git a/cookbooks/mediawiki/definitions/mediawiki_extension.rb b/cookbooks/mediawiki/definitions/mediawiki_extension.rb new file mode 100644 index 000000000..9b7e665c1 --- /dev/null +++ b/cookbooks/mediawiki/definitions/mediawiki_extension.rb @@ -0,0 +1,83 @@ +# +# Cookbook Name:: mediawiki +# Definition:: mediawiki_extension +# +# Copyright 2013, OpenStreetMap Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +define :mediawiki_extension, :action => [ :enable ] do + name = params[:name] + site = params[:site] + site_directory = node[:mediawiki][:sites][site][:site_directory] + mediawiki_directory = node[:mediawiki][:sites][site][:directory] + extension_directory = "#{mediawiki_directory}/extensions/#{name}" + source = params[:source] + template = params[:template] + + if source + remote_directory extension_directory do + cookbook "mediawiki" + source source + owner node[:mediawiki][:user] + group node[:mediawiki][:group] + mode 0755 + files_owner node[:mediawiki][:user] + files_group node[:mediawiki][:group] + files_mode 0755 + end + else + repository = params[:repository] || "git://github.com/wikimedia/mediawiki-extensions-#{name}.git" + version = params[:version] || node[:mediawiki][:sites][site][:version] + tag = params[:tag] + if tag + reference = "refs/tags/#{tag}" + else + reference = "refs/heads/REL#{version}".tr(".", "_") + end + + git extension_directory do + action :sync + repository repository + reference reference + depth 1 + enable_submodules true + user node[:mediawiki][:user] + group node[:mediawiki][:group] + ignore_failure repository.start_with?("git://github.com/wikimedia/mediawiki-extensions") + notifies :run, resources(:execute => "#{mediawiki_directory}/maintenance/update.php") + end + end + + if template + template "#{mediawiki_directory}/LocalSettings.d/Ext-#{name}.inc.php" do + cookbook "mediawiki" + source template + user node[:mediawiki][:user] + group node[:mediawiki][:group] + mode 0664 + notifies :create, resources(:template => "#{mediawiki_directory}/LocalSettings.php") + end + end + + file "#{mediawiki_directory}/LocalSettings.d/Ext-#{name}.inc.php" do + action :create_if_missing + user node[:mediawiki][:user] + group node[:mediawiki][:group] + mode 0664 + content " "#{mediawiki_directory}/LocalSettings.php") + end +end diff --git a/cookbooks/mediawiki/definitions/mediawiki_site.rb b/cookbooks/mediawiki/definitions/mediawiki_site.rb new file mode 100644 index 000000000..1cfd2a40c --- /dev/null +++ b/cookbooks/mediawiki/definitions/mediawiki_site.rb @@ -0,0 +1,418 @@ +# +# Cookbook Name:: web +# Definition:: mediawiki_site +# +# Copyright 2012, OpenStreetMap Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +define :mediawiki_site, :action => [ :create, :enable ] do + name = params[:name] + + #/etc/cron.d names cannot contain a dot + cron_name = name.tr(".", "_") + + aliases = Array(params[:aliases]) + + site_directory = params[:directory] || "/srv/#{name}" + + database_params = { + :host => params[:database_host] || "localhost", + :name => params[:database_name], + :username => params[:database_username], + :password => params[:database_password] + } + + mediawiki_repository = "git://github.com/wikimedia/mediawiki-core" + mediawiki_version = params[:version] || "1.22" + mediawiki_reference = "refs/heads/REL#{mediawiki_version}".tr(".", "_") + + passwords = data_bag_item("mediawiki", "passwords") + + mediawiki = { + :directory => "#{site_directory}/w", + :site => name, + :sitename => params[:sitename] || "OpenStreetMap Wiki", + :metanamespace => params[:metanamespace] || "OpenStreetMap", + :logo => params[:logo] || "$wgStylePath/common/images/wiki.png", + :email_contact => params[:email_contact] || "", + :email_sender => params[:email_sender] || "", + :email_sender_name => params[:email_sender_name] || "MediaWiki Mail", + :commons => params[:commons] || TRUE, + :skin => params[:skin] || "vector", + :site_notice => params[:site_notice] || "", + :site_readonly => params[:site_readonly] || FALSE, + :site_admin_user => "Admin", + :site_admin_pw => passwords["mediawiki-admin-user"], + :enable_ssl => params[:enable_ssl] || FALSE + } + +#---------------- + + node.set_unless[:mediawiki][:sites][name] = {} + node.set[:mediawiki][:sites][name][:site_directory] = site_directory + node.set[:mediawiki][:sites][name][:directory] = mediawiki[:directory] + node.set[:mediawiki][:sites][name][:version] = mediawiki_version + node.set_unless[:mediawiki][:sites][name][:wgSecretKey] = random_password(64) + +#---------------- + + mysql_user "#{database_params[:username]}@localhost" do + password database_params[:password] + end + + mysql_database database_params[:name] do + permissions "#{database_params[:username]}@localhost" => :all + end + + ruby_block "rename-installer-localsettings" do + action :nothing + block do + ::File.rename("#{mediawiki[:directory]}/LocalSettings.php","#{mediawiki[:directory]}/LocalSettings-install.php") + end + end + + execute "#{mediawiki[:directory]}/maintenance/install.php" do + action :nothing + #Use metanamespace as Site Name to ensure correct set namespace + command "php maintenance/install.php --server '#{name}' --dbtype 'mysql' --dbname '#{database_params[:name]}' --dbuser '#{database_params[:username]}' --dbpass '#{database_params[:password]}' --dbserver '#{database_params[:host]}' --scriptpath /w --pass '#{mediawiki[:site_admin_pw]}' '#{mediawiki[:metanamespace]}' '#{mediawiki[:site_admin_user]}'" + cwd mediawiki[:directory] + user node[:mediawiki][:user] + group node[:mediawiki][:group] + not_if do + File.exists?("#{mediawiki[:directory]}/LocalSettings-install.php") + end + notifies :create, 'ruby_block[rename-installer-localsettings]', :immediately + end + + execute "#{mediawiki[:directory]}/maintenance/update.php" do + action :nothing + command "php maintenance/update.php --quick" + cwd mediawiki[:directory] + user node[:mediawiki][:user] + group node[:mediawiki][:group] + end + + directory "#{site_directory}" do + owner node[:mediawiki][:user] + group node[:mediawiki][:group] + mode 0775 + end + + directory "#{mediawiki[:directory]}" do + owner node[:mediawiki][:user] + group node[:mediawiki][:group] + mode 0775 + end + + git "#{mediawiki[:directory]}" do + action :sync + repository mediawiki_repository + reference mediawiki_reference + depth 1 + user node[:mediawiki][:user] + group node[:mediawiki][:group] + notifies :run, resources(:execute => "#{mediawiki[:directory]}/maintenance/install.php"), :immediately + notifies :run, resources(:execute => "#{mediawiki[:directory]}/maintenance/update.php") + end + + #Safety catch if git doesn't update but install.php hasn't run + ruby_block "catch-installer-localsettings-run" do + block do + # + end + not_if do + File.exists?("#{mediawiki[:directory]}/LocalSettings-install.php") + end + notifies :run, resources(:execute => "#{mediawiki[:directory]}/maintenance/install.php"), :immediately + action :create + end + + directory "#{mediawiki[:directory]}/images" do + owner "www-data" + group "wiki" + mode 0775 + end + + directory "#{mediawiki[:directory]}/cache" do + owner "www-data" + group "wiki" + mode 0775 + end + + directory "#{mediawiki[:directory]}/LocalSettings.d" do + user node[:mediawiki][:user] + group node[:mediawiki][:group] + mode 0775 + end + + template "#{mediawiki[:directory]}/LocalSettings.php" do + cookbook "mediawiki" + source "LocalSettings.php.erb" + owner node[:mediawiki][:user] + group node[:mediawiki][:group] + mode 0664 + variables({ + :name => name, + :database_params => database_params, + :mediawiki => mediawiki + }) + notifies :run, resources(:execute => "#{mediawiki[:directory]}/maintenance/update.php") + end + + template "/etc/cron.d/mediawiki-#{cron_name}" do + cookbook "mediawiki" + source "mediawiki.cron.erb" + owner "root" + group "root" + mode 0644 + variables({ + :name => name, + :directory => site_directory, + :user => node[:mediawiki][:user] + }) + end + + template "/etc/cron.daily/mediawiki-#{cron_name}-backup" do + cookbook "mediawiki" + source "mediawiki-backup.cron.erb" + owner "root" + group "root" + mode 0700 + variables({ + :name => name, + :directory => site_directory, + :database_params => database_params + }) + end + + #MediaWiki Default Extension + + mediawiki_extension "Cite" do + site name + template "mw-ext-Cite.inc.php.erb" + end + + mediawiki_extension "ConfirmEdit" do + site name + template "mw-ext-ConfirmEdit.inc.php.erb" + end + + mediawiki_extension "Gadgets" do + site name + end + + mediawiki_extension "ImageMap" do + site name + end + + mediawiki_extension "InputBox" do + site name + end + + mediawiki_extension "Interwiki" do + site name + end + + # "LocalisationUpdate" part of Language Extension Bundle, bundled per site + + mediawiki_extension "Nuke" do + site name + end + + mediawiki_extension "ParserFunctions" do + site name + template "mw-ext-ParserFunctions.inc.php.erb" + end + + mediawiki_extension "PdfHandler" do + site name + template "mw-ext-PdfHandler.inc.php.erb" + end + + mediawiki_extension "Poem" do + site name + end + + mediawiki_extension "Renameuser" do + site name + end + + mediawiki_extension "SimpleAntiSpam" do + site name + end + + mediawiki_extension "SpamBlacklist" do + site name + template "mw-ext-SpamBlacklist.inc.php.erb" + end + + mediawiki_extension "SyntaxHighlight_GeSHi" do + site name + end + + mediawiki_extension "TitleBlacklist" do + site name + template "mw-ext-TitleBlacklist.inc.php.erb" + end + + mediawiki_extension "WikiEditor" do + site name + end + + # MediaWiki Language Extension Bundle + #fixme should automatically resolve tag + mw_lang_ext_bundle_tag = "2014.09" + + mediawiki_extension "Babel" do + site name + template "mw-ext-Babel.inc.php.erb" + tag mw_lang_ext_bundle_tag + end + + mediawiki_extension "cldr" do + site name + tag mw_lang_ext_bundle_tag + end + + mediawiki_extension "CleanChanges" do + site name + template "mw-ext-CleanChanges.inc.php.erb" + tag mw_lang_ext_bundle_tag + end + + mediawiki_extension "LocalisationUpdate" do + site name + template "mw-ext-LocalisationUpdate.inc.php.erb" + tag mw_lang_ext_bundle_tag + end + + #LocalisationUpdate Update Cron + #template "/etc/cron.d/mediawiki-#{name}-LocalisationUpdate" do + # cookbook "mediawiki" + # source "mediawiki-LocalisationUpdate.cron.erb" + # owner "root" + # group "root" + # mode 0755 + # variables({ + # :name => name, + # :directory => site_directory, + # :user => node[:mediawiki][:user] + # }) + #end + + #mediawiki_extension "Translate" do + # site name + # template "mw-ext-Translate.inc.php.erb" + # tag mw_lang_ext_bundle_tag + #end + + mediawiki_extension "UniversalLanguageSelector" do + site name + tag mw_lang_ext_bundle_tag + end + + # Global Extra Mediawiki Extensions + + mediawiki_extension "AntiSpoof" do + site name + end + + mediawiki_extension "AbuseFilter" do + site name + template "mw-ext-AbuseFilter.inc.php.erb" + end + + mediawiki_extension "CheckUser" do + site name + template "mw-ext-CheckUser.inc.php.erb" + end + + mediawiki_extension "DismissableSiteNotice" do + site name + end + + mediawiki_extension "Elastica" do + site name + end + + mediawiki_extension "CirrusSearch" do + site name + template "mw-ext-CirrusSearch.inc.php.erb" + end + + #OSM specifc extensions + + mediawiki_extension "osmtaginfo" do + site name + repository "git://github.com/Firefishy/osmtaginfo.git" + tag "live" + end + mediawiki_extension "SimpleMap" do + site name + repository "git://github.com/Firefishy/SimpleMap.git" + tag "live" + end + + mediawiki_extension "SlippyMap" do + site name + repository "git://github.com/Firefishy/SlippyMap.git" + tag "live" + end + + cookbook_file "#{site_directory}/cc-wiki.png" do + cookbook "mediawiki" + owner node[:mediawiki][:user] + group node[:mediawiki][:group] + mode 0644 + backup false + end + + cookbook_file "#{site_directory}/googled06a989d1ccc8364.html" do + cookbook "mediawiki" + owner node[:mediawiki][:user] + group node[:mediawiki][:group] + mode 0644 + backup false + end + + cookbook_file "#{site_directory}/googlefac54c35e800caab.html" do + cookbook "mediawiki" + owner node[:mediawiki][:user] + group node[:mediawiki][:group] + mode 0644 + backup false + end + + apache_site name do + cookbook "mediawiki" + template "apache.erb" + directory site_directory + variables({ + :aliases => aliases, + :mediawiki => mediawiki + }) + notifies :reload, "service[apache2]" + end + + #Fixme - Needs to run once + execute "#{mediawiki[:directory]}/extensions/CirrusSearch/maintenance/updateSearchIndexConfig.php" do + action :nothing + command "php extensions/CirrusSearch/maintenance/updateSearchIndexConfig.php" + cwd mediawiki[:directory] + user node[:mediawiki][:user] + group node[:mediawiki][:group] + end + +end diff --git a/cookbooks/mediawiki/files/default/cc-wiki.png b/cookbooks/mediawiki/files/default/cc-wiki.png new file mode 100644 index 000000000..f0a944e0b Binary files /dev/null and b/cookbooks/mediawiki/files/default/cc-wiki.png differ diff --git a/cookbooks/mediawiki/files/default/googled06a989d1ccc8364.html b/cookbooks/mediawiki/files/default/googled06a989d1ccc8364.html new file mode 100644 index 000000000..e69de29bb diff --git a/cookbooks/mediawiki/files/default/googlefac54c35e800caab.html b/cookbooks/mediawiki/files/default/googlefac54c35e800caab.html new file mode 100644 index 000000000..550556d3d --- /dev/null +++ b/cookbooks/mediawiki/files/default/googlefac54c35e800caab.html @@ -0,0 +1 @@ +google-site-verification: googlefac54c35e800caab.html diff --git a/cookbooks/mediawiki/metadata.rb b/cookbooks/mediawiki/metadata.rb new file mode 100644 index 000000000..53b069d01 --- /dev/null +++ b/cookbooks/mediawiki/metadata.rb @@ -0,0 +1,9 @@ +maintainer "OpenStreetMap Administrators" +maintainer_email "admins@openstreetmap.org" +license "Apache 2.0" +description "Installs and configures mediawiki" +long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) +version "1.0.0" +depends "git" +depends "memcached" +depends "mysql" diff --git a/cookbooks/mediawiki/recipes/default.rb b/cookbooks/mediawiki/recipes/default.rb new file mode 100644 index 000000000..d6d90caa1 --- /dev/null +++ b/cookbooks/mediawiki/recipes/default.rb @@ -0,0 +1,49 @@ +# +# Cookbook Name:: mediawiki +# Recipe:: default +# +# Copyright 2013, OpenStreetMap Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +include_recipe "memcached" +include_recipe "apache::ssl" +include_recipe "mysql" +include_recipe "git" + +#Mediawiki Base Requirements +package "php5" +package "php5-cli" +package "php5-curl" +package "php5-mysql" +package "php5-gd" +package "php-apc" +package "php5-intl" +package "libapache2-mod-php5" + +package "php-wikidiff2" + +#Mediawiki Image + SVG support +package "imagemagick" +package "librsvg2-bin" + +#Mediawiki PDF support via Extension:PdfHandler +package "ghostscript" +package "poppler-utils" + +#Mediawiki backup +package "xz-utils" + +apache_module "php5" +apache_module "rewrite" diff --git a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb new file mode 100644 index 000000000..d4c8e3050 --- /dev/null +++ b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb @@ -0,0 +1,277 @@ +'; +$wgMetaNamespace = '<%= @mediawiki[:metanamespace] %>'; + + +## The URL base path to the directory containing the wiki; +## defaults for all runtime URL paths are based off of this. +## For more information on customizing the URLs +## (like /w/index.php/Page_title to /wiki/Page_title) please see: +## http://www.mediawiki.org/wiki/Manual:Short_URL +$wgScriptPath = "/w"; +$wgArticlePath = '/wiki/$1'; +$wgUsePathInfo = true; +$wgScriptExtension = ".php"; + +## The protocol and server name to use in fully-qualified URLs +$wgServer = "//<%= @mediawiki[:site] %>"; +$wgInternalServer = 'http://<%= @mediawiki[:site] %>'; + +<% if @mediawiki[:enable_ssl] -%> +$wgSecureLogin = true; +$wgDefaultUserOptions['prefershttps'] = 0; +<% end -%> +$wgCookieSecure = false; + +## The relative URL path to the skins directory +$wgStylePath = "$wgScriptPath/skins"; + +## The relative URL path to the logo. Make sure you change this from the default, +## or else you'll overwrite your logo when you upgrade! +$wgLogo = "<%= @mediawiki[:logo] %>"; + +## UPO means: this is also a user preference option + +$wgEnableEmail = true; +$wgEnableUserEmail = true; # UPO + +$wgEmergencyContact = "<%= @mediawiki[:email_contact] %>"; +$wgPasswordSender = "<%= @mediawiki[:email_sender] %>"; +$wgPasswordSenderName = "<%= @mediawiki[:email_sender_name] %>"; //Replaced by MediaWiki:Emailsender in v1.23.0 + +$wgEnotifUserTalk = true; # UPO +$wgEnotifWatchlist = true; # UPO +$wgEmailAuthentication = true; + +$wgEnotifUseJobQ = true; + +## Database settings +$wgDBtype = "mysql"; +$wgDBserver = "<%= @database_params[:host] %>"; +$wgDBname = "<%= @database_params[:name] %>"; +$wgDBuser = "<%= @database_params[:username] %>"; +$wgDBpassword = "<%= @database_params[:password] %>"; + +# MySQL specific settings +$wgDBprefix = ""; + +# MySQL table options to use during installation or update +$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary"; + +# Experimental charset support for MySQL 5.0. +$wgDBmysql5 = false; + +## Shared memory settings +$wgMainCacheType = CACHE_MEMCACHED; +$wgMemCachedServers = array('127.0.0.1:11211'); +$wgSessionsInObjectCache = TRUE; + +## To enable image uploads, make sure the 'images' directory +## is writable, then set this to true: +$wgEnableUploads = true; +$wgUseImageMagick = true; +$wgImageMagickConvertCommand = "/usr/bin/convert"; + +$wgGenerateThumbnailOnParse = false; +$wgMaxImageArea = 125000000; +$wgMaxShellMemory = 5524000; +$wgMaxShellFileSize = 819200; +$wgMaxShellTime = 360; +$wgMaxShellWallClockTime = 360; + +# Allow some more upload extensions +$wgFileExtensions[] = 'doc'; +$wgFileExtensions[] = 'pdf'; +$wgFileExtensions[] = 'odt'; +$wgFileExtensions[] = 'odp'; +$wgFileExtensions[] = 'svg'; + +$wgSVGConverters = array( 'rsvg' => '/usr/bin/rsvg-convert -w $width -h $height -o $output $input'); +$wgSVGConverter = 'rsvg'; +$wgSVGMaxSize = 2000; + +# InstantCommons allows wiki to use images from http://commons.wikimedia.org +<% if @mediawiki[:commons] -%> +$wgUseInstantCommons = true; +<% else -%> +$wgUseInstantCommons = false; +<% end -%> + +## If you use ImageMagick (or any other shell command) on a +## Linux server, this will need to be set to the name of an +## available UTF-8 locale +$wgShellLocale = "en_US.utf8"; + +## If you want to use image uploads under safe mode, +## create the directories images/archive, images/thumb and +## images/temp, and make them all writable. Then uncomment +## this, if it's not already uncommented: +#$wgHashedUploadDirectory = false; + +## Set $wgCacheDirectory to a writable directory on the web server +## to make your wiki go slightly faster. The directory should not +## be publically accessible from the web. +#$wgCacheDirectory = "$IP/cache"; + +# Site language code, should be one of the list in ./languages/Names.php +$wgLanguageCode = "en"; + +$wgSecretKey = "<%= @node[:mediawiki][:sites][@name][:wgSecretKey] %>"; + +# Site upgrade key. Must be set to a string (default provided) to turn on the +# web installer while LocalSettings.php is in place +#$wgUpgradeKey = "6ad907e74fc65836"; + +## Default skin: you can change the default skin. Use the internal symbolic +## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector': +$wgDefaultSkin = "<%= @mediawiki[:skin] %>"; + +## For attaching licensing metadata to pages, and displaying an +## appropriate copyright notice / icon. GNU Free Documentation +## License and Creative Commons licenses are supported so far. +$wgRightsPage = "OpenStreetMap_License"; # Set to the title of a wiki page that describes your license/copyright +$wgRightsUrl = "http://creativecommons.org/licenses/by-sa/2.0/"; +$wgRightsText = "Creative Commons Attribution-ShareAlike 2.0 license"; +$wgRightsIcon = "/cc-wiki.png"; + +# Path to the GNU diff3 utility. Used for conflict resolution. +$wgDiff3 = "/usr/bin/diff3"; + +$wgExternalDiffEngine = 'wikidiff2'; + +# Query string length limit for ResourceLoader. You should only set this if +# your web server has a query string length limit (then set it to that limit), +# or if you have suhosin.get.max_value_length set in php.ini (then set it to +# that value) +$wgResourceLoaderMaxQueryLength = -1; + +# End of automatically generated settings. +# Add more configuration options below. + +#Only Allow Signed-in users to edit +$wgGroupPermissions['*']['edit'] = false; + +#Allow bureaucrat group access to oversight options +$wgGroupPermissions['bureaucrat']['hideuser'] = true; +$wgGroupPermissions['bureaucrat']['deletelogentry'] = true; +$wgGroupPermissions['bureaucrat']['deleterevision'] = true; +$wgGroupPermissions['bureaucrat']['suppressrevision'] = true; +$wgGroupPermissions['bureaucrat']['suppressionlog'] = true; + +#Allow Subpages on Main Namespace +$wgNamespacesWithSubpages[NS_MAIN] = true; + +#DNS Blacklists to use +$wgEnableDnsBlacklist = true; +$wgDnsBlacklistUrls = array( 'proxies.dnsbl.sorbs.net.', 'opm.tornevall.org.', 'xbl.spamhaus.org.' ); + +#Disable Hit Counter for Performance +$wgDisableCounters = TRUE; +#Disable IP in Header to avoid cache issue +$wgShowIPinHeader = FALSE; + +#Job Runs by cron +$wgJobRunRate = 0; + +# Allow external images from a few sites +$wgAllowExternalImagesFrom = array( 'http://tile.openstreetmap.org/', 'http://svenanders.openstreetmap.de/', 'http://josm.openstreetmap.de/', 'http://trac.openstreetmap.org/', 'http://rweait.dev.openstreetmap.org/' ); + +$wgNoFollowDomainExceptions = array( 'www.openstreetmap.org', 'josm.openstreetmap.de', 'taginfo.openstreetmap.org', 'blog.openstreetmap.org', 'wiki.osmfoundation.org' ); + +#FIXME - move to specific +$wgForceUIMsgAsContentMsg = array( 'mainpage-url', 'portal-url', 'mapfeatures-url', 'helppage' ); + +#FIXME - move to specific +$wgAllowUserJs = TRUE; +$wgAllowUserCss = TRUE; + +#FIXME - move to specific +#DE +define('NS_LANG_DE', 200); +$wgExtraNamespaces[NS_LANG_DE] = 'DE'; +$wgNamespacesWithSubpages[NS_LANG_DE] = TRUE; +$wgContentNamespaces[] = NS_LANG_DE; +define('NS_LANG_DE_TALK', 201); +$wgExtraNamespaces[NS_LANG_DE_TALK] = 'DE_talk'; +$wgNamespacesWithSubpages[NS_LANG_DE_TALK] = TRUE; + +#FR +define('NS_LANG_FR', 202); +$wgExtraNamespaces[NS_LANG_FR] = 'FR'; +$wgNamespacesWithSubpages[NS_LANG_FR] = TRUE; +$wgContentNamespaces[] = NS_LANG_FR; +define('NS_LANG_FR_TALK', 203); +$wgExtraNamespaces[NS_LANG_FR_TALK] = 'FR_talk'; +$wgNamespacesWithSubpages[NS_LANG_FR_TALK] = TRUE; + +#ES +define('NS_LANG_ES', 204); +$wgExtraNamespaces[NS_LANG_ES] = 'ES'; +$wgNamespacesWithSubpages[NS_LANG_ES] = TRUE; +$wgContentNamespaces[] = NS_LANG_ES; +define('NS_LANG_ES_TALK', 205); +$wgExtraNamespaces[NS_LANG_ES_TALK] = 'ES_talk'; +$wgNamespacesWithSubpages[NS_LANG_ES_TALK] = TRUE; + +#IT +define('NS_LANG_IT', 206); +$wgExtraNamespaces[NS_LANG_IT] = 'IT'; +$wgNamespacesWithSubpages[NS_LANG_IT] = TRUE; +$wgContentNamespaces[] = NS_LANG_IT; +define('NS_LANG_IT_TALK', 207); +$wgExtraNamespaces[NS_LANG_IT_TALK] = 'IT_talk'; +$wgNamespacesWithSubpages[NS_LANG_IT_TALK] = TRUE; + +#NL +define('NS_LANG_NL', 208); +$wgExtraNamespaces[NS_LANG_NL] = 'NL'; +$wgNamespacesWithSubpages[NS_LANG_NL] = TRUE; +$wgContentNamespaces[] = NS_LANG_NL; +define('NS_LANG_NL_TALK', 209); +$wgExtraNamespaces[NS_LANG_NL_TALK] = 'NL_talk'; +$wgNamespacesWithSubpages[NS_LANG_NL_TALK] = TRUE; + +#RU +define('NS_LANG_RU', 210); +$wgExtraNamespaces[NS_LANG_RU] = 'RU'; +$wgNamespacesWithSubpages[NS_LANG_RU] = TRUE; +$wgContentNamespaces[] = NS_LANG_RU; +define('NS_LANG_RU_TALK', 211); +$wgExtraNamespaces[NS_LANG_RU_TALK] = 'RU_talk'; +$wgNamespacesWithSubpages[NS_LANG_RU_TALK] = TRUE; + +#JA +define('NS_LANG_JA', 212); +$wgExtraNamespaces[NS_LANG_JA] = 'JA'; +$wgNamespacesWithSubpages[NS_LANG_JA] = TRUE; +$wgContentNamespaces[] = NS_LANG_JA; +define('NS_LANG_JA_TALK', 213); +$wgExtraNamespaces[NS_LANG_JA_TALK] = 'JA_talk'; +$wgNamespacesWithSubpages[NS_LANG_JA_TALK] = TRUE; + +$wgNamespacesToBeSearchedDefault[NS_LANG_DE] = TRUE; +$wgNamespacesToBeSearchedDefault[NS_LANG_FR] = TRUE; +$wgNamespacesToBeSearchedDefault[NS_LANG_ES] = TRUE; +$wgNamespacesToBeSearchedDefault[NS_LANG_IT] = TRUE; +$wgNamespacesToBeSearchedDefault[NS_LANG_NL] = TRUE; +$wgNamespacesToBeSearchedDefault[NS_LANG_RU] = TRUE; +$wgNamespacesToBeSearchedDefault[NS_LANG_JA] = TRUE; + +<% if @mediawiki[:site_readonly] -%> +$wgReadOnly = "<%= @mediawiki[:site_readonly] %>"; +<% end -%> + +<% Dir.glob("#{@mediawiki[:directory]}/LocalSettings.d/*.php") do |file| -%> +<%= "require_once('#{file}');" %> +<% end -%> + diff --git a/cookbooks/mediawiki/templates/default/apache.erb b/cookbooks/mediawiki/templates/default/apache.erb new file mode 100644 index 000000000..40e206d1b --- /dev/null +++ b/cookbooks/mediawiki/templates/default/apache.erb @@ -0,0 +1,230 @@ +# DO NOT EDIT - This file is being maintained by Chef + + + ServerName <%= @name %> +<% @aliases.each do |alias_name| -%> + ServerAlias <%= alias_name %> +<% end -%> + + ServerAdmin webmaster@openstreetmap.org + + CustomLog /var/log/apache2/<%= @name %>-access.log combined + ErrorLog /var/log/apache2/<%= @name %>-error.log + + DocumentRoot <%= @directory %> + + php_admin_value open_basedir <%= @directory %>/:/usr/share/php/:/tmp/ + #php_admin_value disable_functions "exec,shell_exec,system,passthru,popen,proc_open" + php_value memory_limit 128M + php_value max_execution_time 240 + php_value upload_max_filesize 70M + php_value post_max_size 100M + + RedirectMatch 301 ^/$ /wiki/Main_Page + + #Historical Compatibility Links + RedirectMatch 301 ^/index\.php$ /w/index.php + RedirectMatch 301 ^/index\.php/(.*)$ /wiki/$1 + RedirectMatch 301 ^/skins/(.*)$ /w/skins/$1 + RedirectMatch 301 ^/images/(.*)$ /w/images/$1 + RedirectMatch 301 ^/api\.php$ /w/api.php + RedirectMatch 301 ^/opensearch_desc\.php$ /w/opensearch_desc.php + + Alias /wiki <%= @mediawiki[:directory] %>/index.php + + #Support /pagename -> /wiki/pagename + RewriteEngine on + RewriteCond %{REQUEST_URI} !^/w/ + RewriteCond %{REQUEST_URI} !^/wiki/ + RewriteCond %{REQUEST_URI} !^/index\.php + RewriteCond %{REQUEST_URI} !^/skins/ + RewriteCond %{REQUEST_URI} !^/images/ + RewriteCond %{REQUEST_URI} !^/api\.php$ + RewriteCond %{REQUEST_URI} !^/opensearch_desc\.php$ + RewriteCond %{REQUEST_URI} !^/server-status + RewriteCond %{LA-U:REQUEST_FILENAME} !-f + RewriteCond %{LA-U:REQUEST_FILENAME} !-d + RewriteRule ^/(.*) /wiki/$1 [R,L] + + > + Options -Indexes + + + /images/> + # No php execution in the upload area + php_admin_flag engine off + Options -ExecCGI -Includes -Indexes + AllowOverride None + + + /images/thumb/> + RewriteEngine on + + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/page([0-9]+)-([0-9]+)px-.*$ /w/thumb.php?f=$1&page=$2&width=$3 [L,QSA,B] + + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/page([0-9]+)-([0-9]+)px-.*$ /w/thumb.php?f=$1&page=$2&width=$3&archived=1 [L,QSA,B] + + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /w/thumb.php?f=$1&width=$2 [L,QSA,B] + + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /w/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B] + + + /maintenance/> + Order allow,deny + Deny from all + + + /LocalSettings.php> + Order allow,deny + Deny from all + + + /images/> + Options -ExecCGI -Includes -Indexes + AllowOverride None + AddType text/plain .html .htm .shtml + php_admin_flag engine off + + + /cache/> + Options -ExecCGI -Includes -Indexes + AllowOverride None + AddType text/plain .html .htm .shtml + php_admin_flag engine off + + + + Order allow,deny + Deny from all + + + + Order allow,deny + Deny from all + + + + Order allow,deny + Deny from all + + +<% if @mediawiki[:enable_ssl] -%> + + ServerName <%= @name %> +<% @aliases.each do |alias_name| -%> + ServerAlias <%= alias_name %> +<% end -%> + + ServerAdmin webmaster@openstreetmap.org + + SSLEngine on + + CustomLog /var/log/apache2/<%= @name %>-secure-access.log combined + ErrorLog /var/log/apache2/<%= @name %>-secure-error.log + + DocumentRoot <%= @directory %> + + php_admin_value open_basedir <%= @directory %>/:/usr/share/php/:/tmp/ + #php_admin_value disable_functions "exec,shell_exec,system,passthru,popen,proc_open" + php_value memory_limit 128M + php_value max_execution_time 240 + php_value upload_max_filesize 70M + php_value post_max_size 100M + + RedirectMatch 301 ^/$ /wiki/Main_Page + + #Historical Compatibility Links + RedirectMatch 301 ^/index\.php$ /w/index.php + RedirectMatch 301 ^/index\.php/(.*)$ /wiki/$1 + RedirectMatch 301 ^/skins/(.*)$ /w/skins/$1 + RedirectMatch 301 ^/images/(.*)$ /w/images/$1 + RedirectMatch 301 ^/api\.php$ /w/api.php + RedirectMatch 301 ^/opensearch_desc\.php$ /w/opensearch_desc.php + + Alias /wiki <%= @mediawiki[:directory] %>/index.php + + #Support /pagename -> /wiki/pagename + RewriteEngine on + RewriteCond %{REQUEST_URI} !^/w/ + RewriteCond %{REQUEST_URI} !^/wiki/ + RewriteCond %{REQUEST_URI} !^/index\.php + RewriteCond %{REQUEST_URI} !^/skins/ + RewriteCond %{REQUEST_URI} !^/images/ + RewriteCond %{REQUEST_URI} !^/api\.php$ + RewriteCond %{REQUEST_URI} !^/opensearch_desc\.php$ + RewriteCond %{REQUEST_URI} !^/server-status + RewriteCond %{LA-U:REQUEST_FILENAME} !-f + RewriteCond %{LA-U:REQUEST_FILENAME} !-d + RewriteRule ^/(.*) /wiki/$1 [R,L] + + > + Options -Indexes + + + /images/> + # No php execution in the upload area + php_admin_flag engine off + Options -ExecCGI -Includes -Indexes + AllowOverride None + + + /images/thumb/> + RewriteEngine on + + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /w/thumb.php?f=$1&width=$2 [L,QSA,B] + + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /w/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B] + + + /maintenance/> + Order allow,deny + Deny from all + + + /LocalSettings.php> + Order allow,deny + Deny from all + + + /images/> + Options -ExecCGI -Includes -Indexes + AllowOverride None + AddType text/plain .html .htm .shtml + php_admin_flag engine off + + + /cache/> + Options -ExecCGI -Includes -Indexes + AllowOverride None + AddType text/plain .html .htm .shtml + php_admin_flag engine off + + + + Order allow,deny + Deny from all + + + + Order allow,deny + Deny from all + + + + Order allow,deny + Deny from all + + +<% end -%> diff --git a/cookbooks/mediawiki/templates/default/mediawiki-backup.cron.erb b/cookbooks/mediawiki/templates/default/mediawiki-backup.cron.erb new file mode 100755 index 000000000..d4d473c7e --- /dev/null +++ b/cookbooks/mediawiki/templates/default/mediawiki-backup.cron.erb @@ -0,0 +1,15 @@ +#!/bin/bash +T=`mktemp -d -t -p /var/tmp mediawiki-<%= @name %>.XXXXXXXXXX` +D=`date +%Y-%m-%d` +B=wiki-<%= @name %>-$D.tar.gz + +mkdir $T/wiki-<%= @name %>-$D +mysqldump --user="<%= @database_params[:username] %>" --password="<%= @database_params[:password] %>" --opt --skip-lock-tables --single-transaction "<%= @database_params[:name] %>" | xz -9c > $T/wiki-<%= @name %>-$D/wiki.sql.xz +ln -s <%= @directory %> $T/wiki-<%= @name %>-$D/www +#make backup rsyncable +GZIP="--rsyncable -9" +export GZIP +nice tar --create --gzip --dereference --directory=$T --file=$T/$B wiki-<%= @name %>-$D +nice rsync $T/$B backup::backup --fuzzy + +rm -rf $T diff --git a/cookbooks/mediawiki/templates/default/mediawiki.cron.erb b/cookbooks/mediawiki/templates/default/mediawiki.cron.erb new file mode 100644 index 000000000..5e4bf532d --- /dev/null +++ b/cookbooks/mediawiki/templates/default/mediawiki.cron.erb @@ -0,0 +1,5 @@ +10 1 * * * <%= @user %> nice php -d memory_limit=1024M -d error_reporting=22517 <%= @directory %>/w/maintenance/generateSitemap.php --server="http://<%= @name %>" --urlpath="http://<%= @name %>/" --fspath="<%= @directory %>" --quiet +0,10,20,40 * * * * www-data nice php -d memory_limit=1024M -d error_reporting=22517 <%= @directory %>/w/maintenance/runJobs.php --server="http://<%= @name %>" --maxtime=300 --memory-limit=1024M --quiet +35,55 * * * * www-data nice php -d memory_limit=1024M -d error_reporting=22517 <%= @directory %>/w/maintenance/runJobs.php --server="http://<%= @name %>" --maxtime=60 --type=enotifNotify --memory-limit=1024M --quiet +10 2 * * * www-data find /tmp/ -maxdepth 1 -type f -user www-data -mmin +90 -name 'gs_*' -delete +10 2 * * * www-data find /tmp/ -maxdepth 1 -type f -user www-data -mmin +90 -name 'magick-*' -delete diff --git a/cookbooks/mediawiki/templates/default/mw-ext-AbuseFilter.inc.php.erb b/cookbooks/mediawiki/templates/default/mw-ext-AbuseFilter.inc.php.erb new file mode 100644 index 000000000..4528b2230 --- /dev/null +++ b/cookbooks/mediawiki/templates/default/mw-ext-AbuseFilter.inc.php.erb @@ -0,0 +1,10 @@ + false, + '1' => 'User %code%-1', + '2' => 'User %code%-2', + '3' => 'User %code%-3', + '4' => 'User %code%-4', + '5' => 'User %code%-5', + 'N' => 'User %code%-N', +); diff --git a/cookbooks/mediawiki/templates/default/mw-ext-CheckUser.inc.php.erb b/cookbooks/mediawiki/templates/default/mw-ext-CheckUser.inc.php.erb new file mode 100644 index 000000000..0f738689c --- /dev/null +++ b/cookbooks/mediawiki/templates/default/mw-ext-CheckUser.inc.php.erb @@ -0,0 +1,7 @@ + TBLSRC_LOCALPAGE, + 'src' => 'MediaWiki:Titleblacklist', + ), + array( + 'type' => TBLSRC_URL, + 'src' => 'http://meta.wikimedia.org/w/index.php?title=Title_blacklist&action=raw', + ), +); diff --git a/cookbooks/wiki/README.rdoc b/cookbooks/wiki/README.rdoc new file mode 100644 index 000000000..3de2ec7a3 --- /dev/null +++ b/cookbooks/wiki/README.rdoc @@ -0,0 +1,8 @@ += DESCRIPTION: + += REQUIREMENTS: + += ATTRIBUTES: + += USAGE: + diff --git a/cookbooks/wiki/attributes/default.rb b/cookbooks/wiki/attributes/default.rb new file mode 100644 index 000000000..2d4ae9474 --- /dev/null +++ b/cookbooks/wiki/attributes/default.rb @@ -0,0 +1,3 @@ + +#Force apache to listen only on localhost +#default[:apache][:listen_address] = "127.0.0.1" diff --git a/cookbooks/wiki/files/default/favicon.ico b/cookbooks/wiki/files/default/favicon.ico new file mode 100644 index 000000000..975e1cb0d Binary files /dev/null and b/cookbooks/wiki/files/default/favicon.ico differ diff --git a/cookbooks/wiki/files/default/osm_logo_wiki.png b/cookbooks/wiki/files/default/osm_logo_wiki.png new file mode 100644 index 000000000..f4a4536c2 Binary files /dev/null and b/cookbooks/wiki/files/default/osm_logo_wiki.png differ diff --git a/cookbooks/wiki/metadata.rb b/cookbooks/wiki/metadata.rb new file mode 100644 index 000000000..e3f9063be --- /dev/null +++ b/cookbooks/wiki/metadata.rb @@ -0,0 +1,8 @@ +maintainer "OpenStreetMap Administrators" +maintainer_email "admins@openstreetmap.org" +license "Apache 2.0" +description "Installs and configures servers for wiki.openstreetmap.org" +long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) +version "1.0.0" +depends "mediawiki" +depends "squid" diff --git a/cookbooks/wiki/recipes/default.rb b/cookbooks/wiki/recipes/default.rb new file mode 100644 index 000000000..2e540f0b5 --- /dev/null +++ b/cookbooks/wiki/recipes/default.rb @@ -0,0 +1,91 @@ +# +# Cookbook Name:: wiki.openstreetmap.org +# Recipe:: default +# +# Copyright 2013, OpenStreetMap Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#include_recipe "squid" + +include_recipe "mediawiki" + +passwords = data_bag_item("wiki", "passwords") + +apache_site "default" do + action [ :disable ] +end + +mediawiki_site "wiki.openstreetmap.org" do + aliases "wiki.osm.org", "wiki.openstreetmap.com", "wiki.openstreetmap.net", "wiki.openstreetmap.ca", "wiki.openstreetmap.eu", "wiki.openstreetmap.pro", "wiki.openstreetmaps.org" + directory "/srv/wiki.openstreetmap.org" + + enable_ssl TRUE + + database_name "wiki" + database_username "wiki-user" + database_password passwords["wiki-user"] + + logo "/osm_logo_wiki.png" + + email_contact "webmaster@openstreetmap.org" + email_sender "wiki@openstreetmap.org" + email_sender_name "OpenStreetMap Wiki" + + metanamespace "OpenStreetMap" + + #site_readonly "MAINTENANCE UPDATE: WIKI READ-ONLY. ETA: Tuesday 8:00am UTC/GMT." + +end + +cookbook_file "/srv/wiki.openstreetmap.org/osm_logo_wiki.png" do + owner node[:mediawiki][:user] + group node[:mediawiki][:group] + mode 0644 +end + +template "/srv/wiki.openstreetmap.org/robots.txt" do + owner node[:mediawiki][:user] + group node[:mediawiki][:group] + mode 0644 + source "robots.txt.erb" +end + +cookbook_file "/srv/wiki.openstreetmap.org/favicon.ico" do + owner node[:mediawiki][:user] + group node[:mediawiki][:group] + mode 0644 +end + +directory "/srv/dump.wiki.openstreetmap.org" do + owner node[:mediawiki][:user] + group node[:mediawiki][:group] + mode "0775" +end + +apache_site "dump.wiki.openstreetmap.org" do + template "apache_wiki_dump.erb" + directory "/srv/dump.wiki.openstreetmap.org" + variables({ + :aliases => "dump.wiki.osm.org" + }) +end + +template "/etc/cron.d/wiki-osm-org-dump" do + owner "root" + group "root" + mode 0644 + source "cron_wiki_dump.erb" +end + diff --git a/cookbooks/wiki/templates/default/apache_wiki_dump.erb b/cookbooks/wiki/templates/default/apache_wiki_dump.erb new file mode 100644 index 000000000..529404f4c --- /dev/null +++ b/cookbooks/wiki/templates/default/apache_wiki_dump.erb @@ -0,0 +1,20 @@ +# DO NOT EDIT - This file is being maintained by Chef + + + ServerName <%= @name %> + ServerAlias <%= @aliases %> + ServerAdmin webmaster@openstreetmap.org + + CustomLog /var/log/apache2/<%= @name %>-access.log combined + ErrorLog /var/log/apache2/<%= @name %>-error.log + + DocumentRoot <%= @directory %> + + > + Options Indexes FollowSymLinks MultiViews + AllowOverride All + IndexIgnore .ht* . robots.txt HEADER.html HEADER.cgi logo.png style.css + IndexOptions FancyIndexing FoldersFirst NameWidth=* TrackModified + IndexOrderDefault Descending Date + + diff --git a/cookbooks/wiki/templates/default/cron_wiki_dump.erb b/cookbooks/wiki/templates/default/cron_wiki_dump.erb new file mode 100644 index 000000000..a84d2c58d --- /dev/null +++ b/cookbooks/wiki/templates/default/cron_wiki_dump.erb @@ -0,0 +1,3 @@ +#!/bin/bash +# DO NOT EDIT - This file is being maintained by Chef + diff --git a/cookbooks/wiki/templates/default/robots.txt.erb b/cookbooks/wiki/templates/default/robots.txt.erb new file mode 100644 index 000000000..325a1f9ec --- /dev/null +++ b/cookbooks/wiki/templates/default/robots.txt.erb @@ -0,0 +1,25 @@ +User-agent: ia_archiver +Allow: / + +User-agent: 008 +Disallow: / + +User-agent: * +Disallow: /index.php/ +Disallow: /wiki/Lacking_proper_attribution +Disallow: /wiki/Spam +Allow: /w/load.php +Allow: /w/images/ +Allow: /w/skins/ +Disallow: /w/ +Disallow: /wiki/Special:Collection +Disallow: /wiki/Special:Random +Disallow: /wiki/Special%3ARandom +Disallow: /wiki/Special:Search + +User-agent: Exabot +Crawl-delay: 60 + +Sitemap: http://wiki.openstreetmap.org/sitemap-index-wiki.xml + +Host: wiki.openstreetmap.org diff --git a/cookbooks/wiki/templates/default/squid.conf.erb b/cookbooks/wiki/templates/default/squid.conf.erb new file mode 100644 index 000000000..55588a0a5 --- /dev/null +++ b/cookbooks/wiki/templates/default/squid.conf.erb @@ -0,0 +1,11 @@ +acl osmwiki_sites dstdomain wiki.openstreetmap.org wiki.osm.org + +http_access allow osmwiki_sites + +cache_peer localhost parent 80 0 no-query originserver name=osmwikiAccel login=PASS connect-timeout=60 no-digest weight=1000 + +cache_peer_access osmwikiAccel allow osmtile_sites +cache_peer_access osmwikiAccel deny all + +#---------------------------------- +