Faidon Liambotis has uploaded a new change for review.
https://gerrit.wikimedia.org/r/180442
Change subject: install-server: replace lighttpd with nginx
......................................................................
install-server: replace lighttpd with nginx
nginx won the event-based-webservers war and we're already using it
widely in other parts of the infrastructure. Kill lighttpd here.
This doesn't handle the replacement gracefully within puppet and will
fail if applied directly since both servers will try to bind to port 80.
Since the class is only applied in one host (carbon), it's just simpler
to do it manually.
(this removes the rspec test; the module is trivial enough now)
Change-Id: I71ca70321f847ffc6423b827033650407d82c7ef
---
D modules/install-server/files/lighttpd.conf
D modules/install-server/files/logrotate-lighttpd
A modules/install-server/files/nginx.conf
M modules/install-server/manifests/web-server.pp
D modules/install-server/spec/classes/install_server_web_server_spec.rb
5 files changed, 21 insertions(+), 124 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/42/180442/1
diff --git a/modules/install-server/files/lighttpd.conf
b/modules/install-server/files/lighttpd.conf
deleted file mode 100644
index 343e623..0000000
--- a/modules/install-server/files/lighttpd.conf
+++ /dev/null
@@ -1,63 +0,0 @@
-#####################################################################
-### THIS FILE IS MANAGED BY PUPPET
-#####################################################################
-
-server.bind = "0.0.0.0"
-server.port = "80"
-$SERVER["socket"] == "[::]:80" {}
-
-server.modules = (
- "mod_access",
- "mod_accesslog",
- "mod_alias",
- )
-
-server.document-root = "/srv/"
-
-server.errorlog = "/var/log/lighttpd/error.log"
-
-index-file.names = ( "index.php", "index.html" )
-
-accesslog.filename = "/var/log/lighttpd/access.log"
-
-url.access-deny = ( "~", ".inc" )
-
-server.pid-file = "/var/run/lighttpd.pid"
-
-## virtual directory listings
-dir-listing.encoding = "utf-8"
-server.dir-listing = "enable"
-dir-listing.hide-dotfiles = "enable"
-
-server.username = "www-data"
-server.groupname = "www-data"
-
-# Use epoll
-server.event-handler = "linux-sysepoll"
-
-# Set a large keepalive limit
-server.max-keep-alive-requests = 128
-
-## this is a hack
-alias.url = ("___invalid___" => "___invalid___")
-
-#### handle Debian Policy Manual, Section 11.5. urls
-#### and by default allow them only from localhost
-
-$HTTP["host"] == "localhost" {
- global {
- alias.url += (
- "/doc/" => "/usr/share/doc/",
- "/images/" => "/usr/share/images/"
- )
- }
- dir-listing.activate = "enable"
-}
-
-#### external configuration files
-## mimetype mapping
-include_shell "/usr/share/lighttpd/create-mime.assign.pl"
-
-## load enabled configuration files,
-## read /etc/lighttpd/conf-available/README first
-include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
diff --git a/modules/install-server/files/logrotate-lighttpd
b/modules/install-server/files/logrotate-lighttpd
deleted file mode 100644
index cf9308a..0000000
--- a/modules/install-server/files/logrotate-lighttpd
+++ /dev/null
@@ -1,18 +0,0 @@
-/var/log/lighttpd/*.log {
- size 100M
- missingok
- copytruncate
- rotate 10
- compress
- notifempty
- sharedscripts
- postrotate
- if [ -f /var/run/lighttpd.pid ] && ps --pid $(cat
/var/run/lighttpd.pid) > /dev/null 2>&1; then \
- if [ -x /usr/sbin/invoke-rc.d ]; then \
- invoke-rc.d lighttpd reload > /dev/null 2>&1; \
- else \
- /etc/init.d/lighttpd reload > /dev/null 2>&1; \
- fi; \
- fi;
- endscript
-}
diff --git a/modules/install-server/files/nginx.conf
b/modules/install-server/files/nginx.conf
new file mode 100644
index 0000000..bdfb9e7
--- /dev/null
+++ b/modules/install-server/files/nginx.conf
@@ -0,0 +1,11 @@
+server {
+ listen :80;
+ listen [::]:80;
+ root /srv;
+
+ location / {
+ index index.html index.htm;
+ autoindex on;
+ charset utf-8;
+ }
+}
diff --git a/modules/install-server/manifests/web-server.pp
b/modules/install-server/manifests/web-server.pp
index a460473..85801c1 100644
--- a/modules/install-server/manifests/web-server.pp
+++ b/modules/install-server/manifests/web-server.pp
@@ -1,12 +1,12 @@
# Class: install-server::web-server
#
-# This class installs and configures lighttpd to act as a repository for new
+# This class installs and configures nginx to act as a repository for new
# installation enviroments
#
# Parameters:
#
# Actions:
-# Install and configure lighttpd
+# Install and configure nginx
#
# Requires:
#
@@ -14,26 +14,15 @@
# include install-server::web-server
class install-server::web-server {
- package { 'lighttpd':
- ensure => latest,
+ include ::nginx
+
+ nginx::site { 'install-server':
+ source => 'puppet:///modules/install-server/nginx.conf';
}
- file {
- '/etc/lighttpd/lighttpd.conf':
- mode => '0444',
- owner => 'root',
- group => 'root',
- source => 'puppet:///modules/install-server/lighttpd.conf';
- '/etc/logrotate.d/lighttpd':
- mode => '0444',
- owner => 'root',
- group => 'root',
- source => 'puppet:///modules/install-server/logrotate-lighttpd';
- }
-
- service { 'lighttpd':
- ensure => running,
- require => [ File['/etc/lighttpd/lighttpd.conf'],
Package['lighttpd'] ],
- subscribe => File['/etc/lighttpd/lighttpd.conf'],
+ # prevent a /srv root autoindex; empty for now.
+ file { '/srv/index.html':
+ ensure => present,
+ content => '',
}
}
diff --git
a/modules/install-server/spec/classes/install_server_web_server_spec.rb
b/modules/install-server/spec/classes/install_server_web_server_spec.rb
deleted file mode 100644
index 6ae0f7d..0000000
--- a/modules/install-server/spec/classes/install_server_web_server_spec.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'spec_helper'
-
-describe 'install-server::web-server', :type => :class do
-
- it { should contain_package('lighttpd').with_ensure('latest') }
- it { should contain_service('lighttpd').with_ensure('running') }
-
- it do
- should contain_file('/etc/lighttpd/lighttpd.conf').with({
- 'mode' => '0444',
- 'owner' => 'root',
- 'group' => 'root',
- })
- end
- it do
- should contain_file('/etc/logrotate.d/lighttpd').with({
- 'mode' => '0444',
- 'owner' => 'root',
- 'group' => 'root',
- })
- end
-end
--
To view, visit https://gerrit.wikimedia.org/r/180442
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I71ca70321f847ffc6423b827033650407d82c7ef
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Faidon Liambotis <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits